title,body,link,tags,view_count,is_answered,score,answer_count
Karate UI testing,"<p>I was trying to do a POC with the karate test framework for UI application.
We are using Chrome browser.We are required to test the application incognito mode( Or we need to clear the cache and history every-time to get the test running)
what should be the driver type options that we should use to run application in incognito Mode.</p>
",https://stackoverflow.com/questions/64438111/karate-ui-testing,['karate'],716,True,1,1
iOS 14 / UI Testing DatePicker,"<p>I'm struggling fixing my UI tests for iOS 14 that set date on DatePicker views. They were previously running without any problems on iOS 13 when they were shown as wheel pickers. My code used to set the different wheels but since there aren't any wheels anymore on iOS 14, this is not working anymore.</p>
<p>I've tried to use a small demo project and record the change of the date using XCode 12 record button, but it's not working (on Mac OS 10.15.6) because of an error: &quot;Timestamped Event Matching Error: Failed to find matching element&quot; after pressing the date button.</p>
<p>What I'm looking for is a UI test case to set a date for the new date picker of iOS 14:</p>
<p><a href=""https://i.stack.imgur.com/kjLoq.png"" rel=""noreferrer""><img src=""https://i.stack.imgur.com/kjLoq.png"" alt=""enter image description here"" /></a></p>
<p>Here's my demo project:</p>
<pre><code>import SwiftUI

struct ContentView: View {
    @State private var date = Date()

    var body: some View {
        Form {
            DatePicker(selection: $date, displayedComponents: .date) {
                Text(&quot;Date&quot;)
            }
        }
    }
}
</code></pre>
",https://stackoverflow.com/questions/63935026/ios-14-ui-testing-datepicker,"['swift', 'swiftui', 'xcuitest', 'ios14', 'xcode12']",2631,True,5,2
How to run ui testing?,"<p>I get an error when I start testing the application:</p>

<pre><code>    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring ""node_modules"".

    Here's what you can do:
</code></pre>

<p>...</p>

<pre><code>    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    /home/mmvs/Desktop/ReactNative/node_modules/react-navigation/src/index.js:1
    ({""Object.&lt;anonymous&gt;"":function(module,exports,require,__dirname,__filename,global,jest){export * from '@react-navigation/core';
</code></pre>

<p>How to solve this error?</p>
",https://stackoverflow.com/questions/61207163/how-to-run-ui-testing,['react-native'],59,False,1,1
Asynchronous UI testing in Swift,"<p>I have a button in a UI test that logs in to an app. The user flow to automate is this:</p>

<ol>
<li>User taps button</li>
<li>Button text changes from ""Log In"" to ""Processing...""</li>
<li>Button disappears when log in is successful</li>
</ol>

<p>My UI test code is very simple for the functional test:</p>

<pre><code>let loginButton = app.buttons[""LOG IN""]
let welcomeText = app.staticTexts[""Welcome!""]
loginButton.tap()
XCTAssertTrue(welcomeText.waitForExistence(10))
</code></pre>

<p>However, it does not validate that the button <strong>changes state to ""Processing...""</strong>.</p>

<p>If I attempt to put a check in the code like this, it doesn't work because by the time the UI Test has walked the screen looking for the text, it might have disappeared.</p>

<pre><code>let loginButton = app.buttons[""LOG IN""]
let loginButtonProcessingText = app.buttons.staticTexts[""Processing...""]
let welcomeText = app.staticTexts[""Welcome!""]
loginButton.tap()
XCTAssertTrue(loginButtonProcessingText.exists)
XCTAssertTrue(welcomeText.waitForExistence(10))
</code></pre>

<p>So my thought is that I need to somehow start the check for the processing test <strong>simultaneously</strong> with the button tap, or maybe a second before it.</p>

<p>Is there a way to spin up a check like that asynchronously in XCUI testing?</p>
",https://stackoverflow.com/questions/61918579/asynchronous-ui-testing-in-swift,"['ios', 'swift', 'xctest', 'xcuitest']",376,True,-1,1
Android UI Testing - Localized String testing,"<p>This is a two part question. </p>

<p>1 - Does it add value to the project to check every string matches the correct widget across multiple languages for an Activity's associated UI test or should I take a different approach or just not do this at all?</p>

<p>2 - Assuming this is the right approach I have tried to implement the suggestion from the following <a href=""https://stackoverflow.com/questions/16760194/locale-during-unit-test-on-android/21810126"">post</a>. Unfortunately the locale is not updating for my UI tests and fails one of the two tests depending on the system language that I have already set on my device. </p>

<pre><code>@RunWith(AndroidJUnit4ClassRunner.class)
public class RegisterActivityTest {

    @Test
    public void test_onScreenLoadStringsDisplayedInEnglish() {
        testEnglishLocale();
        onView(withId(R.id.welcome_text_view)).check(matches(
            withText(WELCOME_EN)));
    }

    @Test
    public void test_onScreenLoadStringsDisplayedInSpanish() {
        testSpanishLocale();
        onView(withId(R.id.welcome_text_view)).check(matches(
            withText(WELCOME_ES)));
    }


    private void testEnglishLocale() {
        setLocale(""en"", ""US"");
    }

    private void testSpanishLocale() {
        setLocale(""es"", ""ES"");
    }

    private void setLocale(String language, String country) {
        Locale locale = new Locale(language, country);
        // here we update locale for date formatters
        Locale.setDefault(locale);
        // update locale for app resources
        Resources res = InstrumentationRegistry.getInstrumentation().getTargetContext().getResources();
        Configuration config = res.getConfiguration();
        config.locale = locale;
        res.updateConfiguration(config, res.getDisplayMetrics());
    }

}
</code></pre>
",https://stackoverflow.com/questions/61090032/android-ui-testing-localized-string-testing,"['java', 'android', 'localization', 'android-espresso', 'ui-testing']",705,False,2,1
Hamburger menu AutomationId for UI Testing,"<p>I'm trying to run a UI Test on a page (About.xaml).
Below are the steps to get to the page when the application loads.</p>
<ol>
<li>Launch the Login Screen</li>
<li>User enters username</li>
<li>User enters password</li>
<li>User clicks on the Login Button</li>
<li>User lands on the Home Page in an AppShell.</li>
<li>User clicks on the Hamburger menu</li>
<li>User clicks on the About Menu in the Flyout Menu Items.</li>
</ol>
<p>My question is, how do I set the Automation Id for the Hamburger Menu (Flyout Menu) of the AppShell?</p>
<p>Here's the UI Test Case.</p>
<pre><code>          [Test]
public async Task AboutPage_UITest()
{

    //Arange
    app.EnterText(&quot;UsernameEntryId&quot;, &quot;user1&quot;);
    app.EnterText(&quot;PasswordEntryId&quot;, &quot;Abc@123&quot;);


    //Act
    app.DismissKeyboard();
    app.Tap(x =&gt; x.Marked(&quot;LoginButtonId&quot;));

    app.Tap(x =&gt; x.Marked(&quot;AppShellId&quot;));
    //app.Tap(c =&gt; c.Class(&quot;OverflowMenuButton&quot;));  I tried this as well but no luck.
    await Task.Delay(30000);


    app.Tap(x =&gt; x.Marked(&quot;AboutId&quot;));

    //Assert

    var appResult = app.Query(&quot;EmailId&quot;).First(result =&gt; result.Text == &quot;abc@example.com&quot;);
    Assert.IsTrue(appResult != null, &quot;Label is not displaying the right result!&quot;);

    app.Screenshot(&quot;About Page&quot;);
}
</code></pre>
<p>In the AppShell.xaml, here's the top section.</p>
<pre><code>        &lt;Shell xmlns=&quot;http://xamarin.com/schemas/2014/forms&quot;
                 xmlns:x=&quot;http://schemas.microsoft.com/winfx/2009/xaml&quot;
                 FlyoutHeaderBehavior=&quot;CollapseOnScroll&quot;
                 Shell.ItemTemplate=&quot;{StaticResource FlyoutTemplate}&quot;
                 Shell.MenuItemTemplate=&quot;{StaticResource FlyoutTemplate}&quot;
                 FlyoutBackgroundColor=&quot;WhiteSmoke&quot; 
                 Navigating=&quot;OnNavigating&quot; 
                 Navigated=&quot;OnNavigated&quot;
                 AutomationId=&quot;AppShellId&quot;
                 x:Class=&quot;DemoApp.AppShell&quot;&gt;
</code></pre>
",https://stackoverflow.com/questions/63677360/hamburger-menu-automationid-for-ui-testing,"['xamarin', 'xamarin.forms', 'uitest', 'flyout', 'app-shell']",694,True,0,2
Spix - Qt UI testing framework build,"<p>Does anyone managed to build and link <a href=""https://github.com/faaxm/spix"" rel=""nofollow noreferrer"">Spix</a> library using Visual Studio?
For me, the build works, but when I try to link against it in QT, I'm getting a lot of link errors</p>
<pre><code>Eg Spix.lib(socket.obj):-1: error: LNK2019: unresolved external symbol __imp__accept@12 referenced in function &quot;public: unsigned int __thiscall anyrpc::TcpSocket::Accept(void)&quot; (?Accept@TcpSocket@anyrpc@@QAEIXZ)
</code></pre>
<p>Included in .pro the lib</p>
<pre><code>INCLUDEPATH += \
    $$PWD/libs/spix/include \
DEPENDPATH += \
    $$PWD/libs/spix/ \
LIBS += -L$$PWD/libs/spix/ -lSpix
</code></pre>
<p>VS general settings:</p>
<p><img src=""https://i.stack.imgur.com/55Qwj.png"" alt=""generalsettings"" /></p>
<p>VS librarian settings:</p>
<p><img src=""https://i.stack.imgur.com/vPJKB.png"" alt=""librariansettings"" /></p>
",https://stackoverflow.com/questions/63412548/spix-qt-ui-testing-framework-build,"['c++', 'visual-studio', 'qt']",285,False,-1,1
"Android UI Testing, context.startactivity() does not work","<p>I am constructing a Android UI test using UIAutomator, hope to start the target app to be test and do some test actions on the UI. But when I use intent to start the app, it does not work (ie. it does not launch the target app on my real device, but the target app can be launched in <code>MainActivity</code> using <code>startactivity()</code>)</p>

<p>Code_piece (in my androidTest Class):</p>

<pre><code>// Launch the app
Context context = ApplicationProvider.getApplicationContext();
final Intent intent = context.getPackageManager()
        .getLaunchIntentForPackage(""com.target"");
// Clear out any previous instances
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(intent);
</code></pre>

<p>This code is just from officail instruction: <a href=""https://developer.android.com/training/testing/ui-testing/uiautomator-testing"" rel=""nofollow noreferrer"">https://developer.android.com/training/testing/ui-testing/uiautomator-testing</a></p>

<p>I don't know why it can't start the target app, and where the critical problem lies. Does it matters with how the intent to be set, or the package name? (the package could not be wrong because I use it to launch the target app successfully in <code>MainActivity</code>)</p>
",https://stackoverflow.com/questions/62241383/android-ui-testing-context-startactivity-does-not-work,"['android', 'android-intent', 'ui-automation', 'ui-testing', 'start-activity']",200,False,3,0
KarateDSL UI Testing - Friendly Locators not working,"<p>Following the other question that I raised recently, could you guys help spot what is wrong with the way how I wrote the ""below"" friendly locator? Thank you in advance!</p>

<pre><code>Scenario: Get UI - Download
   Given url 'https://test01/v1/doc/env/
   And headers headers1
   When method get
   Then status 200
   * def env = response.url

   Given driver env
   And click('{button}Proceed')
   And click('{span}Start')
   And click('{span}Required - GSA)
   And click('{span}Required - GSB')
   And click('{span}Required - GSC')
   And click('{span}Required - GSD')
   And click('{span}Required - GSE')
   And click('{span}Required - GSF')
   And click('{span}Required - GSG')
   And click('{span}Required - GSH')
   * below('{}Required - GSH').input('karate dsl')
</code></pre>

<p>I have a textarea that I would like values to be entered, but the friendly locator ""below"" is not working for me.</p>

<pre><code>javascript evaluation failed: below('{}Required - GSH').input('karate dsl'), unable to find: {}Required - GSH, BELOW, INPUT
</code></pre>

<p><strong>Update:</strong>
Here's the snippet of the HTML:</p>

<p>Radio button that I need to select first, so the text area will be enabled/required</p>

<pre><code>&lt;div class=""doc-tab radio-tab  signing-required       use-olive"" id=""tab-c6cfbed8-694a-4004-9294-cc0195bab1d0"" data-id=""c6cfbed8-694a-4004-9294-cc0195bab1d0"" data-type=""Radio"" data-label=""FINQ1_66c4593b-7d61-43b5-985f-a22e0909d3dd_b6c1ea40-7291-4ee8-b682-cd770a1bfef8"" style=""left:61.44px; top:421.76px;""&gt;

    &lt;div class=""rb""&gt;
      &lt;input type=""radio"" id=""tab-form-element-c6cfbed8-694a-4004-9294-cc0195bab1d0"" aria-invalid=""false"" name=""FINQ1_66c4593b-7d61-43b5-985f-a22e0909d3dd_b6c1ea40-7291-4ee8-b682-cd770a1bfef8"" class=""rb_input main-radio-tab-input"" value=""tab.id"" data-qa=""radio-tab-c6cfbed8-694a-4004-9294-cc0195bab1d0""&gt;
      &lt;label for=""tab-form-element-c6cfbed8-694a-4004-9294-cc0195bab1d0"" class=""rb_label"" data-qa=""radio-tab-label-c6cfbed8-694a-4004-9294-cc0195bab1d0""&gt;&lt;span class=""tab-label"" style=""white-space: nowrap; width: auto;""&gt;Required - GSG&lt;/span&gt;&lt;/label&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;div class=""doc-tab radio-tab signed signing-required       use-olive"" id=""tab-d05ca57f-06a7-4f2f-a297-da01dc93290a"" data-id=""d05ca57f-06a7-4f2f-a297-da01dc93290a"" data-type=""Radio"" data-label=""FINQ1_66c4593b-7d61-43b5-985f-a22e0909d3dd_b6c1ea40-7291-4ee8-b682-cd770a1bfef8"" style=""left:61.44px; top:446.08px;""&gt;

    &lt;div class=""rb""&gt;
      &lt;input type=""radio"" id=""tab-form-element-d05ca57f-06a7-4f2f-a297-da01dc93290a"" aria-invalid=""false"" name=""FINQ1_66c4593b-7d61-43b5-985f-a22e0909d3dd_b6c1ea40-7291-4ee8-b682-cd770a1bfef8"" class=""rb_input main-radio-tab-input"" value=""tab.id"" checked="""" data-qa=""radio-tab-d05ca57f-06a7-4f2f-a297-da01dc93290a""&gt;
      &lt;label for=""tab-form-element-d05ca57f-06a7-4f2f-a297-da01dc93290a"" class=""rb_label"" data-qa=""radio-tab-label-d05ca57f-06a7-4f2f-a297-da01dc93290a""&gt;&lt;span class=""tab-label"" style=""white-space: nowrap; width: auto;""&gt;Required - GSH&lt;/span&gt;&lt;/label&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;div class=""doc-tab text-tab  signing-required has-tab-error"" id=""tab-3c020567-3db9-449b-bed5-c44b32a236fa"" data-id=""3c020567-3db9-449b-bed5-c44b32a236fa"" data-type=""Text"" data-label=""FINQues1_1_comments_Text_66c4593b-7d61-43b5-985f-a22e0909d3dd_b6c1ea40-7291-4ee8-b682-cd770a1bfef8"" style=""left:56.32px; top:503.04px;""&gt;
</code></pre>

<p>Here's the text area that I would like to locate using the ""below"" friendly locator.</p>

<pre><code>&lt;div class=""doc-tab text-tab  signing-required         has-tab-error"" id=""tab-3c020567-3db9-449b-bed5-c44b32a236fa"" data-id=""3c020567-3db9-449b-bed5-c44b32a236fa"" data-type=""Text"" data-label=""myQues1_1_comments_Text_66c4593b-7d61-43b5-985f-a22e0909d3dd_b6c1ea40-7291-4ee8-b682-cd770a1bfef8"" style=""left:56.32px; top:503.04px;""&gt;
 
    &lt;div id=""tab-sizer-3c020567-3db9-449b-bed5-c44b32a236fa"" class=""tab-form-element signing-required tab-sizer multiline"" style=""width: 676px; font-family: &amp;quot;Lucida Console&amp;quot;, &amp;quot;Andale Mono&amp;quot;, Monaco, monospace; font-size: 12.16px; letter-spacing: 0.14px; color: rgb(0, 0, 0); line-height: 14px; text-align: left; height: auto; min-height: auto; white-space: pre-wrap;""&gt;&lt;/div&gt;
 
    &lt;textarea id=""tab-form-element-3c020567-3db9-449b-bed5-c44b32a236fa"" aria-invalid=""false"" title="""" data-qa=""text-multi-input-tab-3c020567-3db9-449b-bed5-c44b32a236fa"" class=""main-text-tab-input tab-form-element signing-required "" maxlength=""450"" style=""width: 676px; font-family: &amp;quot;Lucida Console&amp;quot;, &amp;quot;Andale Mono&amp;quot;, Monaco, monospace; letter-spacing: 0.14px; color: rgb(0, 0, 0); line-height: 14px; text-align: left; font-size: 12.16px !important; height: 98px;""&gt;&lt;/textarea&gt;
 
    &lt;label for=""tab-form-element-3c020567-3db9-449b-bed5-c44b32a236fa"" class=""tab-label"" style=""white-space: nowrap; width: auto;""&gt;Required&lt;span class=""tab-error-message"" aria-live=""polite""&gt;&lt;/span&gt;&lt;/label&gt;
&lt;/div&gt;

</code></pre>
",https://stackoverflow.com/questions/61478511/karatedsl-ui-testing-friendly-locators-not-working,"['api', 'user-interface', 'testing', 'karate']",1303,True,1,1
KarateDSL UI Testing - Browser is closing automatically,"<p>I have recently implemented UI automation along with my API test automation (both in Karate). It is working now with minor issue - the browser is getting closed automatically after the script is executed completely. Is there a way in Karate to either close or retain the browser opened? Thank you!</p>

<pre><code>Scenario: Get UI - Download
   Given url 'https://test01/v1/doc/env/
   And headers headers1
   When method get
   Then status 200
   * def env = response.url

   Given driver env
   And click('{button}Proceed')
   And click('{span}Start')
   And click('{span}Required - GSA)
   And click('{span}Required - GSB')
   And click('{span}Required - GSC')
   And click('{span}Required - GSD')
   And click('{span}Required - GSE')
   And click('{span}Required - GSF')
   And click('{span}Required - GSG')
   And click('{span}Required - GSH')
</code></pre>
",https://stackoverflow.com/questions/61474161/karatedsl-ui-testing-browser-is-closing-automatically,"['api', 'testing', 'karate']",644,True,1,2
Activity never becomes requested state in UI Testing,"<p>When implement code to test UI in android using kotlin.</p>

<p>this is my code</p>

<p><a href=""https://i.stack.imgur.com/O4gok.png"" rel=""noreferrer""><img src=""https://i.stack.imgur.com/O4gok.png"" alt=""this is my code ""></a></p>

<p>I thinks it 's simple code to test but android studio prevent me due to some problem >
I searched a lot for this but no result . I tried a lot of solution but no result also .
Thanks .</p>

<p>I get this error  and activity which I test doesn't start .</p>

<pre><code>java.lang.AssertionError: Activity never becomes requested state ""[STARTED, RESUMED, DESTROYED, CREATED]"" (last lifecycle transition = ""PRE_ON_CREATE"")
at androidx.test.core.app.ActivityScenario.waitForActivityToBecomeAnyOf(ActivityScenario.java:301)
at androidx.test.core.app.ActivityScenario.launchInternal(ActivityScenario.java:235)
at androidx.test.core.app.ActivityScenario.launch(ActivityScenario.java:190)
at com.elgaml.myuitesting.MainActivityTest.test_isActivityinView(MainActivityTest.kt:18)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:392)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2204)

</code></pre>

<p>and my build.gradle is :</p>

<pre><code>apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion ""29.0.2""

    defaultConfig {
        applicationId ""com.elgaml.myuitesting""
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName ""1.0""

        testInstrumentationRunner ""androidx.test.runner.AndroidJUnitRunner""
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation ""org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version""
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'

    def androidx_test_espresso=""3.2.0""
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    androidTestImplementation ""androidx.test.espresso.idling:idling-concurrent:$androidx_test_espresso""
    implementation ""androidx.test.espresso:espresso-idling-resource:$androidx_test_espresso""


    // Mockk.io
    def mockk_version = ""1.9.3""
    androidTestImplementation ""io.mockk:mockk-android:$mockk_version""

    // androidx.test
    def androidx_test = ""1.1.0""
    androidTestImplementation ""androidx.test:runner:$androidx_test""
    androidTestImplementation ""androidx.test:core:$androidx_test""
    androidTestImplementation ""androidx.test.ext:junit-ktx:$androidx_test""

}
</code></pre>
",https://stackoverflow.com/questions/62083769/activity-never-becomes-requested-state-in-ui-testing,"['java', 'android', 'kotlin', 'junit', 'android-espresso']",2607,False,7,2
clicking a NSToolbarItem in XCTest UI Testing,"<p>I'm writing UI Tests for a document-based macOS app.</p>

<p><strong>In a UI Test, how can I click on an NSToolbarTiem in a localization friendly way?</strong></p>

<p>Recording doesn't record anything when I click on one.</p>

<p><code>NSToolbarItem</code> doesn't seem to have an <code>accessibilityIdentifier</code>.</p>
",https://stackoverflow.com/questions/60049132/clicking-a-nstoolbaritem-in-xctest-ui-testing,"['xcode', 'xctest', 'xcode-ui-testing']",107,False,0,1
Xamarin.forms UI testing problem with android sdk,"<p>I'm trying to Ui test my app but get this error<a href=""https://i.stack.imgur.com/dpr8a.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/dpr8a.png"" alt=""enter image description here"" /></a></p>
<p>I added the environment variable
<a href=""https://i.stack.imgur.com/gtptw.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/gtptw.png"" alt=""enter image description here"" /></a></p>
<p>Can someone help me? i have this problem for about 3 hours now...
I'm trying to use my own android phone not an emulator</p>
",https://stackoverflow.com/questions/65379442/xamarin-forms-ui-testing-problem-with-android-sdk,['xamarin.forms'],76,False,0,1
avoiding app state restoration in XCTest UI Testing,"<p>I'm writing UI Tests for a document-based macOS app.</p>

<p>The test opens a template document by clicking a button in a splash-screen window (much like the ""Welcome to Xcode"" window). This works on the first test run. But subsequent launches are foiled by state restoration as the previously opened document is covering the splash-screen window.</p>

<p><strong>How can I disable state restoration when running Xcode UI tests?</strong></p>

<p>I've disabled state restoration in my app target (""Launch application without state restoration""), which works fine. But this doesn't carry over to the test target, even when ""Use the Run Action's arguments and environment variables"" is checked.</p>

<p>I've also tried to close the previously opened document at the end of the test, but ""Record UI Test"" doesn't record anything when I click on ""Delete Copy"" in the save dialog.</p>
",https://stackoverflow.com/questions/60044983/avoiding-app-state-restoration-in-xctest-ui-testing,"['xcode', 'xctest', 'xcode-ui-testing']",283,True,2,1
&quot;No tests were found&quot; during Android UI Testing,"<p>If I want to run a single test sometimes by right clicking on the test then selecting run, the test results would show ""No tests were found"" with an error related to ""Exception in thread ""main"" java.lang.NoClassDefFoundError"".</p>

<p>I found this to only happen some times, why is this occurring?</p>
",https://stackoverflow.com/questions/59583303/no-tests-were-found-during-android-ui-testing,"['android', 'android-espresso']",2047,True,2,2
SwiftUI TextEditor UI Testing Failure for typeText method,"<p>&quot;typeText&quot; method is working for 'TextField' element but not working for the 'TextEditor' element in the Xcode UI Tests. Connecting Hardware Keyboard options (enable/disable) were tried and no success. Any workarounds?</p>
<blockquote>
<p>Failed to synthesize event: Neither element nor any descendant has keyboard focus. Event dispatch snapshot: TextView, identifier: 'content'</p>
</blockquote>
<pre><code>let nameTextField = app.textFields[&quot;name&quot;]
nameTextField.tap()
nameTextField.typeText(&quot;Test Name&quot;) // Working 

let contentTextEditor = app.textViews[&quot;content&quot;]
contentTextEditor.tap() // It successfully makes the cursor focus on the TextEditor element 
contentTextEditor.typeText(&quot;Test Content&quot;) // Here is the error
</code></pre>
",https://stackoverflow.com/questions/64555042/swiftui-texteditor-ui-testing-failure-for-typetext-method,"['ios', 'swift', 'xcode', 'swiftui', 'xcode-ui-testing']",601,True,2,1
"UI testing ListView, getting count and specific item","<p>I am able create a UI Test for ListView on iOS. However, the same code doesn't work on Android.</p>
<p>On iOS, list count is what I expect to be in the list. On Android, the list count is +1. I am also not able to get the data from the list at a particular position.</p>
<p>Below, is my code that works well for iOS, but is not working for Android.</p>
<p>Is it possible that same script that is working for iOS may not work for Android?</p>
<pre><code>//count the number of child in the list

Assert.That(app.Query(x =&gt; 
    x.Marked(&quot;AutomationId_ProfileVehicleList&quot;).Child()).Length, Is.EqualTo(3));

//get the data from list and match

Assert.AreEqual(app.Query(c =&gt; c.Id(&quot;AutomationId_ProfileVehicle&quot;))[0].Text, 
     &quot;KA123C3&quot;);
</code></pre>
",https://stackoverflow.com/questions/62772962/ui-testing-listview-getting-count-and-specific-item,"['xamarin', 'xamarin.uitest']",675,True,1,1
UI testing of a UIKeyCommand added via keyCommands,"<p>I have freshly added a bunch of key commands (Cmd-..., etc) in the app by implementing</p>
<pre><code>-(NSArray&lt;UIKeyCommand*&gt;*)keyCommands;
</code></pre>
<p>on a UIViewController subclass. Everything works wonderfully when manually tested in the app. The problem is how to UI test this in the iOS simulator.</p>
<p>I don't seem to be able invoke these commands using a method on <code>XCUIElement</code>. According to <a href=""https://developer.apple.com/documentation/xctest/xcuielement?language=objc"" rel=""nofollow noreferrer"">its documentation</a>, there only seems to be one text input method on iOS</p>
<pre><code>- (void)typeText:(NSString *)text;
</code></pre>
<p>with no (apparent) way to bless the input character with a key modifier flag (<code>XCUIKeyModifierFlags</code>) for <code>Cmd</code>, <code>Alt</code>, etc keys.</p>
<p>The method</p>
<pre><code>- (void)typeKey:(NSString *)key modifierFlags:(XCUIKeyModifierFlags)flags;
</code></pre>
<p>appears to be macOS only. It would be a shame to provide these commands but not be able to test them in our UI testing suite.</p>
<p>Any ideas that can help me make some progress would be hugely welcome.</p>
",https://stackoverflow.com/questions/64114804/ui-testing-of-a-uikeycommand-added-via-keycommands,"['ios', 'xctest', 'xcode-ui-testing', 'ui-testing']",222,False,1,1
Swift UI Testing: Failed to install requested application,"<p>I recorded a UI test case and when I try to run it I get the following message:</p>
<pre><code>&quot;Failed to install the requested application. The bundle identifier of the application could not be determined. Ensure that the application's info.plist contains a value for CFBundleIdentifier.&quot;
</code></pre>
<p>It appears for both testing on the simulator and device. The application itself can be build and runs completely without problems on simulator and device. UI Tests for other applications on the same machine run as well.</p>
<p>The info.plist of the UI Test target is the default info.plist which was created when I added the UI test target. What could be the problem here?</p>
",https://stackoverflow.com/questions/62821989/swift-ui-testing-failed-to-install-requested-application,"['ios', 'swift', 'coded-ui-tests', 'xcode-ui-testing']",422,False,-1,1
XCTest UI Testing - How to lock the screen?,"<p>Related to <a href=""https://stackoverflow.com/questions/41951539/xctest-ui-testing-how-to-close-and-open-an-app-without-relaunch"">XCTest UI Testing - How to close and open an app without relaunch?</a> is there any way to lock the screen from a UI test? <code>XCUIDevice.Button</code> only has three cases, home, volume up and volume down.</p>
",https://stackoverflow.com/questions/64902932/xctest-ui-testing-how-to-lock-the-screen,"['xctest', 'xcode-ui-testing']",232,True,0,1
Does CI agent OS matter in webapp UI testing?,"<p>Our webapp is usually accessed using Google Chrome in a windows OS. Should we really need to have a windows OS for this or ubuntu with GUI is sufficient?</p>
<p>AFAIK, Chrome is sandbox from the OS. We are using teamcity and selenium, chrome driver for testing. Our plan is to use Ubuntu with GUI and register it as a teamcity agent, e.g. kubernetes pod if possible</p>
",https://stackoverflow.com/questions/65035623/does-ci-agent-os-matter-in-webapp-ui-testing,"['selenium', 'google-chrome', 'teamcity', 'chromium', 'sandbox']",48,True,1,1
Android UI testing - checking the checkboxes in a listView,"<p>I'm populating a listView with a title and a checkbox in a DialogFragment.</p>

<p><strong>Question</strong>: With this layout, how can I make espresso check first few items, and then verify if they have been checked. </p>

<pre><code>private var departments: ArrayList&lt;Department&gt;? = arrayListOf()

private inner class DeptAdapter(context: Context?, data: ArrayList&lt;Department&gt;) : ArrayAdapter&lt;Department&gt;(context!!, 0, data as List&lt;Department&gt;) {

    override fun getView(position: Int, convertView: View?, container: ViewGroup): View {
        var view: View? = convertView
        if (view == null) {
            view = layoutInflater.inflate(android.R.layout.simple_list_item_multiple_choice, container, false)
        }

        val checkedTextView = view?.findViewById&lt;CheckedTextView&gt;(android.R.id.text1)
        checkedTextView?.text = getItem(position)?.name

        checkedTextView?.isChecked = departments?.contains(getItem(position)) ?: false
        checkedTextView?.tag = getItem(position)

        checkedTextView?.setOnClickListener {
            if (checkedTextView.isChecked) {
                checkedTextView.isChecked = false
                departments?.remove(it.tag)
            } else {
                checkedTextView.isChecked = true
                departments?.add(it.tag as Department)
            }
        }
        return view!!
    }

}
</code></pre>

<p>XML of <strong>simple_list_item_multiple_choice</strong> looks like this.</p>

<pre><code>&lt;CheckedTextView xmlns:android=""http://schemas.android.com/apk/res/android""
    android:id=""@android:id/text1""
    android:layout_width=""match_parent""
    android:layout_height=""?android:attr/listPreferredItemHeightSmall""
    android:textAppearance=""?android:attr/textAppearanceListItemSmall""
    android:gravity=""center_vertical""
    android:checkMark=""?android:attr/listChoiceIndicatorMultiple""
    android:paddingStart=""?android:attr/listPreferredItemPaddingStart""
    android:paddingEnd=""?android:attr/listPreferredItemPaddingEnd"" /&gt;
</code></pre>

<p>ListView that contains above CheckedTextView looks like this.</p>

<pre><code>&lt;ListView
        android:id=""@+id/departments""
        android:layout_width=""match_parent""
        android:layout_height=""0dp""
        app:layout_constraintBottom_toTopOf=""@+id/cancel""
        app:layout_constraintEnd_toEndOf=""parent""
        app:layout_constraintStart_toStartOf=""parent""
        app:layout_constraintTop_toTopOf=""parent"" /&gt;
</code></pre>
",https://stackoverflow.com/questions/61313344/android-ui-testing-checking-the-checkboxes-in-a-listview,"['android', 'android-espresso']",97,False,1,0
how to handle alert boxes in KARATE UI testing,"<p>I have stared using Karate, as suggested by one of my client for our UI automation. it was some how going in good direction but as of now I am struggling to handle alert box on browser. I tried few things like switchFarme or input('body', Key.ENTER) but no success.
Can any one help me.</p>
",https://stackoverflow.com/questions/62089470/how-to-handle-alert-boxes-in-karate-ui-testing,['karate'],1110,True,-1,1
Android UI testing: Why LiveData&#39;s observers are not being called?,"<p>I have been trying, without success, to do some UI tests on Android.
My app follows the MVVM architecture and uses Koin for DI.</p>
<p>I followed <a href=""https://proandroiddev.com/testing-your-isolated-fragments-with-koin-9d9d39f7b17e"" rel=""nofollow noreferrer"">this tutorial</a> to properly set up a UI test for a Fragment with <strong>Koin, MockK and Kakao.</strong></p>
<p>I created the custom rule for injecting mocks, setup the ViewModel, and on the @Before call, run the expected answers and returns with MockK. The problem is that, even when the fragment's viewmodel's LiveData object is the same as the testing class's LiveData object, the Observer's onChange is never triggered on the Fragment.</p>
<p>I run the test with the debugger and it seems the LiveData functions and MockK's answers are properly called. The logs show that the value hold by the LiveData objects is the same. The lifecycle of the Fragment when the test is running is <strong>Lifecycle.RESUMED</strong>. So why is the Observer's <strong>onChange(T)</strong> not being triggered?</p>
<p>The custom rule:</p>
<pre><code>@VisibleForTesting(otherwise = VisibleForTesting.NONE)
abstract class FragmentTestRule&lt;F : Fragment&gt; :
    ActivityTestRule&lt;FragmentActivity&gt;(FragmentActivity::class.java, true, true) {

    override fun afterActivityLaunched() {
        super.afterActivityLaunched()
        activity.runOnUiThread {
            val fm = activity.supportFragmentManager
            val transaction = fm.beginTransaction()

            transaction.replace(
                android.R.id.content,
                createFragment()
            ).commit()
        }
    }

    override fun beforeActivityLaunched() {
        super.beforeActivityLaunched()
        val app = InstrumentationRegistry.getInstrumentation()
            .targetContext.applicationContext as VideoWorldTestApp

        app.injectModules(getModules())
    }

    protected abstract fun createFragment(): F

    protected abstract fun getModules(): List&lt;Module&gt;

    fun launch() {
        launchActivity(Intent())
    }


}

   @VisibleForTesting(otherwise = VisibleForTesting.NONE)
   fun &lt;F : Fragment&gt; createRule(fragment: F, vararg module: Module): FragmentTestRule&lt;F&gt; =
    object : FragmentTestRule&lt;F&gt;() {
        override fun createFragment(): F = fragment
        override fun getModules(): List&lt;Module&gt; = module.toList()
    }
</code></pre>
<p>My test App:</p>
<pre><code>@VisibleForTesting(otherwise = VisibleForTesting.NONE)
class VideoWorldTestApp: Application(){

    companion object {
        lateinit var instance: VideoWorldTestApp
    }

    override fun onCreate() {
        super.onCreate()
        instance = this

        startKoin {
            if (BuildConfig.DEBUG) androidLogger(Level.DEBUG) else EmptyLogger()
            androidContext(this@VideoWorldTestApp)
            modules(emptyList())
        }
        Timber.plant(Timber.DebugTree())
    }

    internal fun injectModules(modules: List&lt;Module&gt;) {
        loadKoinModules(modules)
    }

}
</code></pre>
<p>The custom test runner:</p>
<pre><code>class CustomTestRunner: AndroidJUnitRunner() {

    override fun newApplication(
        cl: ClassLoader?,
        className: String?,
        context: Context?
    ): Application {
        return super.newApplication(cl, VideoWorldTestApp::class.java.name, context)
    }
}
</code></pre>
<p>The test:</p>
<pre><code>@RunWith(AndroidJUnit4ClassRunner::class)
class HomeFragmentTest {


    private val twitchViewModel: TwitchViewModel = mockk(relaxed = true)
    private val userData = MutableLiveData&lt;UserDataResponse&gt;()
    private val fragment = HomeFragment()

    @get:Rule
    var fragmentRule = createRule(fragment, module {
        single(override = true) {
            twitchViewModel
        }
    })
    @get:Rule
    var countingTaskExecutorRule = CountingTaskExecutorRule()

    @Before
    fun setup() {
        val userResponse: UserResponse = mockk()
        every { userResponse.displayName } returns &quot;Rubius&quot;
        every { userResponse.profileImageUrl } returns &quot;&quot;
        every { userResponse.description } returns &quot;Soy streamer&quot;
        every { userResponse.viewCount } returns 5000
        every { twitchViewModel.userData } returns userData as LiveData&lt;UserDataResponse&gt;
        every { twitchViewModel.getUserByInput(any()) }.answers {
            userData.value = UserDataResponse(listOf(userResponse))
        }
    }

    @Test //This one is passing
    fun testInitialViewState() {
        onScreen&lt;HomeScreen&gt; {
            streamerNameTv.containsText(&quot;&quot;)
            streamerCardContainer.isVisible()
            nameInput.hasEmptyText()
            progressBar.isGone()
        }
    }

    @Test //This one is failing
    fun whenWritingAName_AndPressingTheImeAction_AssertTextChanges() {
        onScreen&lt;HomeScreen&gt; {
            nameInput.typeText(&quot;Rubius&quot;)
            //nameInput.pressImeAction()
            searchBtn.click()
            verify { twitchViewModel.getUserByInput(any()) } //This passes
            countingTaskExecutorRule.drainTasks(5, TimeUnit.SECONDS)
            streamerNameTv.hasText(&quot;Rubius&quot;) //Throws exception
            streamerDescp.hasText(&quot;Soy streamer&quot;)
            streamerCount.hasText(&quot;Views: ${5000.formatInt()}}&quot;)
        }
    }

}
</code></pre>
<p>The fragment being tested:</p>
<pre><code>class HomeFragment : BaseFragment&lt;FragmentHomeBinding&gt;(R.layout.fragment_home) {

    override val bindingFunction: (view: View) -&gt; FragmentHomeBinding
        get() = FragmentHomeBinding::bind


    val twitchViewModel: TwitchViewModel by sharedViewModel()

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        twitchViewModel.getUserClips(&quot;&quot;)

        binding.nameInput.setOnEditorActionListener { _, actionId, _ -&gt;
            if(actionId == EditorInfo.IME_ACTION_SEARCH) {
                twitchViewModel.getUserByInput(binding.nameInput.text.toString())
                hideKeyboard()
                return@setOnEditorActionListener true
            }
            return@setOnEditorActionListener false
        }

        binding.searchBtn.setOnClickListener {
            twitchViewModel.getUserByInput(binding.nameInput.text.toString() ?: &quot;&quot;)
            hideKeyboard()
        }

        twitchViewModel.userData.observe(viewLifecycleOwner, Observer { data -&gt;
            if (data != null &amp;&amp; data.dataList.isNotEmpty()){

                binding.streamerCard.setOnClickListener {
                    findNavController().navigate(R.id.action_homeFragment_to_clipsFragment)
                }

                val streamer = data.dataList[0]
                Picasso.get()
                    .load(streamer.profileImageUrl)
                    .into(binding.profileIv)
                binding.streamerLoginTv.text = streamer.displayName
                binding.streamerDescpTv.text = streamer.description
                binding.streamerViewCountTv.text = &quot;Views: ${streamer.viewCount.formatInt()}&quot;
            }
            else {
                binding.streamerCard.setOnClickListener {  }
            }
        })

        twitchViewModel.errorMessage.observe(viewLifecycleOwner, Observer { msg -&gt;
            showSnackbar(msg)
        })

        twitchViewModel.progressVisibility.observe(viewLifecycleOwner, Observer { visibility -&gt;
            binding.progressBar.visibility = visibility
            binding.cardContent.visibility =
                if(visibility == View.VISIBLE)
                    View.GONE
                else
                    View.VISIBLE
        })

    }
}
</code></pre>
<p>The ViewModel:</p>
<pre><code>class TwitchViewModel(private val repository: TwitchRepository): BaseViewModel() {

    private val _userData = MutableLiveData&lt;UserDataResponse&gt;()
    val userData = _userData as LiveData&lt;UserDataResponse&gt;
    private val _userClips = MutableLiveData&lt;UserClipsResponse?&gt;()
    val userClips = _userClips as LiveData&lt;UserClipsResponse?&gt;

    init {
        viewModelScope.launch {
            repository.authUser(this@TwitchViewModel)
        }
    }

    fun currentUserId() = userData.value?.dataList?.get(0)?.id ?: &quot;&quot;


    fun clipsListExists() = userClips.value != null


    fun getUserByInput(input: String){
        viewModelScope.launch {
            _progressVisibility.value = View.VISIBLE
            _userData.value = repository.getUserByName(input, this@TwitchViewModel)
            _progressVisibility.value = View.GONE
        }
    }

    /**
     * @param userId The ID of the Streamer whose clips are gonna fetch. If null, resets
     * If empty, sets the [userClips] value to null.
     */
    fun getUserClips(userId: String){
        if(userId.isEmpty()) {
            _userClips.postValue(null)
            return
        }
        if(userId == currentUserId() &amp;&amp; _userClips.value != null) {
            _userClips.postValue(_userClips.value)
            return
        }

        viewModelScope.launch {
            _userClips.value = repository.getUserClips(userId, this@TwitchViewModel)
        }
    }
}
</code></pre>
<p>When running the test with the normal ActivityRule and launching the Activity as it were a normal launch, the observers are triggering successfully.
I'm using a relaxed mock to avoid having to mock all functions and variables.</p>
",https://stackoverflow.com/questions/62537783/android-ui-testing-why-livedatas-observers-are-not-being-called,"['android', 'android-fragments', 'android-viewmodel', 'ui-testing', 'mockk']",1728,True,0,1
UI testing without running a test on a real device,"<p>Is there some way to test individual <code>View</code> components without running the UI test?</p>
<p>For example, can I check cases like this:</p>
<ul>
<li><p>check the change of the <code>View</code> state. For example, when the <code>onClick()</code> method is called, a change in the state of the <code>View</code> (color changes or visibility) is called.</p>
</li>
<li><p>check that if, for example, in the <code>RecyclerView.Adapter</code> I give a list, then it is filled and I can, for example, check some element and check its validity relative to the passed list.</p>
</li>
<li><p>that when a method is called, an animation starts.</p>
</li>
</ul>
<p>I am not interested in rendering in this case, only the fact of executing the methods I need with the parameters I need.</p>
<p>What tools and approaches are used for this? What about <code>Robolectric</code>? I heard not very good reviews about him, can he fulfill my requirements? And are there any alternatives?</p>
",https://stackoverflow.com/questions/62949528/ui-testing-without-running-a-test-on-a-real-device,"['android', 'android-testing']",53,False,0,1
Hilt dependency injection for UI testing says &quot;HiltAndroidRule&quot; wasn&#39;t added but it was,"<p>I'm trying to use Hilt for dependency injection but it gives the error <code>java.lang.IllegalStateException: The component was not created. Check that you have added the HiltAndroidRule.</code> The HiltAndroidRule is added though:</p>
<pre><code>@RunWith(AndroidJUnit4.class)
@UninstallModules(ItemsModule.class)
@HiltAndroidTest
public class SelectItemActivityTest {

    @Rule
    public HiltAndroidRule hiltRule = new HiltAndroidRule(this);

    @Before
    public void init() {
        hiltRule.inject();
    }
    @BindValue
    List&lt;Item&gt; items = getItems();
    List&lt;Item&gt; getItems()  {
        List&lt;Item&gt; items = new ArrayList&lt;&gt;();
        items.add(new Item(1, &quot;Item1&quot;, &quot;&quot;, true, true, true));;
        items.add(new Item(2, &quot;Item2&quot;, &quot;&quot;, true, true, true));;
        items.add(new Item(3, &quot;Item3&quot;, &quot;&quot;, true, true, true));;
        return items;
    }

    @Rule
    public ActivityTestRule&lt;SelectItemActivity&gt; mActivityRule =
            new ActivityTestRule&lt;&gt;(SelectItemActivity.class);

    @Test
    public void text_isDisplayed() {
        onView(withText(&quot;Item1&quot;)).check(matches(isDisplayed()));
    }
}
</code></pre>
<p>I've also tried adding an ItemsModule inside the class but that had the same result.</p>
",https://stackoverflow.com/questions/62814001/hilt-dependency-injection-for-ui-testing-says-hiltandroidrule-wasnt-added-but,"['android', 'dependency-injection', 'dagger-hilt']",7432,True,17,2
Failed to prevent system sleep during UI testing. Error code: -536870211,"<p>When I try to run my unit tests I'm getting this error.  It's weird because I have no UI tests.  Quitting Xcode and restarting doesn't work.</p>
",https://stackoverflow.com/questions/65138337/failed-to-prevent-system-sleep-during-ui-testing-error-code-536870211,"['swift', 'unit-testing', 'xctest']",262,False,0,1
How to to get EnvironmentObject/Publishers in UI Testing in SwiftUI,"<p>I am trying to write UI Test for SwiftUI sign page with tries to check a publisher from a class if the variable is toggled from <code>false</code> to <code>true</code>. What I have done is to import the app as module <code>@testable import MyApp</code> then wrote this code as bellow;</p>
<pre><code>func testLogInOfAUser() throws {
    let email = app.textFields[&quot;email&quot;]
    email.tap()
    email.typeText(&quot;email@mail.com \n&quot;)
    let password = app.secureTextFields[&quot;password&quot;]
    password.tap()
    password.typeText(&quot;password \n&quot;)
    let loginBtn = app.buttons[&quot;Login&quot;]
    loginBtn.tap()
    
    let sut = UserAuth()
    sut.login()

    XCTAssert(sut.isLoggedin == true)
    
}
</code></pre>
<p>Class for <code>UserAuth</code></p>
<pre><code>class UserAuth: ObservableObject {
    @Published var isLoggedin:Bool = false
    
    func login() {
        self.isLoggedin.toggle()
    }
}
</code></pre>
<p>When I run the test I run into this error;</p>
<pre><code>Undefined symbols for architecture arm64:
  &quot;type metadata accessor for MyApp.UserAuth&quot;, referenced from:
      MyAppUITests.MyAppUITests.testLogInOfAUser() throws -&gt; () in MyAppUITests.o
  &quot;MyApp.UserAuth.__allocating_init() -&gt; MyApp.UserAuth&quot;, referenced from:
      MyAppUITests.MyAppUITests.testLogInOfAUser() throws -&gt; () in MyAppUITests.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
</code></pre>
",https://stackoverflow.com/questions/62823471/how-to-to-get-environmentobject-publishers-in-ui-testing-in-swiftui,"['swift', 'unit-testing', 'testing', 'swiftui', 'xcode-ui-testing']",380,False,0,1
UI Testing: How to query for picker value in a form,"<p>I'm trying to write a UI test for a form containing a picker. I would like to check whether the selected value of the picker is &quot;2&quot; or &quot;2 Coins&quot; respectively after launching the app.</p>
<p>I'm able to tap the picker and select a new value:</p>
<pre><code>func testExample() throws {
    let app = XCUIApplication()
    app.launch()
    
    app.tables.buttons[&quot;Coins&quot;].tap()
    app.tables.buttons[&quot;1 Coin&quot;].tap()
}
</code></pre>
<p>But I don't know how to check which value is selected.</p>
<p>Here's the view:</p>
<pre><code>import SwiftUI

struct ContentView: View {
    @State private var coins = 2

    var body: some View {
        NavigationView {
            Form {
                Picker(&quot;Coins&quot;, selection: $coins) {
                    Text(&quot;1 Coin&quot;).tag(1)
                    Text(&quot;2 Coins&quot;).tag(2)
                    Text(&quot;3 Coins&quot;).tag(3)
                }
            }
        }
    }
}
</code></pre>
",https://stackoverflow.com/questions/63397724/ui-testing-how-to-query-for-picker-value-in-a-form,"['swift', 'swiftui', 'xcode-ui-testing']",166,False,0,0
How do I access a VStack while UI testing my SwiftUI app,"<p>I have a <code>VStack</code> with code relying on the <code>.onTapGesture</code> method. Something like this:</p>

<pre class=""lang-swift prettyprint-override""><code>VStack {
    if imageShow {
        Image(""image1"")
    }
    else {
        Image(""image2"")
    }
}
.onTapGesture {
    imageShow.toggle()
}
</code></pre>

<p>I'd like to test this behavior within a UI Test using XCTest. The problem is, I don't know how to access the VStack in order to apply a <code>.tap()</code> to it. I can't seem to find the method attached to <code>app</code>. A button is found using <code>app.buttons[]</code> but there doesn't seem to be an equivalent for <code>app.VStack</code> or <code>app.HStack</code>.</p>

<p>Also, I've tried converting this code to wrap the <code>VStack</code> in a <code>Button</code>, but for some reason, this overlays my image, distorting the preferred behavior.</p>

<p>Updating with full <code>VStack</code> code snippet that I am working with:</p>

<pre class=""lang-swift prettyprint-override""><code>VStack(alignment: .leading, spacing: 0) {
    ZStack {
        if self.create_event_vm.everyone_toggle == true {
            Image(""loginBackground"")
                .resizable()
                .accessibility(identifier: ""everyone_toggle_background"")
            }
        HStack {
            VStack(alignment: .leading, spacing: 0) {
                Text(""Visible to everyone on Hithr"")
                    .kerning(0.8)
                    .scaledFont(name: ""Gotham Medium"", size: 18)                                          .foregroundColor(self.create_event_vm.everyone_toggle ? Color.white : Color.black)
                    .frame(alignment: .leading)

                    Text(""Public event"")
                        .kerning(0.5)
                        .scaledFont(name: ""Gotham Light"", size: 16)
                                    .foregroundColor(self.create_event_vm.everyone_toggle ? Color.white : Color.black)
                        .frame(alignment: .leading)
                    }
                    .padding(.leading)
                    Spacer()
                }
            }
        }
        .frame(maxWidth: .infinity, maxHeight: 74)
        .onTapGesture {
            self.create_event_vm.everyone_toggle.toggle()
        }
        .accessibility(identifier: ""public_event_toggle"")
        .accessibility(addTraits: .isButton)
</code></pre>
",https://stackoverflow.com/questions/62392499/how-do-i-access-a-vstack-while-ui-testing-my-swiftui-app,"['swiftui', 'xctest', 'xcuitest']",1485,True,5,3
Why does google state that animations should be disabled for UI testing?,"<blockquote>
<p>To avoid flakiness, we highly recommend that you turn off system
animations on the virtual or physical devices used for testing.</p>
</blockquote>
<p><a href=""https://developer.android.com/training/testing/espresso/setup"" rel=""nofollow noreferrer"">https://developer.android.com/training/testing/espresso/setup</a></p>
<p>I do remember that a couple of years ago animations were indeed a problem for my espresso tests. But recently I didn't see any errors introduced because of it.</p>
<p>Does somebody have insight why the stability regards animations has improved but why google is still recommends to disable?</p>
",https://stackoverflow.com/questions/64685467/why-does-google-state-that-animations-should-be-disabled-for-ui-testing,"['android', 'testing', 'automated-tests', 'android-espresso']",69,True,2,1
How to drag and drop an external item for Xcode-ui-testing,"<p>In my application I allow the user to drag and drop items from Finder (or any other source of a file based URL) into my application. What I want to do is to add a mechanism that will allow me to test this in the Xcode UI testing.</p>
<p>I can see how to use <code>XCUIElement.press(forDuration:thenDragTo:)</code> to test the drag and drop of a source and destination within the application, but I have been unable to find a way to test when the source of the drag is outside of the application.</p>
<p>In a somewhat related test, I test the copy and paste portion of the application by setting the string I want to paste into <code>NSPasteboard.general</code>, then using <code>XCUIElement.typeKey(&quot;v&quot;, modifierFlags: .command)</code> to paste it into the desired element. That is a little less than ideal as it depends on Command-v actually being implemented as the paste command, but that is unlikely to change so it is acceptable for my needs. (In fact I've written an <code>XCUIElement.paste(_ s: String)</code> extension that makes it easy for me to add this in a test.)</p>
<p>I believe that drag and drop is also using an <code>NSPasteboard</code> for its communications, so with a little investigation into the underlying mechanism, I should be able to set my object into the correct pasteboard just like I do for the cut and paste. I'm reasonably certain I can figure that part out. But I haven't figured out how to perform the actual drop.</p>
<p>My goal would be to create an <code>XCUIElement.drop(_ url)</code> that would setup the proper &quot;public.file-url&quot; object into the correct pasteboard, and then simulate/perform the drop into the element.</p>
<p>Any ideas?</p>
<p>I should note that I have already tried the following two items:</p>
<p>First, I did use the Xcode record feature to attempt to record the drag and drop operation and see what events it would give me. Unfortunately, it records absolutely nothing.</p>
<p>Second, I do have a menu based alternative where the user selects a file via the file selector. So if I could simulate the file selection, that would be a suitable testing alternative for my purposes. Unfortunately, I didn't make any progress along that path either. When I used Xcode to record the events, it recorded the menu selection, nothing that was actually done in the dialog.</p>
",https://stackoverflow.com/questions/62884594/how-to-drag-and-drop-an-external-item-for-xcode-ui-testing,"['swift', 'xcode', 'drag-and-drop', 'xcuitest']",537,True,1,2
Click not working on combo-box down arrow button karate UI testing,"<p>I tried clicking on down arrow button for a Combo Box (Select is not available. Its a React JS application and once I click on arrow button only list shows selection items)  using below karate command but click not happened in application and no error displayed. [The same xpath worked in selenium click command,and showing unique item on Inspect search]</p>

<p>And waitFor(""//div[@id='root']/div/div[3]/main/div/div[3]/div[2]/div"")
And click(""//div[@id='root']/div/div[3]/main/div/div[3]/div[2]/div"")</p>

<p>Note: Then I tried below command<br>
And assert('//div[@id='root']/div/div[3]/main/div/div[3]/div[2]/div').exists</p>

<p>and got error 
javascript evaluation failed: assert('//div[@id='root']/div/div[3]/main/div/div[3]/div[2]/div').exists, :1:19 Expected , but found root
assert('//div[@id='root']/div/div[3]/main/div/div[3]/div[2]/div').exists</p>
",https://stackoverflow.com/questions/60519120/click-not-working-on-combo-box-down-arrow-button-karate-ui-testing,['karate'],1293,True,0,1
Is there a way to show the &quot;clicks&quot; in Android Espresso UI testing?,"<p>We use Firebase Test Lab for our automated end to end testing, its been requested that we show the &quot;clicks&quot; so someone can follow along, being that all animations are disabled during a UI test is it possible to setup Espresso or Firebase to show the clicks as the test runner executes?</p>
",https://stackoverflow.com/questions/64779874/is-there-a-way-to-show-the-clicks-in-android-espresso-ui-testing,"['android-espresso', 'firebase-test-lab']",141,False,1,1
How to access a variable o watch a change in SwiftUI UI testing?,"<p>I'm new at UI testing with SwiftUI and I just wondering:<br>
How can I access a variable or watch for sheet appearance in the process?<br>
E.g. After login, I want to check if it was successful or not and then assert that boolean (which indicates which login was successful or not) or after-login sheet appearance exists.</p>
<p>Code Example:</p>
<pre><code>import XCTest
import SwiftUI
@testable import Formaloo

class when_the_user_types_username_and_password_and_press_login_button: XCTestCase {

  private var app: XCUIApplication!
  
  override func setUp() {
    super.setUp()
    
    self.app = XCUIApplication()
    self.app.launch()
  }
  
  func test_user_should_be_logged_in_with_correct_username_and_password() {
    
    let usernameTextField = app.textFields[&quot;usernameTextField&quot;]
    let passwordTextField = app.secureTextFields[&quot;passwordTextField&quot;]
    let loginButton = app.buttons[&quot;loginButton&quot;]
    
    XCTAssert(usernameTextField.exists)
    XCTAssert(passwordTextField.exists)
    
    usernameTextField.tap()
    usernameTextField.typeText(&quot;*****&quot;)
    
    passwordTextField.tap()
    usernameTextField.typeText(&quot;*****&quot;)
    
    loginButton.tap()
    
    // I don't know how to check the login being successful here!
  }
}
</code></pre>
",https://stackoverflow.com/questions/64641462/how-to-access-a-variable-o-watch-a-change-in-swiftui-ui-testing,"['ios', 'swift', 'swiftui', 'xctest', 'xcode-ui-testing']",300,True,1,1
Unable to adjust the value of datepicker for UI testing: PickerWheel of type 6,"<p>We are writing UI automation for our iOS app using XCTest framework, where we have to select the date using datepicker.
With iOS 13, we were using <a href=""https://developer.apple.com/documentation/xctest/xcuielement/1618672-adjust"" rel=""nofollow noreferrer"">adjust()</a> method to set the value of datepicker.
But with iOS 14, the when we try to set the value for datepicker as below</p>
<pre><code>element.adjust(toPickerWheelValue: &quot;September&quot;)
</code></pre>
<p>I am getting following error</p>
<pre><code>Unsupported picker wheel &quot;2020&quot; PickerWheel of type 6
</code></pre>
<p>Similar question has been posted by someone else at <a href=""https://developer.apple.com/forums/thread/661809"" rel=""nofollow noreferrer"">https://developer.apple.com/forums/thread/661809</a>.</p>
<p>Has anyone encountered this issue?</p>
",https://stackoverflow.com/questions/64473959/unable-to-adjust-the-value-of-datepicker-for-ui-testing-pickerwheel-of-type-6,"['swift', 'ui-automation', 'xctest', 'ios14']",994,True,1,2
Karate-UI: Using a variable in waitFor() to check the element in UI testing,"<p>I am trying to make UI testing by Karate v0.9.5<br>
In my case I use the waitFor() function like this  </p>

<pre><code>* def testName = 'name_' + (int)(Math.random()*100)
And input('input[name=title]', testName)
When click('{button/span}Add')
Then waitFor('{}#(testName)')
</code></pre>

<p>and it detect <code>#(testName)</code> as a string<br>
Is there any way to use a variable in the waitFor() function?</p>
",https://stackoverflow.com/questions/61649259/karate-ui-using-a-variable-in-waitfor-to-check-the-element-in-ui-testing,"['karate', 'ui-testing']",1369,True,1,1
Which framework is better for UI Testing React testing library or python robot framework?,"<p>Can someone please help me with this, Which framework we can use for UI testing i.e React testing library or Python robot framework?
As per my understanding if we are proceeding with multiple data-driven operations python robot framework is better then react testing library.</p>
",https://stackoverflow.com/questions/62126572/which-framework-is-better-for-ui-testing-react-testing-library-or-python-robot-f,"['reactjs', 'testing', 'robotframework']",588,True,-2,1
Getting all the UI elements of the current screen in UI testing or Unit tests,"<p>I am new to iOS and writing a UI test case for a screen. The thing is, I want to write such a test case where I want to test same behavior for a particular type of UIElement (for eg, same behavior for button type). So instead of writing tests for different screens I wanted to know if there's some way in XCUI or any other framework where we can get all UIElements present on the screen in some data structure. 
Thanks</p>
",https://stackoverflow.com/questions/62321195/getting-all-the-ui-elements-of-the-current-screen-in-ui-testing-or-unit-tests,"['ios', 'swift', 'xcode', 'unit-testing', 'xcode-ui-testing']",817,True,2,1
Can someone please provide me a pom.xml file for setting up karate framework for UI testing?,"<p>I'm currently looking into karate-core, but I'm not sure whether I'm on the right path or not.</p>
",https://stackoverflow.com/questions/63745082/can-someone-please-provide-me-a-pom-xml-file-for-setting-up-karate-framework-for,['karate'],385,True,0,1
Unable to select view/ menu item using withId method in UI testing options menu using Espresso,"<p>I am working on an Android Kotlin project. I am adding UI tests written using the Espresso framework into my project. But in my tests, I cannot select the menu item of the options menu within the action bar using withId() method.</p>

<p>Following is how I added the menu into the action bar in the activity.</p>

<pre><code>    override fun onCreateOptionsMenu(menu: Menu?): Boolean {
        menuInflater.inflate(R.menu.event_list, menu)

        return true
    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        when (item.itemId) {
             R.id.action_logout -&gt; {
                 ApplicationController.instance.clearLoginData()
                 finish()
             }
        }

        return super.onOptionsItemSelected(item)
    }
</code></pre>

<p>This is the event_list.xml in the menu resource folder</p>

<pre><code>&lt;?xml version=""1.0"" encoding=""utf-8""?&gt;
&lt;menu xmlns:android=""http://schemas.android.com/apk/res/android""
    xmlns:app=""http://schemas.android.com/apk/res-auto""&gt;
    &lt;item
        android:id=""@+id/action_logout""
        android:icon=""@android:drawable/ic_lock_power_off""
        android:title=""@string/menu_item_logout""
        app:showAsAction=""never""/&gt;
&lt;/menu&gt;
</code></pre>

<p>This is how my test method</p>

<pre><code>@Test
fun itWipesOutLoginDataWhenLogoutMenuItemIsTapped() {
    FakeEventService.SCENARIO_UNDER_TEST = 0
    this.eventListActivityRule.launchActivity(null)
    openActionBarOverflowOrOptionsMenu(ApplicationProvider.getApplicationContext&lt;Context&gt;())

    onView(withId(R.id.action_logout)).perform(click())
}
</code></pre>

<p>As you can see in the test method, I am selecting the menu item by using withId() method. But when I run the test, I am getting the following error.</p>

<pre><code>androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: com.example.memento:id/action_logout
If the target view is not part of the view hierarchy, you may need to use Espresso.onData to load it from one of the following AdapterViews:androidx.appcompat.widget.MenuPopupWindow$MenuDropDownListView{2582e16 VFED.VC.. ........ 0,0-686,168}

View Hierarchy:
+&gt;PopupDecorView{id=-1, visibility=VISIBLE, width=686, height=168, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params={(740,98)(686x168) gr=TOP START CENTER DISPLAY_CLIP_VERTICAL sim={state=unchanged} ty=APPLICATION_SUB_PANEL fmt=TRANSLUCENT surfaceInsets=Rect(112, 112 - 112, 112) (manual)
fl=LAYOUT_NO_LIMITS ALT_FOCUSABLE_IM WATCH_OUTSIDE_TOUCH SPLIT_TOUCH HARDWARE_ACCELERATED FLAG_LAYOUT_ATTACHED_IN_DECOR
pfl=WILL_NOT_REPLACE_ON_RELAUNCH LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME}, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
+-&gt;PopupBackgroundView{id=-1, visibility=VISIBLE, width=686, height=168, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@de56b69, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
+--&gt;MenuDropDownListView{id=-1, visibility=VISIBLE, width=686, height=168, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@4044e8f, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
+---&gt;ListMenuItemView{id=-1, visibility=VISIBLE, width=686, height=168, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.AbsListView$LayoutParams@393b6fa, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+----&gt;AppCompatImageView{id=2131230882, res-name=group_divider, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@70144ab, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
+----&gt;LinearLayout{id=2131230818, res-name=content, visibility=VISIBLE, width=686, height=168, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@d648c6, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+-----&gt;RelativeLayout{id=-1, visibility=VISIBLE, width=574, height=76, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@4a503dd, tag=null, root-is-layout-requested=false, has-input-connection=false, x=56.0, y=46.0, child-count=2}
</code></pre>

<p>What is wrong with my code and how can I fix it?</p>
",https://stackoverflow.com/questions/61036163/unable-to-select-view-menu-item-using-withid-method-in-ui-testing-options-menu,"['android', 'kotlin', 'integration-testing', 'android-espresso']",785,True,0,3
Karate - UI Testing - When using Zalenium Safari and MSEDGE immediately error on driver/session call =&gt; no capabilities found,"<p>git project: <a href=""https://github.com/jbart18/karate_testing"" rel=""nofollow noreferrer"">https://github.com/jbart18/karate_testing</a></p>
<p>I'm trying to simplify having the main browsers (Chrome, Firefox, Edge &amp; Safari) working via Zalenium. It seems the most simple approach and have been able to get chrome and firefox (gecko driver) running/working straight away.</p>
<p>The problem lies within Edge and Safari and the inability to submit capabilities in the session request.</p>
<p>I am running on Windows 10 professional and have been able to get tests working for:
edge: through specifying the executable path and setting the webdriver session
safari: running macos via VM and then specifying the executable path (a big hassle - though I will need to either debug safari issues or when needing xcode for mobile testing)</p>
<p>I am hoping to simplify e2e testing using zalenium. Please help.
I followed &quot;https://opensource.zalando.com/zalenium/#try-it&quot; to get zalenium up and running</p>
<p>request:
* configure driver = { type: 'safaridriver', start: false, webDriverUrl: 'http://localhost:4444/wd/hub'}</p>
<p>Error:
&quot;error&quot;: &quot;unknown error&quot;,
&quot;message&quot;: &quot;Error forwarding the new session cannot find : Capabilities {browserName: safari}&quot;,</p>
<p>However when I change the driver configuration statement&quot;</p>
<pre><code>* def session = { capabilities: { browserName: &quot;safari&quot; } }
* configure driver = { type: 'safaridriver', webDriverSession: '#(session)', start: false, showDriverLog: true, webDriverUrl: 'http://localhost:4444/wd/hub'}
</code></pre>
<p>Error:</p>
<h2>HTTP ERROR 500</h2>
<p>Problem accessing /wd/hub/session. Reason:
<pre>    Server Error</pre></p><h3>Caused by:</h3>java.io.IOException: org.openqa.grid.common.exception.GridException: No capabilities found in request: {&quot;capabilities&quot;:{&quot;browserName&quot;:&quot;safari&quot;}}
<p>I am unable to get either edge or safari via zalenium up and running.
Your help is greatly appreciated.</p>
<p>Thanks</p>
<p>jbart18</p>
",https://stackoverflow.com/questions/64680998/karate-ui-testing-when-using-zalenium-safari-and-msedge-immediately-error-on,"['karate', 'saucelabs']",853,True,1,2
How to Access Activity from ActivityScenarioRule,"<p>I am using <code>ActivityScenarioRule</code> for Espresso UI Testing and I wanted to get access to the method <code>getStringArray()</code>, calling which requires the <code>Activity</code> . So, is there any way to retrieve the <code>Activity</code> by the <code>ActivityScenarioRule</code> , maybe something similar to <code>getActivity</code> in <code>ActivityTestRule</code>.</p>

<pre><code>@Rule
    public ActivityScenarioRule activityScenarioRule = new ActivityScenarioRule&lt;&gt;(MainActivity.class);
</code></pre>

<p>I am not using <code>ActivityTestRule</code>, because it is deprecated! </p>
",https://stackoverflow.com/questions/61953249/how-to-access-activity-from-activityscenariorule,"['java', 'android', 'android-espresso']",12334,True,16,4
What are the tools for generating the Test report for iOS Swift?,"<p>I am doing the Unit Testing And UI Testing for My App. Now I want to know the entire Test case report with Success and failure like ExtentReport Tool [1]: <a href=""https://extentreports.com/"" rel=""nofollow noreferrer"">https://extentreports.com/</a></p>
",https://stackoverflow.com/questions/62368922/what-are-the-tools-for-generating-the-test-report-for-ios-swift,"['ios', 'unit-testing', 'user-interface', 'testing']",193,False,1,0
how to read data from pdf file using swift xcuitest,"<p>I want to do UI testing on PDF using swift xcuitest for that I need to access data from PDF. Please suggest is there any way to read data from PDF.</p>
",https://stackoverflow.com/questions/61863756/how-to-read-data-from-pdf-file-using-swift-xcuitest,"['swift4', 'xcode-ui-testing', 'xcuitest']",233,False,-1,1
Change default path to chrome execution in karate-chrome to use chromium,"<p>I am using the Karate framework to do UI testing.
But the PATH /usr/bin/chromium-browser is not take in account.</p>
<p>How we can change the default location of the chrome executable to use chromium?</p>
",https://stackoverflow.com/questions/65406720/change-default-path-to-chrome-execution-in-karate-chrome-to-use-chromium,"['google-chrome', 'chromium', 'karate']",46,False,1,0
TypeError: &#39;module&#39; object is not callable error in robot framework,"<p>I am not importing any classes. I am trying to initiate the test case for UI testing using Robot framework. Please find the below code.Can someone help me on this.</p>

<pre><code>    *** Settings ***
Library    SeleniumLibrary
*** Test Cases ***
LoginTest
    create webdriver    chrome  executable_path=""driver path""
    open browser    ""https://innovate.dev-ais.corecompete.com/dashboard""    chrome
    click button    xpath=//span[text()='Sign In']//parent::button
</code></pre>

<p>I am receiving below error message.</p>

<pre><code>    LoginTest                                                             | FAIL |
TypeError: 'module' object is not callable
------------------------------------------------------------------------------
TC001                                                                 | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
</code></pre>
",https://stackoverflow.com/questions/62319103/typeerror-module-object-is-not-callable-error-in-robot-framework,"['testing', 'robotframework']",3411,True,1,2
XCTest UI Testing - How to lock the screen?,"<p>Related to <a href=""https://stackoverflow.com/questions/41951539/xctest-ui-testing-how-to-close-and-open-an-app-without-relaunch"">XCTest UI Testing - How to close and open an app without relaunch?</a> is there any way to lock the screen from a UI test? <code>XCUIDevice.Button</code> only has three cases, home, volume up and volume down.</p>
",https://stackoverflow.com/questions/64902932/xctest-ui-testing-how-to-lock-the-screen,"['xctest', 'xcode-ui-testing']",232,True,0,1
Karate-UI: Using a variable in waitFor() to check the element in UI testing,"<p>I am trying to make UI testing by Karate v0.9.5<br>
In my case I use the waitFor() function like this  </p>

<pre><code>* def testName = 'name_' + (int)(Math.random()*100)
And input('input[name=title]', testName)
When click('{button/span}Add')
Then waitFor('{}#(testName)')
</code></pre>

<p>and it detect <code>#(testName)</code> as a string<br>
Is there any way to use a variable in the waitFor() function?</p>
",https://stackoverflow.com/questions/61649259/karate-ui-using-a-variable-in-waitfor-to-check-the-element-in-ui-testing,"['karate', 'ui-testing']",1369,True,1,1
SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 85,"<p>Currently i am working protractor UI testing. My testcase is working properly so far, but suddenly it shows a webdriver problem. My current chrome version is 84. But the selenium driver is expecting version 85. Version 85 is still not released.</p>
<pre><code>[14:56:46] E/launcher - session not created: This version of ChromeDriver only supports Chrome version 85
  (Driver info: chromedriver=85.0.4183.38 (9047dbc2c693f044042bbec5c91401c708c7c26a-refs/branch-heads/4183@{#779}),platform=Windows NT 10.0.17134 x86_64)
[14:56:46] E/launcher - SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 85
  (Driver info: chromedriver=85.0.4183.38 (9047dbc2c693f044042bbec5c91401c708c7c26a-refs/branch-heads/4183@{#779}),platform=Windows NT 10.0.17134 x86_64)
</code></pre>
",https://stackoverflow.com/questions/63070825/sessionnotcreatedexception-message-session-not-created-this-version-of-chrome,"['protractor', 'protractor-net']",1320,True,1,3
I am facing an issue with Jenkins.I selected Execute windows batch command in Jenkins and getting below error,"<p>I am using robot framework for UI testing and i created one .bat file and i am passing that into Jenkins. When i build the project i am getting below error.</p>
<p><a href=""https://i.stack.imgur.com/DMD8u.png"" rel=""nofollow noreferrer"">Windows image for batch job command</a></p>
<p><a href=""https://i.stack.imgur.com/kKcTK.png"" rel=""nofollow noreferrer"">Jenkins output error message</a></p>
<p><a href=""https://i.stack.imgur.com/3REhe.png"" rel=""nofollow noreferrer"">Execute shell error</a></p>
",https://stackoverflow.com/questions/63374057/i-am-facing-an-issue-with-jenkins-i-selected-execute-windows-batch-command-in-je,"['batch-file', 'jenkins']",145,True,-1,1
How to deploy selenium test suite in AWS lambda,"<p>I have a test suite for UI testing. The same suite I can run on my local machine and it working fine, but I want to deploy the same suite into AWS Lambda.
I tried it but AWS lambda filed to lunch Chrome for testing. </p>
",https://stackoverflow.com/questions/59729165/how-to-deploy-selenium-test-suite-in-aws-lambda,"['selenium', 'selenium-webdriver', 'automation', 'aws-lambda', 'ui-testing']",134,True,0,1
Which framework is better for UI Testing React testing library or python robot framework?,"<p>Can someone please help me with this, Which framework we can use for UI testing i.e React testing library or Python robot framework?
As per my understanding if we are proceeding with multiple data-driven operations python robot framework is better then react testing library.</p>
",https://stackoverflow.com/questions/62126572/which-framework-is-better-for-ui-testing-react-testing-library-or-python-robot-f,"['reactjs', 'testing', 'robotframework']",588,True,-2,1
Karate UI - how to assert the url at the end of the test?,"<p>I'm trying Karate UI testing tool. 
I thought that command ""waitForUrl"" should fail the test if the url doesn't match. But my test is green even if the url doesn't match. Do I have to use two commands (""waitForUrl"" and ""match"") for failing the test?  </p>

<p>My feature file:</p>

<pre><code>Feature: web-browser automation

Background:
* configure driver = { type: 'chrome' }

Scenario: Search for Karate on Google

  Given driver 'https://www.google.com'
  And maximize()
  And delay(2000)
  And input(""input[name=q]"", 'Karate')
  And click(""input[name=btnK]"")
  When click(""/(//div//a/h3)[1]"")
  Then retry(5, 2000).waitForUrl('https://github.com/intuit/karate')
</code></pre>

<p><a href=""https://i.stack.imgur.com/4UxPV.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/4UxPV.png"" alt=""enter image description here""></a></p>
",https://stackoverflow.com/questions/61528804/karate-ui-how-to-assert-the-url-at-the-end-of-the-test,['karate'],957,True,2,1
Assert web element in Pytest,"<p>How to assert web Element in pytest? I haven't used Pytest for UI testing before and can not figure out what library I should import. I am creating a new item and just want to verify if that item was created it should be equal to string.</p>
<pre><code>item = driver.find_element_by_css_selector(':nth-child(7) &gt; ._3XkHf &gt; ._3-t-g')

assert item.???? == '1000'
</code></pre>
",https://stackoverflow.com/questions/62817300/assert-web-element-in-pytest,"['python', 'pytest']",233,True,0,1
WinAppDriver does not detect controls/component in LabVIEW executable,"<p>I am using WinAppDriver to automate my LabVIEW app UI testing. Inspect.exe can detect top level of active window but couldn't locate element inside the window.
So I couldn't get the text inside the window. Does anyone know how I could get the text?</p>
<p>Thanks!
Mary</p>
",https://stackoverflow.com/questions/62898051/winappdriver-does-not-detect-controls-component-in-labview-executable,"['windows', 'element', 'labview', 'winappdriver', 'inspect.exe']",210,False,0,1
Is there anyway to add a iOS UI (XCUI) testing pipeline without using AppCenter?,"<p>I am configuring CI/CD pipelines for my project and I have written my UI tests using XCUI framework. I referred Azure documentation for configuring them and I found out to use UI testing we need a AppCenter account.</p>
<p>Is there any way to configure a pipeline without using AppCenter account?</p>
",https://stackoverflow.com/questions/65323337/is-there-anyway-to-add-a-ios-ui-xcui-testing-pipeline-without-using-appcenter,"['ios', 'azure-devops', 'continuous-integration', 'devops', 'visual-studio-app-center']",84,True,0,1
"How to do automated testing of VoiceOver gestures, such as “Perform Escape”?","<p>I have implemented a custom response to the “Perform Escape” (two-finger Z) VoiceOver gesture for a modal view (via the <code>accessibilityPerformEscape() -&gt; Bool</code> method in my <code>UIViewController</code> subclass). I’ve manually tested it on an iPhone device and it works as expected.</p>

<p>What I want to do now is add a test to my UI Tests suite to ensure that the behaviour continues to work, as changes are made to the project. (I.E., the whole point of UI testing.)</p>

<p>I have not been able to find any reference to automated testing of VoiceOver gestures for iOS UI testing (<code>XCTest</code>, et. al.).</p>

<p>So: How can I automate testing of VoiceOver gestures?</p>

<p>Since it seems that this is not supported in the Simulator, am I going to have to always connect an iOS device to my development computer (and eventually CI server, when I set that up) in order to run VoiceOver UI tests?</p>
",https://stackoverflow.com/questions/59674879/how-to-do-automated-testing-of-voiceover-gestures-such-as-perform-escape,"['swift', 'xcode-ui-testing', 'voiceover', 'uiaccessibility']",1292,True,0,1
How to access a variable o watch a change in SwiftUI UI testing?,"<p>I'm new at UI testing with SwiftUI and I just wondering:<br>
How can I access a variable or watch for sheet appearance in the process?<br>
E.g. After login, I want to check if it was successful or not and then assert that boolean (which indicates which login was successful or not) or after-login sheet appearance exists.</p>
<p>Code Example:</p>
<pre><code>import XCTest
import SwiftUI
@testable import Formaloo

class when_the_user_types_username_and_password_and_press_login_button: XCTestCase {

  private var app: XCUIApplication!
  
  override func setUp() {
    super.setUp()
    
    self.app = XCUIApplication()
    self.app.launch()
  }
  
  func test_user_should_be_logged_in_with_correct_username_and_password() {
    
    let usernameTextField = app.textFields[&quot;usernameTextField&quot;]
    let passwordTextField = app.secureTextFields[&quot;passwordTextField&quot;]
    let loginButton = app.buttons[&quot;loginButton&quot;]
    
    XCTAssert(usernameTextField.exists)
    XCTAssert(passwordTextField.exists)
    
    usernameTextField.tap()
    usernameTextField.typeText(&quot;*****&quot;)
    
    passwordTextField.tap()
    usernameTextField.typeText(&quot;*****&quot;)
    
    loginButton.tap()
    
    // I don't know how to check the login being successful here!
  }
}
</code></pre>
",https://stackoverflow.com/questions/64641462/how-to-access-a-variable-o-watch-a-change-in-swiftui-ui-testing,"['ios', 'swift', 'swiftui', 'xctest', 'xcode-ui-testing']",300,True,1,1
"Azure APIM: When developing under self-hosting, can the site be started not under editing mode?","<p>We are developing widgets under the Azure API Management self-hosting model. Currently when we start the site on our local machine with <code>""npm start""</code> it will start under admin mode for content editing. Is there a way to start the site locally not in editing mode? The goal is to help speed up our development of UI testing framework. </p>
",https://stackoverflow.com/questions/61901378/azure-apim-when-developing-under-self-hosting-can-the-site-be-started-not-unde,"['azure', 'azure-api-management']",25,False,0,0
How to UI test a Custom Layout in a library module that doesn&#39;t have any Activities or Fragments?,"<p>I'd line to UI test a Custom Layout in a library module that doesn't have any Activities or Fragments. Is that even possible? All the information I can find about UI testing with Espresso needs an ActivityScenario or Fragment scenario, which I don't have in this case.</p>
<p>Here's the code of my Custom layout class, if that helps</p>
<pre><code>
class BuffView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
    : LinearLayout(context, attrs, defStyleAttr) {

    private val buffView: LinearLayout = inflate(context, R.layout.buff_view, this) as LinearLayout

    private var errorListener: ErrorListener? = null

    private val apiErrorHandler = ApiErrorHandler()
    private val getBuffUseCase = GetBuffUseCase(apiErrorHandler)
    /**
     * Handler for the time intervals between requests
     */
    private val intervalsHandler = Handler()

    private var countDownTimer: CountDownTimer? = null

    private var buffIdCount = 1
    /**
     * Indicates whether the API request should be made or not
     */
    private var getBuffs = false

    fun init() {
        getBuffs = true
        getBuff()
    }

    private fun getBuff() {
        if (!getBuffs) return
        getBuffUseCase.invoke(Params(buffIdCount.toLong()), object : UseCaseResponse&lt;Buff&gt; {
            override fun onSuccess(result: Buff) {
                if (isDataValid(result)) displayBuff(result) else hideBuffView()
            }

            override fun onError(errorModel: ErrorModel?) {
                errorListener?.onError(
                    errorModel?.message ?: context.getString(R.string.generic_error_message)
                )
                hideBuffView()
            }
        })

        if (buffIdCount &lt; NUM_BUFFS_TO_BE_FETCHED ) {
            intervalsHandler.postDelayed({
                buffIdCount++
                getBuff()
                stopCountDownTimer()
            }, REQUEST_BUFF_INTERVAL_TIME)
        }
    }

    private fun isDataValid(buff: Buff): Boolean {
        if (buff.author.firstName.isNullOrEmpty() &amp;&amp; buff.author.lastName.isNullOrEmpty()) {
            showErrorInvalidData(context.getString(R.string.author_reason_error_message))
            return false
        }

        if (buff.question == null || buff.question.title.isNullOrEmpty()) {
            showErrorInvalidData(context.getString(R.string.question_reason_error_message))
            return false
        }

        if (buff.timeToShow == null || buff.timeToShow &lt; 0) {
            showErrorInvalidData(context.getString(R.string.timer_reason_error_message))
            return false
        }

        if (buff.answers == null || buff.answers.size &lt; 2) {
            showErrorInvalidData(context.getString(R.string.answers_reason_error_message))
            return false
        }
        return true
    }

    private fun showErrorInvalidData(reason: String) {
        errorListener?.onError(context.getString(R.string.data_incomplete_error_message, reason))
    }

    private fun displayBuff(buff: Buff) {
        setBuffQuestion(buff.question!!.title!!)
        setBuffAuthor(buff.author)
        setBuffAnswers(buff.answers!!)
        setBuffProgressBar(buff.timeToShow!!)
        setBuffCloseButton()
        invalidate()
        showBuffView()
    }

    private fun setBuffQuestion(question: String) {
        questionText.text = question
    }

    private fun setBuffAuthor(author: Buff.Author) {
        val firstName = author.firstName ?: &quot;&quot;
        val lastName = author.lastName ?: &quot;&quot;
        val fullName = &quot;$firstName $lastName&quot;
        authorName.text = fullName

        author.image?.let { authorImageUrl -&gt;
            Glide.with(context)
                .load(authorImageUrl)
                .into(authorImage)
        }
    }

    /**
     * Adds a new answerView for each element in answers
     * */
    private fun setBuffAnswers(answers: List&lt;Buff.Answer&gt;) {
        val answersContainer = findViewById&lt;LinearLayout&gt;(R.id.answersContainer)
        answersContainer.removeAllViews()
        for(answer in answers) {
            val answerView: View = LayoutInflater.from(answersContainer.context).inflate(
                R.layout.buff_answer,
                answersContainer,
                false
            )

            answer.answerImage?.x0?.url?.let {
                Glide.with(context)
                    .load(it)
                    .into(answerView.answerImage)
            }

            answerView.setOnClickListener {
                answerView.background = ContextCompat.getDrawable(
                    context,
                    R.drawable.answer_selected_bg
                )
                answerView.answerText.setTextColor(
                    ContextCompat.getColor(
                        context,
                        android.R.color.white
                    )
                )
                //freeze timer on answer selected
                stopCountDownTimer()

                //hide buff_content view 2 seconds after an answer has been selected
                it.postDelayed({
                    hideBuffView()
                }, HIDE_BUFF_AFTER_SELECTED_ANSWER_DURATION)
            }

            answerView.answerText?.text = answer.title
            answersContainer.addView(answerView)
        }
    }

    private fun setBuffProgressBar(timeToShow: Int) {
        questionTimeProgress.max = timeToShow
        countDownTimer = object : CountDownTimer(
            timeToShow * ONE_SECOND_INTERVAL,
            ONE_SECOND_INTERVAL
        ) {
            override fun onTick(millisUntilFinished: Long) {
                questionTimeText.text = (millisUntilFinished / ONE_SECOND_INTERVAL).toString()
                questionTimeProgress.progress = timeToShow - (millisUntilFinished / ONE_SECOND_INTERVAL).toInt()
            }

            override fun onFinish() {
                hideBuffView()
            }
        }.start()
    }

    private fun showBuffView() {
        buffView.visibility = VISIBLE
        val entryAnimation = AnimationUtils.loadAnimation(context, R.anim.entry_anim)
        buffView.startAnimation(entryAnimation)
    }

    private fun hideBuffView() {
        buffView.visibility = GONE
        val exitAnimation = AnimationUtils.loadAnimation(context, R.anim.exit_anim)
        buffView.startAnimation(exitAnimation)
    }

    private fun setBuffCloseButton() {
        buffCloseImageButton.setOnClickListener {
            hideBuffView()
            stopCountDownTimer()
        }
    }

    private fun stopCountDownTimer() {
        countDownTimer?.cancel()
    }

    fun addErrorListener(errorListener: ErrorListener) {
        this.errorListener = errorListener
    }
}
</code></pre>
",https://stackoverflow.com/questions/64185039/how-to-ui-test-a-custom-layout-in-a-library-module-that-doesnt-have-any-activit,"['android', 'kotlin', 'testing', 'junit', 'android-espresso']",47,True,0,1
How to make UI Automator wait until TextView&#39;s text value changes,"<p>I am currently doing some cross-app functional UI testing. </p>

<p>There is a TextView that exists and that I must test for its text value. I must thus find a way to wait for the TextView's text value to change. </p>

<p>Here is my usecase : </p>

<pre class=""lang-java prettyprint-override""><code>final UiSelector contextualInformation = new UiSelector().resourceId(resourceId);
final UiObject contextualInformationUiObject = mDevice.findObject(contextualInformation);

// I would like to find something to fulfill this statement
Boolean conditionWasMet = contextualInformationUiObject.wait(Until./*a search condition for text to contain given substring*/, timeout);

assertThat(conditionWasMet, is(notNullValue()));
assertThat(conditionWasMet, is(true));
assertThat(contextualInformationUiObject.exists(), is(true));
assertThat(contextualInformationUiObject.getText(), containsString(/*given substring*/));
</code></pre>

<p>I am well aware of the existence of <code>Until.textContains(/*substring*/)</code> but I do not know how to apply it to/with <code>contextualInformation</code> or <code>contextualInformationUiObject</code> here. </p>
",https://stackoverflow.com/questions/60170667/how-to-make-ui-automator-wait-until-textviews-text-value-changes,"['android', 'android-uiautomator']",2022,True,1,3
Invalid selenium element selector in angularjs page using c#,"<p>I spun up my app locally on port &quot;x&quot; and trying to start my UI testing using selenium. First test case is logging in as an administrator onto the page. The front-end of the app is using Angularjs. I'm trying to target the input field username but I keep running into errors of &quot;Invalid element sector&quot;.</p>
<p>I have also tried below but it didn't work either:</p>
<pre><code>IWebElement username = driver.FindElement(By.CssSelector(&quot;[ng-model='vm.username']&quot;));
</code></pre>
<p><a href=""https://i.stack.imgur.com/Z6vPy.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/Z6vPy.png"" alt=""input field tag of username"" /></a></p>
<p><a href=""https://i.stack.imgur.com/oHASa.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/oHASa.png"" alt=""c# code"" /></a></p>
",https://stackoverflow.com/questions/64758041/invalid-selenium-element-selector-in-angularjs-page-using-c,"['c#', 'selenium', 'xpath', 'css-selectors', 'webdriverwait']",25,False,-1,1
Gradle DSL method not found: &#39;androidTestImplementation()&#39;,"<p>I'm trying to use uiautomator so looked the tutorial here <a href=""https://developer.android.com/training/testing/ui-testing/uiautomator-testing#java"" rel=""nofollow noreferrer"">https://developer.android.com/training/testing/ui-testing/uiautomator-testing#java</a></p>
<p>In the tutorial, it says:</p>
<blockquote>
<p>In the build.gradle file of your Android app module, you must set a dependency reference to the UI Automator library:</p>
</blockquote>
<pre><code>dependencies {
    ...
    androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
}
</code></pre>
<p>So I added that line, so my build.gradle files is like this:</p>
<pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = &quot;1.3.72&quot;
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath &quot;com.android.tools.build:gradle:4.0.2&quot;
        classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version&quot;

//        androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
//        androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
        androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
//        androidTestImplementation('androidx.test.uiautomator:uiautomator:2.2.0')

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
</code></pre>
<p>And I tried to run the app. But I got an error:</p>
<pre><code>Gradle DSL method not found: 'androidTestImplementation()'
Possible causes:
The project 'My Application' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 4.0.2 and sync project

The project 'My Application' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file

The build file may be missing a Gradle plugin.
Apply Gradle plugin
</code></pre>
",https://stackoverflow.com/questions/64328543/gradle-dsl-method-not-found-androidtestimplementation,"['android', 'android-studio', 'android-gradle-plugin', 'android-testing']",446,True,3,2
Running integration testing for Flutter on Azure Devops pipeline for UI automation testing,"<p>I would like to run automated UI testing using flutter driver on Azure Devops Pipelines and I'm using <a href=""https://github.com/aloisdeniel/vsts-flutter-tasks%20%20https://marketplace.visualstudio.com/items?itemName=aloisdeniel.flutter"" rel=""nofollow noreferrer"">Flutter Tasks by Alois Daniel</a>. There is no flutter driver support currenly on the azure flutter tasks plugin. We are looking for tasks where it would start up the simulators for Android and iOS while running flutter driver tests. We are running a vm-image for macos-latest in azure devops pipeline yml file.</p>
",https://stackoverflow.com/questions/65006575/running-integration-testing-for-flutter-on-azure-devops-pipeline-for-ui-automati,"['azure-devops', 'azure-pipelines', 'flutter-test']",1502,True,3,2
How to create same runing containers with out --scale in docker,"<p>Hy!</p>
<p>I use testproject to ui testing but, when i want to create a docker agent with a compose file, i always recreate my first agent. I renamed it, but it doesn't help. My goal is to create a few same running container to run my test in paralell.
Thanks for help
I used the headless compose file with out job param and job id lines –
hub.docker.com/r/testproject/agent</p>
",https://stackoverflow.com/questions/64260204/how-to-create-same-runing-containers-with-out-scale-in-docker,"['docker', 'docker-compose', 'docker-container', 'test-project']",22,False,0,0
Chrome extension: enter value in text field via UI instead of javascript?,"<p>The input field I am trying to utilize does not respond to changes to only it's value so I'm wondering if there's some API similar to selenium that will allow me to perform UI testing-like actions so I can enter in the value via clicking, entering keys rather than via javascript? Basically, is it possible to input a value into a search box WITHOUT javascript within a chrome extension?</p>
",https://stackoverflow.com/questions/61055870/chrome-extension-enter-value-in-text-field-via-ui-instead-of-javascript,['google-chrome-extension'],55,False,0,0
Can we use Robot framework with cucumber framework java?,"<p>I am completely new to testing framework. In my team we are using cucumber framework(Java) with selenium for UI testing.</p>
<p>Here someone from other team suggested we can use Robot framework(based on selenium) as well.</p>
<p><strong>So my question is, can we integrate Robot framework with Cucumber.</strong></p>
<p>If So could you please provide me link as well where there is example to use robot and cucumber fw integrated way.</p>
",https://stackoverflow.com/questions/63354426/can-we-use-robot-framework-with-cucumber-framework-java,"['selenium', 'robotframework', 'cucumber-jvm', 'cucumber-java']",759,False,0,0
Testing python project with nosetest and pytest together,"<p>I've got a project with quite a bit set of UT written with nosetest. I'd like to add the UI testing using Selenium and Pytest. Is it possible to use these two frameworks together? Can I just add the other test folder and run one test suit using nosetest and the other one using pytest? I would rather not to touch existing UT tests for now. Could you point me in a right direction?</p>
",https://stackoverflow.com/questions/59612792/testing-python-project-with-nosetest-and-pytest-together,"['pytest', 'nose']",327,False,1,0
Android studio &quot;run&quot; not showing up,"<p>I tried to run test following this tutorial: <a href=""https://developer.android.com/training/testing/ui-testing/uiautomator-testing#java"" rel=""nofollow noreferrer"">https://developer.android.com/training/testing/ui-testing/uiautomator-testing#java</a></p>
<p>As default, there was one test file:</p>
<p><code>MyApplication2\app\src\androidTest\java\com\example\myapplication\ExampleInstrumentedTest.kt</code></p>
<p>In the file, I can see &quot;run&quot; button when I click right mouse.</p>
<p><a href=""https://i.stack.imgur.com/YZBan.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/YZBan.png"" alt=""enter image description here"" /></a></p>
<p>However, test file I created for the uiautomater tutorial, &quot;ChangeTextBehaviorTest.java&quot;, on the file when I click right mouse, there is no &quot;Run&quot; button. So I cannnot run the test ...</p>
<p><code>MyApplication2\app\src\androidTest\java\com\example\myapplication\ChangeTextBehaviorTest.java</code></p>
<p><a href=""https://i.stack.imgur.com/07fAq.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/07fAq.png"" alt=""enter image description here"" /></a></p>
<p>How can I solve this issue? Thanks for you help.</p>
",https://stackoverflow.com/questions/64366398/android-studio-run-not-showing-up,"['android', 'android-studio']",563,True,2,2
Jmeter WebDriver Sampler run in browser without incognito mode,"<p>I have webdriver script for WEB UI testing but Response time getting from WebDriver Sampler is more than real browser by manually.
I ran the script in headless mode and still getting high response time.</p>

<p>I want to ask if there is any way to Open chrome in normal window without incognito mode, Because incognito mode already load fresh page along with css/images/styles, it does not use cached loaded images/css/styles.</p>

<p>Thanks in Advance</p>
",https://stackoverflow.com/questions/61867988/jmeter-webdriver-sampler-run-in-browser-without-incognito-mode,"['jmeter', 'webdriver']",346,True,0,1
Exception while computing database live data,"<p>I was wondering why I receive the error:</p>
<blockquote>
<p>&quot;java.lang.RuntimeException: exception while computing database live data.&quot;</p>
</blockquote>
<p>I usually get this when running this in an androidTest:</p>
<pre><code>@RunWith(AndroidJUnit4::class)
class ViewModelTest {
   @get:Rule
   var instantExecutorRule = InstantTaskExecutorRule()

   @Test
   @Throws(Exception::class)
   fun tester() = runBlocking {
      ActivityScenario.launch(LoginActivity::class.java)
      Thread.sleep(2000)
   }
}
</code></pre>
<p>Could someone explain why I'm getting this error? I realize that I'm not using any live data at the moment, but was wondering why I'm getting this error in the first place.</p>
<p>I've used livedata on unit tests and I don't seem to receive this error. Only when I try launching an activity/scenario or do UI testing.</p>
",https://stackoverflow.com/questions/62580983/exception-while-computing-database-live-data,"['android', 'android-room', 'android-espresso', 'android-livedata', 'ui-testing']",488,False,0,1
VS AppCenter - XCUI - Getting Failed to analyze MachO file error,"<p>I am creating an azure Devops pipeline for UI testing my iOS application.</p>
<p>I have built my project and feeding my ipa to Visual Studio AppCenter Test pipeline, I was getting the error,</p>
<pre><code>Error: Failed to analyze MachO file: Unknown load command: 2147483700
</code></pre>
<p>I tried to run my code manually using appcenter-cli from terminal and still getting the same error. I saw this <a href=""https://github.com/microsoft/appcenter-cli/issues/1165"" rel=""nofollow noreferrer"">issue</a> in GitHub and not sure how to do this workaround in devops pipeline.</p>
<p>Am I missing something here? Can no-one use AppCenter CLI because of this issue?</p>
",https://stackoverflow.com/questions/65355649/vs-appcenter-xcui-getting-failed-to-analyze-macho-file-error,"['visual-studio-app-center', 'xcuitest']",78,True,0,1
How to automatically login using EasyRepro in Dynamics 365 on-premise,"<p>I'm trying to do Automated UI Testing using EasyRepro in Dynamics 365 On-Premise. I managed to the testing with one issue, I can't automatically login to my Dynamics 365 Organization. Below are the code that I used:</p>

<pre><code>var client = new WebClient(TestSettings.Options);
            using (var xrmApp = new XrmApp(client))
            {
              xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);
              xrmApp.Navigation.OpenSubArea(""My Work"", ""Companies"");
              xrmApp.CommandBar.ClickCommand(""New"");
              xrmApp.Entity.SetValue(""name"", TestSettings.GetRandomString(5,15));
              xrmApp.Entity.Save();
             }
</code></pre>

<p>When I run it, the newly open chrome page will still ask me to put my credential, after I enter my credential (the CRM username/password), the script will run smoothly.</p>

<p>Since, I plan to use this as part of our automated testing. Is there any way for the EasyRepro to automatically login?</p>
",https://stackoverflow.com/questions/60056050/how-to-automatically-login-using-easyrepro-in-dynamics-365-on-premise,"['automated-tests', 'dynamics-crm', 'devops', 'dynamics-365', 'easyrepro']",1808,True,4,2
Is it possible to get an `XCUIElement` by its `accessibilityId` when it is not an accessibility element?,"<p>I have custom <code>UITableViewCell</code> with some child images and labels. I have made the entire cell as a single accessible element. I have set accessibility ids to all the elements - cell and its subviews, hoping to be able to use it in the <code>XCUITest</code>s.</p>
<p>Now, I am not able to get the image, say, using <code>XCUIApplication().images[&quot;cell_image_acc_id&quot;]</code>.</p>
<p>What should I do to get these elements? I am a newbie at XC ui testing. Please let me know if there is something basic that I am missing.</p>
<p>Thanks in advance.</p>
",https://stackoverflow.com/questions/63511569/is-it-possible-to-get-an-xcuielement-by-its-accessibilityid-when-it-is-not-a,"['ios', 'swift', 'accessibility', 'xcuitest']",187,True,0,1
checking sorting button using Cypress in Saucedemo.com,"<p>I was practicing UI Testing using Cypress in website <a href=""https://www.saucedemo.com/index.html"" rel=""nofollow noreferrer"">saucedemo.com</a> which is demo e-commerce website. I tried to test the sorting selection button. it works just fine for the standard_user account but for the problem_user account, the sorting won't work in any cases(There'are a-z sorting, z-a sorting, Price low to high sorting and price high to low sorting) but my code passes for those two cases so i was wondering if i code it correctly? and this is my code </p>

<pre><code>Cypress.Commands.add(""checkAtoZsorting"", () =&gt;{
    cy.get('[ class=""product_sort_container""]')
        .select('az')
        .should(""have.value"",""az"")
        cy.get('[class=""inventory_item_name""]').should(($item1) =&gt; {
            expect($item1).to.have.length(6)
        });
        cy.get('[class=""inventory_item_name""]').eq(0).should(""have.text"",""Sauce Labs Backpack"");
        cy.get('[class=""inventory_item_name""]').eq(1).should(""have.text"",""Sauce Labs Bike Light"");
        cy.get('[class=""inventory_item_name""]').eq(2).should(""have.text"",""Sauce Labs Bolt T-Shirt"");
        cy.get('[class=""inventory_item_name""]').eq(3).should(""have.text"",""Sauce Labs Fleece Jacket"");
        cy.get('[class=""inventory_item_name""]').eq(4).should(""have.text"",""Sauce Labs Onesie"");
        cy.get('[class=""inventory_item_name""]').eq(5).should(""have.text"",""Test.allTheThings() T-Shirt (Red)"");
});
 Cypress.Commands.add(""checkZtoAsorting"", () =&gt;{
cy.get('[ class=""product_sort_container""]')
    .select('za')
    .should(""have.value"",""za"")
    cy.get('[class=""inventory_item_name""]').should(($item1) =&gt; {
        expect($item1).to.have.length(6) 
    });
    cy.get('[class=""inventory_item_name""]').eq(0).should(""have.text"",""Test.allTheThings() T-Shirt (Red)"");
    cy.get('[class=""inventory_item_name""]').eq(1).should(""have.text"",""Sauce Labs Onesie"");
    cy.get('[class=""inventory_item_name""]').eq(2).should(""have.text"",""Sauce Labs Fleece Jacket"");
    cy.get('[class=""inventory_item_name""]').eq(3).should(""have.text"",""Sauce Labs Bolt T-Shirt"");
    cy.get('[class=""inventory_item_name""]').eq(4).should(""have.text"",""Sauce Labs Bike Light"");
    cy.get('[class=""inventory_item_name""]').eq(5).should(""have.text"",""Sauce Labs Backpack"");
</code></pre>

<p>Really need help ....</p>
",https://stackoverflow.com/questions/60915938/checking-sorting-button-using-cypress-in-saucedemo-com,['cypress'],421,False,0,1
UI Automation for AppleTV system using XCode,"<p>Is UI automation available for the main menu of the Apple TV and not a specific application? I already setup the whole UI testing thing using XCode and tried using the remote control but it is only available for the application that was defined using XCUIApplication.</p>
<p>So is it possible to control the whole system rather than a specific application? I was thinking of something similar to pyatv but using XCode since I might be able to get more information concerning the current focused apps and so on.</p>
",https://stackoverflow.com/questions/65068056/ui-automation-for-appletv-system-using-xcode,"['xcode', 'tvos', 'apple-tv', 'xcuitest']",392,True,0,1
Is it Possible to use Enzyme testing with Next js (SSR)?,"<p>It's My first Nextjs project with SSR.</p>
<p>When Integrating Enzyme For Reactjs UI Testing. it could not run due to <strong>&quot;React' refers to a UMD global, but the current file is a module. Consider adding an import instead.&quot;</strong></p>
<p>but it's works when i am using normal Reactjs Component(Functional or Class). Anyone Please give  suggestions.</p>
<p>SandBox Link - <a href=""https://codesandbox.io/s/currying-moon-gdk09"" rel=""nofollow noreferrer"">https://codesandbox.io/s/currying-moon-gdk09</a></p>
<p>Full code From GitHub - <a href=""https://github.com/Rizz13/nextJs-with-Enzyme"" rel=""nofollow noreferrer"">https://github.com/Rizz13/nextJs-with-Enzyme</a></p>
<p><em><strong>to run testing Use &quot;npm test&quot;</strong></em></p>
<p><strong>pages/Index.tsx</strong></p>
<pre><code>import Head from 'next/head'
import Link from 'next/link'
import { GetStaticProps } from 'next'

export default function Home({
  allPostsData
}: {
  allPostsData: {
    title: string
    id: string
  }[]
}) {
  return (
    &lt;&gt;
      &lt;Head&gt;
        &lt;title&gt;Sample Page&lt;/title&gt;
      &lt;/Head&gt;
      
      &lt;section className=&quot;icon-stars&quot;&gt;
        &lt;p&gt;[Your Self Introduction]&lt;/p&gt;
        &lt;p&gt;
          (This is a sample website - you’ll be building a site like...)
        &lt;/p&gt;
      &lt;/section&gt;
      &lt;section&gt;
        &lt;h2&gt;Blog&lt;/h2&gt;
        &lt;ul&gt;
          {allPostsData.map(({ id, title }) =&gt; (
            &lt;li key={id}&gt;
              &lt;Link href=&quot;#&quot;&gt;
                &lt;a&gt;{title}&lt;/a&gt;
              &lt;/Link&gt;
              &lt;br /&gt;
            &lt;/li&gt;
          ))}
        &lt;/ul&gt;
      &lt;/section&gt;
    &lt;/&gt;
  )
}

export const getStaticProps: GetStaticProps = async () =&gt; {
  const allPostsData = [{id: 0, title:&quot;Sample1&quot;}, {id: 1, title:&quot;Sample2&quot;}]
  return {
    props: {
      allPostsData
    }
  }
}
</code></pre>
<p><strong>_<em>tests</em>_/Index.tsx</strong></p>
<pre><code>import * as React from 'react'
import { expect as expect1 } from 'chai';

import IndexPage from '../pages/index'

import {/*mount,*/ shallow} from 'enzyme' 

const setUp1 = (data) =&gt; {
  return shallow(&lt;IndexPage {...data} /&gt;);
}
let wrapper;

describe('props Check', () =&gt; {

  beforeEach(() =&gt; {
      wrapper = setUp1({});
  });

  it('should render an `.icon-stars`', () =&gt; {
    expect1(wrapper.find('.icon-stars')).to.have.length(1);
  });

});
</code></pre>
<p>When I using the Above Code Testing could not run due to below Error.</p>
<p><a href=""https://i.stack.imgur.com/3tPgp.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/3tPgp.png"" alt=""enter image description here"" /></a></p>
",https://stackoverflow.com/questions/64461655/is-it-possible-to-use-enzyme-testing-with-next-js-ssr,"['reactjs', 'unit-testing', 'next.js', 'enzyme', 'react-tsx']",1403,True,4,1
Force Alamofire to do everything on main thread?,"<p>Is there a way to force Alamofire to do all of its work on the main thread?  This is for a test scenario where I need the main thread to not continue execution until the network calls have completed and I know the status. The tests in question used to run under the <code>XCTest</code> framework and so I would use <code>XCTestExpectation</code> to wait for completion. The environment I'm using doesn't work with <code>XCTest</code> and so I need Alamofire to be synchronous. </p>

<hr>

<p>Since the first 2 comments have both suggested how I should test, let me provide a little  more context.</p>

<p>I have about 100 tests that have been running just fine for the last 2 years. The tests are NOT unit tests but UI Tests using Google's EarlGrey 1. EarlGrey 1 provides UI testing that runs under XCTest so you can combine UI Testing with white box inspection of the app state. It's great.</p>

<p>Earl Grey 1 does not support iOS 13 and so I am porting the tests to EarlGrey 2, which runs on top of XCUITest. For the white box aspect, you make remote calls from the test process to a bundle that is injected into your app.</p>

<p>In this case the ""mock"" is the server, but it does make network calls and these happen when I call into the test bundle. I need to know when they finish so I can return after they're done.</p>
",https://stackoverflow.com/questions/60833698/force-alamofire-to-do-everything-on-main-thread,"['ios', 'swift', 'alamofire', 'earlgrey']",263,True,-2,1
"Where do I load and unload Koin Modules, in a multi-feature module application and keep it testable","<p>Basically I still haven't found a better way of loading/ unloading modules for Single activity, Multi-Module Feature approach. Loading and deloading of modules in fragments attach and detach works well, until it comes to UI testing. Then it is impossible to swap out the modules to test modules. This indeed works perfectly, but I'd like to be able to swap in and out the modules for testing somehow.</p>
<p>I was using this approach in my fragment</p>
<pre><code>    private val moduleList = arrayListOf(dataModule, viewmodelModule)
    private val loadModules by lazy {
        loadKoinModules(moduleList)
    }
    private fun injectFeatures() = loadModules

 // Loading unloading modules
    override fun onAttach(context: Context) {
        super.onAttach(context)

        injectFeatures()
    }

    override fun onDetach() {
        unloadKoinModules(moduleList)

        super.onDetach()
    }

</code></pre>
<p>And in my tests</p>
<pre><code>  @Before
   fun setUp() {
       loadKoinModules(listOf(testViewModelModule, testDataModule))
       launchFragmentInContainer&lt;MenuFragment&gt;()
   }
</code></pre>
<pre><code>val dataModule = module {

    single&lt;IMenuRepository&gt; { ImplMenuRepository(get()) }

    single&lt;NetworkDataSource&gt; { FirebaseDataSource(get()) }

}


val testDataModule = module(override = true) {
    single&lt;IMenuRepository&gt;(override = true) { FakeMenuRepository() }
}

</code></pre>
<p>And this is my error</p>
<pre><code>java.lang.RuntimeException: org.koin.core.error.DefinitionOverrideException: Definition '[Single:'com.nikolam.menu.data.IMenuRepository']' try to override existing definition. Please use override option or check for definition '[Single:'com.nikolam.menu.data.IMenuRepository']'
at androidx.test.runner.MonitoringInstrumentation.runOnMainSync(MonitoringInstrumentation.java:441)
at androidx.test.core.app.ActivityScenario.onActivity(ActivityScenario.java:564)
at androidx.fragment.app.testing.FragmentScenario.internalLaunch(FragmentScenario.java:300)
at androidx.fragment.app.testing.FragmentScenario.launchInContainer(FragmentScenario.java:282)
at com.nikolam.menu.ui.menu.MenuItemsDisplayTest.setUp(MenuItemsDisplayTest.kt:66)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:76)
at androidx.test.internal.runner.junit4.statement.RunAfters.evaluate(RunAfters.java:61)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:388)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)
Caused by: org.koin.core.error.DefinitionOverrideException: Definition '[Single:'com.nikolam.menu.data.IMenuRepository']' try to override existing definition. Please use override option or check for definition '[Single:'com.nikolam.menu.data.IMenuRepository']'
at org.koin.core.scope.ScopeDefinition.save(ScopeDefinition.kt:25)
at org.koin.core.scope.ScopeDefinition.save$default(ScopeDefinition.kt:19)
at org.koin.core.registry.ScopeRegistry.mergeDefinitions(ScopeRegistry.kt:95)
at org.koin.core.registry.ScopeRegistry.declareDefinitions(ScopeRegistry.kt:85)
at org.koin.core.registry.ScopeRegistry.declareScope(ScopeRegistry.kt:75)
at org.koin.core.registry.ScopeRegistry.loadModule(ScopeRegistry.kt:64)
at org.koin.core.registry.ScopeRegistry.loadModules$koin_core(ScopeRegistry.kt:55)
at org.koin.core.Koin.loadModules(Koin.kt:316)
at org.koin.core.context.ContextFunctionsKt.loadKoinModules(ContextFunctions.kt:60)
at com.nikolam.menu.ui.menu.MenuFragment$loadModules$2.invoke(MenuFragment.kt:28)
at com.nikolam.menu.ui.menu.MenuFragment$loadModules$2.invoke(MenuFragment.kt:22)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.nikolam.menu.ui.menu.MenuFragment.getLoadModules(Unknown Source:2)
at com.nikolam.menu.ui.menu.MenuFragment.injectFeatures(MenuFragment.kt:31)
at com.nikolam.menu.ui.menu.MenuFragment.onAttach(MenuFragment.kt:79)
at androidx.fragment.app.Fragment.performAttach(Fragment.java:2673)
at androidx.fragment.app.FragmentStateManager.attach(FragmentStateManager.java:263)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1182)
at androidx.fragment.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1255)
at androidx.fragment.app.FragmentTransition.calculateFragments(FragmentTransition.java:1138)
at androidx.fragment.app.FragmentTransition.startTransitions(FragmentTransition.java:136)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2001)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1959)
at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1830)
at androidx.fragment.app.BackStackRecord.commitNow(BackStackRecord.java:297)
at androidx.fragment.app.testing.FragmentScenario$1.perform(FragmentScenario.java:317)
at androidx.fragment.app.testing.FragmentScenario$1.perform(FragmentScenario.java:301)
at androidx.test.core.app.ActivityScenario.lambda$onActivity$2$ActivityScenario(ActivityScenario.java:551)
at androidx.test.core.app.ActivityScenario$$Lambda$4.run(Unknown Source:4)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:2207)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
</code></pre>
<p>If anyone has had success with Koin and multi feature module projects, please fill me in. Any input would be really helpful!</p>
",https://stackoverflow.com/questions/63540155/where-do-i-load-and-unload-koin-modules-in-a-multi-feature-module-application-a,"['android', 'kotlin', 'android-fragments', 'android-testing', 'koin']",1585,True,2,1
Configuring CI/CD pipeline for Android on Bitrise to run UI tests is throwing error: &quot;Could not find the exported app APK&quot;,"<p>I am setting up a CI/CD pipeline for the Android Kotlin app on Bitrise. I am configuring my pipeline to run UI tests under <code>app/src/androidTest</code> folder.</p>
<p><a href=""https://i.stack.imgur.com/A0BFZ.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/A0BFZ.png"" alt=""enter image description here"" /></a></p>
<p>I want to run the tests under that folder when the pipeline is built. So I am configuring instrumentation tests on the Bitrise following this article, <a href=""https://devcenter.bitrise.io/testing/device-testing-for-android/"" rel=""nofollow noreferrer"">https://devcenter.bitrise.io/testing/device-testing-for-android/</a>. But when I build my pipeline, Android Build for UI Testing step is throwing the following error.</p>
<pre><code>Export APKs:
  Export [ app-debug-androidTest.apk =&gt; $BITRISE_DEPLOY_DIR/app-debug-androidTest.apk ]
Could not find the exported app APK
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | android-build-for-ui-testing@0 (exit code: 1) 
</code></pre>
<p>I did not change any default variables apart from setting the Variant to Debug and Module to app and Test Type to instrumentation. How can I fix it?</p>
",https://stackoverflow.com/questions/61164804/configuring-ci-cd-pipeline-for-android-on-bitrise-to-run-ui-tests-is-throwing-er,"['android', 'continuous-integration', 'ui-testing', 'android-instrumentation', 'bitrise']",256,False,1,0
Limit Simultaneous Azure Pipelines Stage,"<p>I have an Azure DevOps Multi Stage Pipeline with multiple agents.  Generally my stages consist of:</p>
<ul>
<li>Build and Publish Artifacts</li>
<li>Deploy to environment 1</li>
<li>UI Test environment 1</li>
<li>Deploy to environment 2</li>
<li>UI Test environment 2</li>
</ul>
<p>and so on for several environments.  How do I allow simultaneous pipelines runs (e.g. Building and Publishing Artifacts for Build #2 while simultaneously UI Testing environment 2 for Build #1), while ensuring that no two agents will ever perform a UI Test for a given environment at the same time?</p>
<p><a href=""https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&amp;tabs=schema%2Cparameter-schema#triggers"" rel=""nofollow noreferrer""><code>trigger: batch</code></a> seems close to what I want, but I believe that disallows concurrency at the pipeline level, not at the stage level.</p>
",https://stackoverflow.com/questions/65398257/limit-simultaneous-azure-pipelines-stage,"['azure-devops', 'azure-pipelines']",1342,True,0,3
Disable/accept test storage service in Espresso,"<p>As can be seen in AndroidX Test 1.3.0 alpha04 <a href=""https://github.com/android/android-test/releases/tag/androidx-test-1.3.0-alpha04"" rel=""nofollow noreferrer"">release notes</a>:</p>

<blockquote>
  <p>Include the test storage service in the test services</p>
</blockquote>

<p>Unfortunately, this makes standard <code>connectedDebugAndroidTest</code> to fail because this screen is getting displayed:</p>

<p><img src=""https://i.stack.imgur.com/4TvlX.png"" width=""300"" /></p>

<p><sub><em>Choose what to allow TestServices to access</em></sub></p>

<p>And this requires my interaction in order to proceed with UI testing.</p>

<p>This makes me to hang with already quite old <code>1.3.0-alpha03</code> artifacts, although <code>1.3.0-beta01</code> is already available.</p>

<p><strong>Question:</strong></p>

<p>How to accepts this permission via gradle command or within <code>testOptions</code> configuration? Somehow I can find neither any indication in docs nor a post in web with similar issue.</p>

<hr>

<p><strong>UPDATE</strong></p>

<p>Yuki Hamada, an engineer from Espresso team, <a href=""https://twitter.com/yuuki3655/status/1253097389474246656?s=20"" rel=""nofollow noreferrer"">confirmed</a> that this is an issue and that they are working on that.</p>
",https://stackoverflow.com/questions/61362916/disable-accept-test-storage-service-in-espresso,"['android', 'unit-testing', 'android-espresso', 'android-testing', 'ui-testing']",363,False,2,1
Add id or name property or other means of identification for Flutter Web applications?,"<p>Writing a Flutter Web application, I try to leverage a Web-UI-Testing framework based on Selenium. Sadly I fail to identify a HTML-Element representing a certain flutter widget by its id or name attribute. The widget key is not present in the HTML document.</p>

<p>I manage to use Text widget contents to find an widget's text portion and can find its parent element representing the widget containing the text but this fails for images, canvas etc.</p>

<p>Is there any mechanism I can use to add id/name (or any other means of identification) to the HTML tag soup?</p>

<p>Using JavaScript, is there a way to traverse the internal logical widget tree and from there conclude the representing HTML element (for example by its location and size)?</p>
",https://stackoverflow.com/questions/59967096/add-id-or-name-property-or-other-means-of-identification-for-flutter-web-applica,"['javascript', 'html', 'selenium', 'flutter', 'flutter-web']",3984,True,11,2
Xcode12 CoreNFC simulator library not loaded,"<p>Our app uses CoreNFC to scan NFC tags or you can use QR if NFC is not supported. This worked pretty well and we were able to run the app in the simulator for (ui) testing purposes.<br />
Until Xcode12 / iOS14 GM builds. In iOS13 (or lower) we wouldn't have any issues running it on a simulator.</p>
<p>But in Xcode12 running it on a iOS14 simulator iPhone11 we would get the following:</p>
<pre><code>dyld: launch, loading dependent libraries
DYLD_SHARED_CACHE_DIR=/Users/xxx/Library/Developer/CoreSimulator/Caches/dyld/19G73/com.apple.CoreSimulator.SimRuntime.iOS-14-0.18A372
DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
DYLD_LIBRARY_PATH=/Users/xxx/Library/Developer/Xcode/DerivedData/xxx-awnlestrbvesqqbynrhmluzhbcsc/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSi
dyld: Library not loaded: /usr/lib/libnfshared.dylib
  Referenced from: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreNFC.framework/CoreNFC
  Reason: no suitable image found.  Did find:
    /usr/lib/libnfshared.dylib: mach-o, but not built for platform iOS-sim
</code></pre>
<p>That the simulator crashes makes sense to me, since the simulator can't scan NFC tags, but this is what I've done:</p>
<ul>
<li>I already linked to the CoreNFC framework and made it optional, like described here: <a href=""https://stackoverflow.com/questions/52562639/xcode-10-swift-4-app-with-corenfc-crashes-in-review-on-ios-12"">Xcode 10, Swift 4 app with CoreNFC crashes in review on iOS 12</a></li>
<li>Put <code>#if canImport(CoreNFC)</code> around <code>import CoreNFC</code> and it's underlying NFC code.</li>
<li>Cleaning the build folder and deleting derived data.</li>
<li>Created an empty Xcode12 project: <a href=""https://github.com/basvankuijck/CoreNFCCrashProject"" rel=""nofollow noreferrer"">https://github.com/basvankuijck/CoreNFCCrashProject</a>, same result.</li>
<li>Removed all the listed simulators and re-added one</li>
<li>Added <code>-weak_framework &quot;CoreNFC&quot;</code> to the Other Linker Flags build setting</li>
</ul>
<p>Obviously removing any references to the CoreNFC framework by either commenting out code sections and removing the framework link, makes the crash disappear. But that's not a suitable option.</p>
<p>Running it from Xcode12 on an iOS13 simulator 'device' works perfectly. So I can't seem to figure out what is causing this behavior</p>
",https://stackoverflow.com/questions/63915728/xcode12-corenfc-simulator-library-not-loaded,"['ios', 'swift', 'ios14', 'xcode12', 'core-nfc']",8291,True,49,5
Is there any framework to automate UI of a website other than Galen framework,"<p>I am currently working on TestNG framework in which Galen framework is embedded. The Galen Testcases deals the UI part of our website.</p>

<p>I have researched a lot and there is no other automation tools same or better than that of Galen Framework for UI testing specifically.</p>

<p>I am well aware that it can be done with coding Java or even writing testcases script manually in Java itself. But, is there any other advanced UI automation too available in market?</p>

<p>I want this because the report of Galen is such a big size that mailing this report or moving this report is not a good practice(Which makes my CI/CD pipeline slow).</p>
",https://stackoverflow.com/questions/60108723/is-there-any-framework-to-automate-ui-of-a-website-other-than-galen-framework,"['selenium', 'automation', 'continuous-integration', 'galen']",30,False,0,0
TestCafe firefox fails when page load takes too long,"<p>I'm pretty new to UI testing and just started exploring testCafe</p>

<p>I'm writing a simple test in testCafe that will go to google, search testCafe, click on the submit button , then click on the first search result that appears and verify if it is the testCafe page:</p>

<pre><code>import {Selector} from 'testcafe';
import {ClientFunction} from 'testcafe';

const getURL = ClientFunction(()=&gt; window.location.href);

fixture `Getting Started`
    .page `https://www.google.com/`;

test('Google Search test', async t =&gt;{
    await t
    .typeText('input[name=""q""]','testcafe')
    .click('input[type=""submit""]')
    .click('div.r &gt; a')
    .expect(getURL()).eql(""https://devexpress.github.io/testcafe/documentation/getting-started/"")

})
</code></pre>

<p>This test works perfectly with Chrome and Safari, however Firefox is taking too long to load the google home page, and it is somehow not able to find the <code>input[type=""submit""]</code> button. Thus the test fails. It seems to me that the test starts executing even before the pageLoad finishes. </p>

<p>Here is the error that comes in Firefox:</p>

<pre><code>   1) The element that matches the specified selector is not visible.

      Browser: Firefox 75.0 / macOS 10.14

          7 |    .page `https://www.google.com/`;
          8 |
          9 |test('Google Search test', async t =&gt;{
         10 |    await t
         11 |    .typeText('input[name=""q""]','testcafe')
       &gt; 12 |    .click('input[type=""submit""]')
         13 |    .click('div.r &gt; a')
         14 |    .expect(getURL()).eql(""https://devexpress.github.io/testcafe/documentation/getting-started/"")
         15 |
         16 |})

         at &lt;anonymous&gt; (/Users/goplap/TestCafeTest/tests/sampleTest.js:12:6)
         at &lt;anonymous&gt; (/Users/goplap/TestCafeTest/tests/sampleTest.js:9:1)
         at &lt;anonymous&gt; (/Users/goplap/TestCafeTest/node_modules/testcafe/src/api/wrap-test-function.js:17:28)
         at TestRun._executeTestFn (/Users/goplap/TestCafeTest/node_modules/testcafe/src/test-run/index.js:295:19)
         at TestRun.start (/Users/goplap/TestCafeTest/node_modules/testcafe/src/test-run/index.js:345:24)



 1/1 failed (18s)
</code></pre>

<p>Is there a better way to write this test?</p>
",https://stackoverflow.com/questions/62003232/testcafe-firefox-fails-when-page-load-takes-too-long,"['javascript', 'testing', 'automated-tests', 'testcafe', 'ui-testing']",688,True,0,1
"Android UI Testing, context.startactivity() does not work","<p>I am constructing a Android UI test using UIAutomator, hope to start the target app to be test and do some test actions on the UI. But when I use intent to start the app, it does not work (ie. it does not launch the target app on my real device, but the target app can be launched in <code>MainActivity</code> using <code>startactivity()</code>)</p>

<p>Code_piece (in my androidTest Class):</p>

<pre><code>// Launch the app
Context context = ApplicationProvider.getApplicationContext();
final Intent intent = context.getPackageManager()
        .getLaunchIntentForPackage(""com.target"");
// Clear out any previous instances
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(intent);
</code></pre>

<p>This code is just from officail instruction: <a href=""https://developer.android.com/training/testing/ui-testing/uiautomator-testing"" rel=""nofollow noreferrer"">https://developer.android.com/training/testing/ui-testing/uiautomator-testing</a></p>

<p>I don't know why it can't start the target app, and where the critical problem lies. Does it matters with how the intent to be set, or the package name? (the package could not be wrong because I use it to launch the target app successfully in <code>MainActivity</code>)</p>
",https://stackoverflow.com/questions/62241383/android-ui-testing-context-startactivity-does-not-work,"['android', 'android-intent', 'ui-automation', 'ui-testing', 'start-activity']",200,False,3,0
UI testing of a UIKeyCommand added via keyCommands,"<p>I have freshly added a bunch of key commands (Cmd-..., etc) in the app by implementing</p>
<pre><code>-(NSArray&lt;UIKeyCommand*&gt;*)keyCommands;
</code></pre>
<p>on a UIViewController subclass. Everything works wonderfully when manually tested in the app. The problem is how to UI test this in the iOS simulator.</p>
<p>I don't seem to be able invoke these commands using a method on <code>XCUIElement</code>. According to <a href=""https://developer.apple.com/documentation/xctest/xcuielement?language=objc"" rel=""nofollow noreferrer"">its documentation</a>, there only seems to be one text input method on iOS</p>
<pre><code>- (void)typeText:(NSString *)text;
</code></pre>
<p>with no (apparent) way to bless the input character with a key modifier flag (<code>XCUIKeyModifierFlags</code>) for <code>Cmd</code>, <code>Alt</code>, etc keys.</p>
<p>The method</p>
<pre><code>- (void)typeKey:(NSString *)key modifierFlags:(XCUIKeyModifierFlags)flags;
</code></pre>
<p>appears to be macOS only. It would be a shame to provide these commands but not be able to test them in our UI testing suite.</p>
<p>Any ideas that can help me make some progress would be hugely welcome.</p>
",https://stackoverflow.com/questions/64114804/ui-testing-of-a-uikeycommand-added-via-keycommands,"['ios', 'xctest', 'xcode-ui-testing', 'ui-testing']",222,False,1,1
Chutzpah doesn&#39;t detect jasmine tests in Typescript with AMD modules,"<p>We are trying to figure out a approach for UI testing and felt chutzpah will be a nice option.
I wrote jasmine tests using typescript and requirejs. Chutzpah is able to detect the sample tests which doesn't import any external modules. But when i try it with importing external modules to be tested, chutzpah doesn't seems to detect the tests in test explorer.
This is my repo link: <a href=""https://github.com/NareshNow/UItesting.git"" rel=""nofollow noreferrer"">https://github.com/NareshNow/UItesting.git</a></p>

<p>This is my chutzpah json file:</p>

<pre><code>""Framework"": ""jasmine"",
""TestHarnessReferenceMode"": ""AMD"",
""TestHarnessLocationMode"": ""SettingsFileAdjacent"",
""AMDBaseUrl"": ""../Compiledmodules/Tests"",
""AMDAppDirectory"": ""../Compiledmodules"",
""TestFileTimeout"": 600000,
""EnableCodeCoverage"": false,
""References"": [

{
  ""Path"": ""../Scripts/require.js"",
  ""IsTestFrameworkFile"": true
},
{
  ""Path"": ""../Scripts/AMDconfig.js"",
  ""IsTestFrameworkFile"": true
}
],
""Compile"": {
""Mode"": ""External"",
""Extensions"": [ "".ts"" ],
""ExtensionsWithNoOutput"": [ "".d.ts"" ],
""SourceDirectory"": ""../Typescripts"",
""OutDirectory"": ""../Compiledmodules""
},
""Tests"": [
{
""Path"": ""../Typescripts"",
""Includes"": [ "".ts"" ]
},
{
""Path"": ""../Compiledmodules"",
""Includes"": ["".js""]
}
]
}
</code></pre>

<p>I have tried the suggestions from a lot of earlier questions on the similar issue for the last 5 days, and nothing seemed to work. It feels to me like something simple is missing.
You can find the tests , chutzpah.json in the TypescripKit folder in the repo.
Any help would be so greatly appreciated. Thank you!</p>
",https://stackoverflow.com/questions/59809549/chutzpah-doesnt-detect-jasmine-tests-in-typescript-with-amd-modules,"['typescript', 'jasmine', 'requirejs', 'amd', 'chutzpah']",109,True,0,1
Accessing the UI controls of a WPF project from Unit Test project once the progress bar has finished loading,"<p>I have a WPF application and I am trying to Automate the UI testing. I am using <code>FlaUI</code> for this. I am also using <code>NUnit</code> as the testing framework. 
My application uses <code>DevExpress</code> controls and currently I am facing an issue wherein I am not able to check the <code>Visibility of my progress bar</code> from my Unit Test application. 
Using <code>FlaUI</code> I am able to <code>launch</code> the application and get the <code>Window</code> handle but the application takes some time to set the <code>visibility</code> of the <code>UI elements</code>. 
As the UI loading is taking time and it is governed by a progress bar, I Am looking for a mechanism wherein my Test Project could check if the progress bar's visibility is <code>changed</code> and then go ahead and execute the test cases.
Here is the control's <code>XAML</code> from the WPF project</p>

 

<pre><code>    &lt;ProgressBar AutomationProperties.AutomationId=""showProgress""
        Grid.Row=""1""
        Height=""4""
        Margin=""0""
        BorderThickness=""0""
        IsIndeterminate=""True""
        IsTabStop=""False""
        ToolTip=""Contacting Server, Please Wait...""
        Visibility=""{Binding IsServerActive, Converter={StaticResource MwBoolToVisibilityConverterReverse}}"" /&gt;

    &lt;views1:VoyageEditorControl Grid.Row=""2"" Grid.Column=""0"" /&gt;
</code></pre>

<p>Here below is the code from my <code>Nunit</code> framework</p>

<pre><code>[TestFixture(AutomationType.UIA3)]
    public class UnitTest1 : FlaUITestBase
    {


        public AutomationType AutomationType { get; }

        protected override ApplicationStartMode ApplicationStartMode =&gt; ApplicationStartMode.OncePerFixture;

        public UnitTest1(AutomationType automationType)
        {
            AutomationType = automationType;
        }

        protected override AutomationBase GetAutomation()
        {
            return UtilityMethods.GetAutomation(AutomationType);
        }

        protected override Application StartApplication()
        {
            string executableLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string projectPath = executableLocation.Replace(""BP.GIS.Synergy.ShipTracker.UITests"", ""BP.GIS.Synergy.ShipTracker"");

            string exeLocation = Path.Combine(projectPath, ""BP.GIS.Synergy.ShipTracker.exe"");

            var app= Application.Launch(exeLocation);
            app.WaitWhileMainHandleIsMissing();
            return app;

        }
 #region Test cases      


        [Test]
        public void getAppHandleFirst()
        {
            //  Thread.Sleep(10000);


            var mainWindow = Application.GetMainWindow(Automation);

            var elementName = mainWindow.FindFirstDescendant(cf =&gt; cf.ByAutomationId(""AvailableViews"")).AsComboBox();

            Assert.That(elementName.IsEnabled, Is.True);
            Action action = () =&gt; elementName.Click();

            RetryResults retryResult = Retry.While(action, TimeSpan.FromSeconds(1));
            bool isCompletedSuccessfully = retryResult.IsCompletedSuccessfully;

        }

        [Test]
        public void checkAppLoadProgress()
        {
            var mainWindow = Application.GetMainWindow(Automation);
            var elementName = mainWindow.FindFirstDescendant(cf =&gt; cf.ByAutomationId(""showProgress"")).AsProgressBar();

        }
</code></pre>

<p>In short, the method <code>getAppHandleFirst()</code> and others should only start executing once the progress bar is gone from the screen.</p>
",https://stackoverflow.com/questions/59710462/accessing-the-ui-controls-of-a-wpf-project-from-unit-test-project-once-the-progr,"['c#', 'wpf', 'nunit', 'devexpress-wpf', 'flaui']",408,False,3,0
Bitrise Unable to find instrumentation info for: ComponentInfo,"<p>I have created a class with the Espresso Test, named InsertFirst.class, I have correctly tried it on my android studio project, and it works.
Now I am trying to do the same on Bitrise. I have this worflow:</p>

<ol>
<li>Activate SSH key (RSA private key)</li>
<li>Git Clone Repository</li>
<li>Bitrise.io Cache:Pull</li>
<li>Do anything with Script step</li>
<li>Install missing Android SDK components</li>
<li>Android Lint</li>
<li>Android Unit Test</li>
<li>Android Build for UI Testing</li>
<li>[BETA] Virtual Device Testing for Android</li>
<li>Android Build</li>
<li>Deploy to Bitrise.io - Apps, Logs, Artifacts</li>
<li>Bitrise.io Cache:Push</li>
</ol>

<p>All the steps works, a part of the step 9. That I have configured in this way:
<a href=""https://i.stack.imgur.com/ZIrDX.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/ZIrDX.png"" alt=""Step Configuration""></a></p>

<p>But when I run a build I get this ouptup on this step:</p>

<pre><code>Configs:
- AppPath: /bitrise/deploy/app-debug.apk
- TestTimeout: 900.000000
- FlakyTestAttempts: 0
- DownloadTestResults: false
- DirectoriesToPull: 
- AutoGoogleLogin: false
- EnvironmentVariables: 
- ObbFilesList: 
- TestDevices:
---
Model    API Level   Locale   Orientation   
Nexus6   24          en       portrait      
---
- TestType: instrumentation
- TestApkPath: /bitrise/deploy/app-debug-androidTest.apk
- InstTestPackageID: 
- InstTestRunnerClass: com.app.name.nameeapp.ui.login.InsertFirst
- InstTestTargets: 
- UseOrchestrator: false
Uploading app and test files
- (1/1) running
- (0/1) running
=&gt; Test finished
Test results:
Model    API Level   Locale   Orientation   Outcome              
Nexus6   24          en       portrait      failure  
</code></pre>

<p>And If I go to the Test Report, on the Firebase TestLab -> Test Artifacts -> instrumentation.results
I got this error:</p>

<pre><code>INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.app.name.nameeapp.test/com.app.name.nameeapp.ui.login.InsertFirst}
INSTRUMENTATION_STATUS_CODE: -1
android.util.AndroidException: INSTRUMENTATION_FAILED: com.app.cerere.cerereapp.test/com.app.name.nameeapp.ui.login.InsertFirst
    at com.android.commands.am.Am.runInstrument(Am.java:890)
    at com.android.commands.am.Am.onRun(Am.java:400)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
    at com.android.commands.am.Am.main(Am.java:121)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)
</code></pre>

<p>Why? I miss something in the step? Or there is something that I forgot? Thanks</p>
",https://stackoverflow.com/questions/60457214/bitrise-unable-to-find-instrumentation-info-for-componentinfo,"['android', 'bitrise']",84,False,0,0
"Espresso, how to scroll to bottom and IDLE state of recycler view","<p>I am learning UI testing with Espresso. I want to test scrolling of recycler view to bottom and only then load next page from view model and pass it recycler view.</p>
<p>I have following onScrollListener in my fragment:</p>
<pre><code>private fun setupOnScrollListener() {
        recyclerViewApi.addOnScrollListener(object : RecyclerView.OnScrollListener() {
            override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
                super.onScrollStateChanged(recyclerView, newState)

                val isRecyclerViewBottom = !recyclerView.canScrollVertically(1) &amp;&amp;
                        newState == RecyclerView.SCROLL_STATE_IDLE

                if (isRecyclerViewBottom) {
                    downloadNextPage()
                }
            }
        })
    }

private fun downloadNextPage() {
        showProgressBar(true)
        viewModel.getNextMovies()
    }
</code></pre>
<p>When I test it manually with <code>Log.d()</code> it works great.</p>
<p><strong>My question is</strong>: How to use Espresso (or maybe different API, if you know better than Espresso) to scroll recycler view to this state:
<code>isRecyclerViewBottom = !recyclerView.canScrollVertically(1) &amp;&amp; newState == RecyclerView.SCROLL_STATE_IDLE</code>,
so my <code>downloadNextPage()</code> will be invoked and test function will pull more data.</p>
<p>My test function:</p>
<pre><code>@Test
    fun scrollToBottom_isNextPageLoaded(){
        every { repository.getApiMovies(any(), any()) } returns
                Flowable.just(Resource.success(moviesList1_5)) andThen
                Flowable.just(Resource.success(moviesList1_10))

        val scenario = launchFragmentInContainer&lt;ApiFragment&gt;(factory = fragmentsFactory)
        //first 5 items are in view, so I go to the last item (index 4)
        recyclerView.perform(scrollToPosition&lt;ViewHolder&gt;(4))
        recyclerView.perform(swipeDown())
       //Below doesn't make any difference
        Thread.sleep(1000L) 

        verify(exactly = 2) { repo.getApiMovies(any(), any()) }
    }
</code></pre>
<p>I use Robolectric, Mockk, Espresso. I have mocked here repository class, which is passed to constructor of ViewModelFactory, which is passed to constructor of the ApiFragment.</p>
<p>Message from JUnit:</p>
<pre><code>java.lang.AssertionError: Verification failed: call 1 of 1: ApiRepository(repo#4).getApiMovies(any(), any())). 
One matching call found, but needs at least 2 and at most 2 calls
Call: ApiRepository(repo#4).getApiMovies(Top Rated, 1)
</code></pre>
<p>It is not my first test function. Everything else works great. I just don't know how to make Espresso to go to bottom of recycler view and 'pull up' bottom edge of it to call <code>downloadNextPage()</code></p>
",https://stackoverflow.com/questions/64302496/espresso-how-to-scroll-to-bottom-and-idle-state-of-recycler-view,"['android', 'android-recyclerview', 'android-espresso', 'ui-testing']",1222,True,0,1
Testing a Dynamic Button View,"<p>I've inherited a SwiftUI codebase and am attempting to write some UITests for it. </p>

<p>Now, I'm still catching up to speed with writing Swift and SwiftUI code, so I'm not sure of the legitimacy of the design pattern being utilized. There's essentially an initial view, that starts with an initial <code>@State</code> and begins to pass it down from there into later view through the <code>@Binding</code> tag.</p>

<p>Due to Swift's UI testing requiring an Accessibility label, the button below is causing me a bit of a headache. For a handful of views, there is only ever one <code>BottomTextButton</code> with the content within it dynamically changing based on the case statement and the view we are viewing.</p>

<pre class=""lang-swift prettyprint-override""><code>    struct TextButton {
        enum ButtonType {
            case signUp
            case logIn
        }
    }

    //View for the bottom text button in the signup / login flow.
    struct BottomTextButton: View {

        @Binding var loginSignupScreen: LoginSignupFlow.ScreenType
        @Binding var bottomTextButton: TextButton.ButtonType
        @Binding var signUpCTA: String
        @Binding var transitonBackward: Bool
        @Binding var buttonAccessibilityLabel: String

        var body: some View {

            Button(action: {

                    switch self.bottomTextButton {
                    case .logIn:
                        self.transitonBackward = false
                        self.loginSignupScreen = .logIn
                        self.bottomTextButton = .signUp
                        self.signUpCTA = ""Text me a code""
                        self.buttonAccessibilityLabel = ""logIn""

                    case .signUp:
                        self.transitonBackward = true
                        self.loginSignupScreen = .signUp
                        self.bottomTextButton = .logIn
                        self.buttonAccessibilityLabel = ""signUp""
                    }

            }) {
                VStack(spacing: 0) {
                    bottomTextButtonFunction()
                }
                .padding([.bottom], 20)
                .frame(width: UIScreen.main.bounds.width)
            }
            .accessibility(label: Text(""\(self.buttonAccessibilityLabel)""))

        }

        func bottomTextButtonFunction() -&gt; AnyView {
           switch bottomTextButton {
                case .signUp: return AnyView(SignUpButtonView())
                case .logIn: return AnyView(LogInButtonView())
            }
        }
    }

    //Sign Up Button
    struct SignUpButtonView: View {
        var body: some View {
            VStack(spacing: 0) {
                Text(""Don't have an account?"")
                    .scaledFont(name: ""Gotham Light"", size: 16)
                    .foregroundColor(Color(""baydynamic""))
                Text(""Sign Up"")
                    .scaledFont(name: ""Gotham Medium"", size: 16)
                    .foregroundColor(Color(""baydynamic""))
            }
        }
    }

    //Log In Button
    struct LogInButtonView: View {
        var body: some View {
            VStack(spacing: 0) {
                Text(""Already have an account?"")
                    .scaledFont(name: ""Gotham Light"", size: 16)
                    .foregroundColor(Color(""baydynamic""))
                Text(""Log In"")
                    .scaledFont(name: ""Gotham Medium"", size: 16)
                    .foregroundColor(Color(""baydynamic""))
            }
        }
    }
}
}
</code></pre>

<p>Here is an example of how the <code>BottomTextButton</code> is being implemented:</p>

<pre class=""lang-swift prettyprint-override""><code>HStack(alignment: .top) {
    VStack {
        if self.loginSignupScreen == .logIn {
            LoginView(
                loginSignupScreen: $loginSignupScreen,
                bottomTextButton: $bottomTextButton,
                loggedIn: $loggedIn,
                transitonBackward: $transitonBackward
            )} else if self.loginSignupScreen == .signUp {
                SignUpView(
                    loginSignupScreen: $loginSignupScreen, 
                    bottomTextButton: $bottomTextButton, 
                    signUpCTA: $signUpCTA, 
                    transitonBackward: $transitonBackward
                )}
            }
        }

VStack {
    BottomTextButton(
        loginSignupScreen: $loginSignupScreen,
        bottomTextButton: $bottomTextButton,
        signUpCTA: $signUpCTA,
        transitonBackward: $transitonBackward,
        buttonAccessibilityLabel: $buttonAccessibilityLabel
    )
}
</code></pre>

<p>Now, I am trying to dynamically alter the accessibility label but then I run into the error:</p>

<p><code>Failed to synthesize event: Failed to scroll to visible (by AX action) Button, label: 'signUp', error: Error kAXErrorCannotComplete performing AXAction 2003 on element AX element pid: 4327, elementOrHash.elementID: 105553148256224.19</code></p>

<p>Here is an example of how I am attempting to test this:</p>

<pre class=""lang-swift prettyprint-override""><code>func testSignUpViewForm() {
    let loginBottomButton = app.buttons[""logIn""]
    XCTAssertTrue(loginBottomButton.exists)
    loginBottomButton.tap()

    let signUpBottomButton = app.buttons[""signUp""]
    XCTAssertTrue(signUpBottomButton.exists)
    signUpBottomButton.tap()

}
</code></pre>
",https://stackoverflow.com/questions/61146741/testing-a-dynamic-button-view,"['swift', 'swiftui', 'xctest', 'xctestcase']",379,False,0,0
Keycloak: how to programmatically add new subgroups with associated users?,"<p>In Keycloak 8.0.1 we have a Realm with a Group and Subgroups like this:</p>
<pre><code>group -
    subgroup1
    subgroup2
    ...
</code></pre>
<p>We need to insert a batch of subgroups and users into <code>group</code>. The subgroup should have some attributes.</p>
<p>How can I do this?</p>
<p>I tried:</p>
<ol>
<li><p>Using an exported <code>realm-export.json</code> file with newly added subgroups and &quot;Overwrite&quot; on the import. Now I don't see how to connect the new user with the subgroup. And I am also not sure if old users will not be removed this way.</p>
</li>
<li><p>Calling the Keycloak REST API. It doesn't seem possible to UPDATE a group and add subgroups. <a href=""https://www.keycloak.org/docs-api/5.0/rest-api/index.html#_updategroup"" rel=""nofollow noreferrer"">Documentation</a> says:</p>
<blockquote>
<p><code>PUT /{realm}/groups/{id}</code><br/>Update group, ignores subgroups.</p>
</blockquote>
</li>
</ol>
<p>Now I am looking at using a UI testing tool to add the user programmatically, but this seems needlessly complex.</p>
<p>Is it possible to programmatically add new subgroups with users associated to that subgroup? Am I missing something with the REST API call or the import functionality? Is there maybe another way via for example the <a href=""https://gist.github.com/thomasdarimont/c4e739c5a319cf78a4cff3b87173a84b"" rel=""nofollow noreferrer"">Java Admin Client</a>?</p>
",https://stackoverflow.com/questions/59887180/keycloak-how-to-programmatically-add-new-subgroups-with-associated-users,"['java', 'keycloak', 'keycloak-services']",6505,True,2,2
Different possibilities of Firebase Test Labs for flutter,"<p>I have a flutter app developed and now I need to integrate automated UI testing, upon some research, I came to know about Firebase Test Lab (<a href=""https://firebase.google.com/docs/test-lab"" rel=""nofollow noreferrer"">https://firebase.google.com/docs/test-lab</a>)</p>
<p>Then I learned that it is not supported for Flutter (<a href=""https://stackoverflow.com/a/61779777"">https://stackoverflow.com/a/61779777</a>)</p>
<p>On further digging I found Flutter Test (<a href=""https://flutter.dev/docs/testing"" rel=""nofollow noreferrer"">https://flutter.dev/docs/testing</a>) and to be specific I was in need of Integration Testing (<a href=""https://flutter.dev/docs/testing#integration-tests"" rel=""nofollow noreferrer"">https://flutter.dev/docs/testing#integration-tests</a>), but the problem I see here is this integration testing can not be automated (using CI/CD or using other third party services) or I may be wrong in this understanding.</p>
<p>Hence I wanted to ask to the Flutter and Firebase community that</p>
<ol>
<li>Is there any way I can use Test Labs of Firebase for Flutter Project</li>
<li>Or some other service provider where I can get near to similar service / functionality what Firebase Test labs offers for Android / iOS</li>
</ol>
<p>Thanks.</p>
",https://stackoverflow.com/questions/64898800/different-possibilities-of-firebase-test-labs-for-flutter,"['firebase', 'flutter', 'flutter-test', 'firebase-test-lab']",228,False,0,0
Scraping all videos from a tiktok profile,"<p>I'm trying to make a tool that downloads every video from a given user on TikTok at once.  example page: <a href=""https://www.tiktok.com/@levelsofpiano"" rel=""noreferrer"">https://www.tiktok.com/@levelsofpiano</a> . I started by examining the html tree on a TikTok profile which revealed these ""a"" tags that hold links to the video pages for each video that's loaded on the page.</p>

<p><a href=""https://i.stack.imgur.com/X9bR4.png"" rel=""noreferrer""><img src=""https://i.stack.imgur.com/X9bR4.png"" alt=""&#39;a&#39; tag""></a></p>

<p>I tried to use <code>wget</code> to capture the page using <code>wget https://www.tiktok.com/@levelsofpiano &gt; Output.html</code>, however there is no mention even of <code>@levelsofpiano</code> in the resulting html. I'm guessing the content on the site is loaded dynamically, so poor <code>wget</code> gets a mostly empty page.</p>

<p>I then decided to use <code>testcafe</code> (UI testing tool like Selenium) to load the page, wait 20 seconds, and capture the html output... but the videos don't load when I use this method:
<a href=""https://i.stack.imgur.com/oUeIP.png"" rel=""noreferrer""><img src=""https://i.stack.imgur.com/oUeIP.png"" alt=""enter image description here""></a></p>

<p>Here's my script:</p>

<pre><code>import { Selector, ClientFunction } from 'testcafe';
import fs from 'fs';

let username = ""levelsofpiano"";
fixture `Get Dat Tiktok`.page(""https://www.tiktok.com/@"" + username);

function sleep(ms) { return new Promise(resolve =&gt; setTimeout(resolve, ms)); }

/* got this definition from https://testcafe-discuss.devexpress.com/t/can-i-save-a-web-page-as-an-html-file/461 */
const getPageHTML = ClientFunction(() =&gt; document.documentElement.outerHTML);

test('Capture page with loaded elements', async t =&gt; {
    await sleep(20000); //20 seconds
    await fs.writeFile('./' + username + '.html',await getPageHTML(), function(err, result) {
        if(err) console.log('error', err);
    });    
});
</code></pre>

<p>What else can I try to scrape all these videos?  I'm likely going to need a way to scroll through the page to load all videos as well (which I could do with testcafe or selenium.. if I could find a way to get them to load the content I'm looking for)</p>
",https://stackoverflow.com/questions/59690743/scraping-all-videos-from-a-tiktok-profile,"['html', 'web-scraping']",3399,True,6,1
Geb If Else or try catch handling,"<p>I am new to Geb spoke testing and I have a test that ui send message and receive text or email, I have an api call that grabs the sent email/text, I need to use that response and continue in the UI testing. but that response is expired since the api is fast and its getting the previous  sent message which (before my ui send that email/text) and the last sent makes the previous expired. so my question is I need to call that api again if the message is expired, I tried if else and waitFor methods but couldn't come up with solution, I use page objects and test specs and I cannot create that as a method since that is happening on one page and in one def class and which I cannot even do waitFor in my test class which results IllegalMonitorStateException</p>

<pre class=""lang-groovy prettyprint-override""><code>when: ""I enter text code""
String text = response.getText()
testPage.enterCode &lt;&lt; text
testpage.pager.clickNext() // here is happening the code expiration and couldn't get to the next page,

then: ""I am in next page""
at nextPage // if am not on the next page I need to make a new api call to get the newest response
</code></pre>

<p>I tried </p>

<pre class=""lang-groovy prettyprint-override""><code>when: ""I enter text code""
String text = response.getText()
testPage.enterCode &lt;&lt; text
testpage.pager.clickNext() 
def erroHappened = testPage.errorAlert.isdisplayed

then: ""I am in next page""
!errorHappened &amp;&amp; testPage.enterCode &lt;&lt; response.getText()
</code></pre>

<p>How can I use the wait or try catch or if else to solve this issue, Thank you in advance</p>
",https://stackoverflow.com/questions/60221402/geb-if-else-or-try-catch-handling,['geb'],116,False,1,0
How to properly test in React Native,"<p>I am having a hard time understanding the ways to propertly set up react-native for testing. Given that TDD is a big thing, I dont get it why is it not out of the box for react. </p>

<p>I am using babel 7, jest 24 and react native 0.62. At my first attempt to run <code>npm test</code>, I end up with errors which seem to be about node_modules not being in pure javascript. I am learning about transpilers and why we need them, but maybe I am missing something. </p>

<p>This is the kind of thing I am getting into:</p>

<pre><code>    /Users/marcelo/work/projectname/javascript/ProjectName/node_modules/react-navigation/src/index.js:1
    ({""Object.&lt;anonymous&gt;"":function(module,exports,require,__dirname,__filename,global,jest){export * from '@react-navigation/core';

    SyntaxError: Unexpected token 'export'


</code></pre>

<p>I did try to find something online about properly setting up the env for testing, but no luck so far. It seems this is not a well enough explored topic or I just dont know how to search. So how do I go about properly not only fixing this error, but setting up a decent TDD, BDD environment for my react native apps, whether it is component testing or UI testing?</p>
",https://stackoverflow.com/questions/61890343/how-to-properly-test-in-react-native,"['reactjs', 'react-native']",25,False,1,0
Will Appium with XCUItest driver create xcuitest scripts for me?,"<p>This is my first time trying to test my Cordova iOS app to within AppCenter.  I've read documentation and it appears for UI testing on iOS hybrid apps I should use XCUITest framework so that is what I'm doing.  </p>

<p>I set it all up and I started the test recording that is supposed to create the scripts for me but it crashes XCode and I'll spare you the details but I can't find the fix.  So now I'm forced to manually create my tests in order to upload to AppCenter.  Obviously I can manually create the tests and I've started doing that now but I'm not getting anywhere fast.  </p>

<p>My question is: will Appium help me write XCUITests that I can then turn around and use to upload to AppCenter?  I started trying to implement Appium but so many areas of the documentation is a struggle for me.  I'll go back to trying to implement Appium if I know for a fact it will create the XCUITests for me.</p>
",https://stackoverflow.com/questions/59671576/will-appium-with-xcuitest-driver-create-xcuitest-scripts-for-me,"['ios', 'appium', 'visual-studio-app-center', 'xcuitest']",70,True,0,1
How to test modules within a golem framework shiny package?,"<p>I am trying to develop unit tests for my shiny app, which was made using <code>golem</code> framework and <code>shiny</code> v1.5.0.</p>
<p>Golem comes with a recommended test file, which covers very basic UI testing. I am, however, way more concerned with testing the server-side, for all modules. So just like you would make tests for each function in a regular R package, I want to test each module in my shiny app.</p>
<p>I know that there's a <code>testModule</code> function in development, but it is not included within the latest shiny CRAN version (which is precisely the version I am using). There's only a <code>testServer</code> function, but all the examples I found seem to define the module server side within the test file. I couldn't find an example of module testing when the module is part of a package.</p>
<p>So what I'd like to do is basically a test that lives inside <code>tests/testthat/test-my_module.R</code> and would look like this:</p>
<pre><code>
test_that(&quot;The module receives its input&quot;, {
    shiny::testServer(
        app = mypackage::my_module_server,
        args = list(),
        session = MockShinySession$new(), {
        session$setInputs(some_input = 100)
        expect_equal(output$some_output, 50)
    })
})
</code></pre>
<p>However, this throws an error:</p>
<pre><code>Error in UseMethod(&quot;as.shiny.appobj&quot;, x) : 
  método não aplicável para 'as.shiny.appobj' aplicado a um objeto de classe &quot;function&quot;
</code></pre>
<p>which basically says the specified method does not work when applied to a function class object.</p>
<p>Am I missing something here?</p>
<p>Would appreciate some discussion on how you do tests when developing a shiny app as a package.</p>
",https://stackoverflow.com/questions/64391273/how-to-test-modules-within-a-golem-framework-shiny-package,"['r', 'shiny', 'testthat', 'golem']",610,True,6,1
Is it possible to UI Test individual Swift UI components?,"<p>I am super new to Swift and SwiftUI and I have started a new project using SwiftUI. I have some experience in other component based libraries for the web and I wanted a way to use the same pattern for iOS development.</p>
<p>Is there a way to ui test individual components in SwiftUI? For example, I have created a Map component that accepts coordinates and renders a map and I want to test this map individually by making the app immediately render the component. Here is my code and test code at the moment:</p>
<pre class=""lang-swift prettyprint-override""><code>// App.swift (main)
// Map is not rendered yet

@main
struct PicksApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

// MyMap.swift
struct MyMap: View {

    @State private var region = MKCoordinateRegion(
        center: CLLocationCoordinate2D(
            latitude: 25.7617,
            longitude: 80.1918
        ),
        span: MKCoordinateSpan(
            latitudeDelta: 10,
            longitudeDelta: 10
        )
    )

    var body: some View {
        Map(coordinateRegion: $region)
    }
}

struct MyMap_Previews: PreviewProvider {
    static var previews: some View {
        MyMap()
    }
}

// MyMapUITests.swift
class MyMapUITests: XCTestCase {
    func testMapExists() throws {
        let app = XCUIApplication()
        app.launch()

        let map = app.maps.element
        XCTAssert(map.exists, &quot;Map does not exist&quot;)
    }
}
</code></pre>
<p>Is it possible to tell UI Test framework to only test one component instead of launching the entire app and making me navigate between each view before I am able to get to my view?</p>
<p>For example, in my case, there is going to be a login view when the app opens for the first time (which is every time from perspective of ui testing) and the map view can be located inside the app somewhere. I want to be able to test only the map view without testing end-to-end user experience.</p>
",https://stackoverflow.com/questions/64959547/is-it-possible-to-ui-test-individual-swift-ui-components,"['ios', 'swift', 'swiftui']",430,True,3,1
How to locate an app to share to in iOS13 share sheet via UI test?,"<p>I am using a UI test to check sharing a file to a target app. For that, I am using <a href=""https://developer.apple.com/videos/play/wwdc2017/409?time=494"" rel=""nofollow noreferrer"">multi-app UI testing</a> as follows:</p>

<ul>
<li>the target app should become active when sharing a given file to it </li>
<li>a helper app <code>UITestsHelper</code>is a simple document-based app template
that installs a file in its container, navigates to it and shares the
file with the target app</li>
</ul>

<p>The problem is that, when the share sheet is opened, there is no meaningful text that I can use to find the cell to share the file to the target app, in this case shown as ""MyApp"".</p>

<p><a href=""https://i.stack.imgur.com/sFJAj.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/sFJAj.png"" alt=""enter image description here""></a></p>

<p>When inspecting the UI hierarchy in the logs, this is the relevant section:</p>

<pre><code>ScrollView, {{0.0, 617.0}, {414.0, 132.0}}
  Cell, {{13.0, 617.0}, {78.0, 118.5}}, label: 'AirDrop'
  Cell, {{106.5, 617.0}, {78.0, 118.5}}, label: 'Nachrichten'
  Cell, {{200.0, 617.0}, {78.0, 118.5}}, label: 'Mail'
  Cell, {{293.5, 617.0}, {78.0, 131.5}}, label: 'Aktivität'
  Cell, {{387.0, 617.0}, {78.0, 131.5}}, label: 'Aktivität'
</code></pre>

<p>As you can see, system apps and services, such as AirDrop, Messages and Mail have a meaningful label (here in German because that's the system language). Third party apps just show with label ""Activity"" (Aktivität in German).</p>

<p>I am blindly tapping on the fourth cell right now, as a way to choose the first non-system app, but I find this extremely fragile.</p>

<p>Is there a more reliable way to share a a file to a target app? </p>
",https://stackoverflow.com/questions/59632977/how-to-locate-an-app-to-share-to-in-ios13-share-sheet-via-ui-test,"['ios', 'ios13', 'xcode-ui-testing', 'xcuitest', 'uitest']",457,False,3,1
How can I replicated this folder setup from GitHubBrowser sample?,"<p>I have been trying to learn more about unit and UI testing. During my progress I stumble upon this famous github <a href=""https://github.com/android/architecture-components-samples/tree/master/GithubBrowserSample"" rel=""nofollow noreferrer"">repo</a> that google uses to sample an app using archicture component. As I am new to all this, I am trying to learn and adapt this repo to my project.</p>

<p>I am stuck on how to set the folder as they do it. I believe I don't have to do exactly as they are doing, but learn how to do it I think it is part of my progress as Android developer.</p>

<p>So, I have few questions:</p>

<p><a href=""https://i.stack.imgur.com/SnoQ7.png"" rel=""nofollow noreferrer"">How can I create a folder like this? I tried several ways, but in the end I dont know how they managed to put a kotlin file inside of it. I cannot add anything there, but they somehow managed to do it.</a></p>

<p><a href=""https://i.stack.imgur.com/kQNB1.png"" rel=""nofollow noreferrer"">How can I add a folder like this? All my attempts have gone wrong, I tried to add a java folder, directory, android resource folder. Nothing worked, I cannot add kotlin files. I would like to know how to make a folder like this</a></p>
",https://stackoverflow.com/questions/59901731/how-can-i-replicated-this-folder-setup-from-githubbrowser-sample,['android-studio'],21,True,0,2
UI Test target does not recognize Swift package from custom framework in xcworkspace,"<p>I am developing several projects in a single workspace (monorepo). The workspace contains a shared framework that contains code shared between the projects. Some of the code depends on external packages that I import using the Swift Package Manager. Everything is working except that the packages aren't recognized when I use the UI testing target. When I run the UI tests for one of the projects it complains that the packages cannot be found (in the framework). Another solution that suits my needs is also welcome. Anyway, I'm using Xcode 11.3. To reproduce:</p>

<ol>
<li>Create a new workspace.</li>
<li>Add a new project A and a new framework B into the workspace.</li>
<li>Add any dependency (for example SDWebImage) to the framework.</li>
<li>Add a Swift-file to the framework that just does <code>import SDWebImage</code>.</li>
<li>Now add framework B as a dependency to project A.</li>
</ol>

<p>If you build project A or unit test project A, there is no problem. However, when you run UI tests on project A it complains that it cannot find the module SDWebImage in the Swift-file you added in point 4 above. Any idea how to solve this?</p>

<p>Edit: When I use Cocoapods instead it gives me the same error. When I use use_frameworks! it doesn't give me the error, but it crashes with ""SDWebImage: image not found"".</p>
",https://stackoverflow.com/questions/62374042/ui-test-target-does-not-recognize-swift-package-from-custom-framework-in-xcworks,"['swift', 'xcode', 'frameworks', 'package']",2284,True,13,1
What would run ExampleUnitTest but not find ExampleInstrumentedTest?,"<p>Android Studio: 3.6.1
Gradle: gradle-5.6.4-all</p>

<p>I am ready to test my app and found that Android Studio produces example unit and instrumented tests. So, I right-click <strong>ExampleUnitTest</strong>, select Run and it runs just fine. However, when I do this for <strong>ExampleInstrumentedTest</strong>, it fails with the following error message:</p>

<p><em>Process finished with exit code 1
Class not found: ""com.example.jbiss.petminder.ExampleInstrumentedTest""</em></p>

<p>However, <strong>ExampleInstrumentedTest</strong> is located in the default <strong>androidTest</strong> path (<strong>...\app\src\androidTest\java\com\example\jbiss\petminder</strong>) and <strong>ExampleUnitTest</strong> is located in the default <strong>test</strong> path (<strong>...\app\src\test\java\com\example\jbiss\petminder</strong>).</p>

<p>While I altered the auto-generated Android Studio source to start experimenting with test coding, that should have nothing to do with the <em>Class not found: ""com.example.jbiss.petminder.ExampleInstrumentedTest""</em> error. Here is my altered code (using the auto-generated <strong>ExampleInstrumentedTest</strong> code as the baseline):</p>

<pre><code>package com.example.jbiss.petminder;

import android.content.Context;

import com.example.jbiss.petminder.activities.MainActivity;

import androidx.test.espresso.accessibility.AccessibilityChecks;
import androidx.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.rule.ActivityTestRule;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.withContentDescription;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
*
* @see &lt;a href=""http://d.android.com/tools/testing""&gt;Testing documentation&lt;/a&gt;
*/
@RunWith(AndroidJUnit4.class)
@SmallTest
public class ExampleInstrumentedTest {

@Before
public void setUp(){
AccessibilityChecks.enable();
}

@Rule
public ActivityTestRule&lt;MainActivity&gt; mMainActivityActivityTestRule =
new ActivityTestRule&lt;&gt;(MainActivity.class);

@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();

assertEquals(""com.example.jbiss.petminder"", appContext.getPackageName());
onView(withId(R.id.action_add_pet)).perform(click()).check(matches(withContentDescription(R.layout.activity_add_pet)));
}
}
</code></pre>

<p>Here is my app's build.gradle file:</p>

<pre><code>apply plugin: 'com.android.application'

android {
compileSdkVersion 28
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
buildToolsVersion '28.0.3'
defaultConfig {
applicationId ""com.example.jbiss.petminder""
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName ""1.0""
testInstrumentationRunner ""android.support.test.runner.AndroidJUnitRunner""
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
encoding ""UTF-8""
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

dataBinding {
enabled = true
}

// Gradle automatically adds 'android.test.runner' as a dependency.
useLibrary 'android.test.runner'

useLibrary 'android.test.base'
useLibrary 'android.test.mock'

testOptions {
unitTests.includeAndroidResources = true
}
}

dependencies {
def nav_version = ""2.3.0-alpha03""

implementation ""android.arch.navigation:navigation-fragment-ktx:1.0.0""
implementation ""android.arch.navigation:navigation-ui-ktx:1.0.0""

// Java language implementation: navigation
implementation ""androidx.navigation:navigation-fragment:$nav_version""
implementation ""androidx.navigation:navigation-ui:$nav_version""

// Dynamic Feature Module Support
implementation ""androidx.navigation:navigation-dynamic-features-fragment:$nav_version""

// Testing Navigation
androidTestImplementation ""androidx.navigation:navigation-testing:$nav_version""

// use -ktx for Kotlin
implementation ""android.arch.navigation:navigation-ui:$nav_version""

// use -ktx for Kotlin

//noinspection GradleCompatible
implementation 'com.android.support:support-v4:28.1.0'
implementation
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.android.support:design:28.1.0'
implementation 'com.android.support:cardview-v7:28.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.android.support:mediarouter-v7:28.1.0'

/**
* directly from https://developer.android.com/topic/libraries/architecture/adding-components#lifecycle
*/
def lifecycle_version = ""2.2.0""
def arch_version = ""2.1.0""
def room_version = ""2.2.4""

// ViewModel
implementation ""androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version""
// LiveData
implementation ""androidx.lifecycle:lifecycle-livedata:$lifecycle_version""
// Lifecycles only (without ViewModel or LiveData)
implementation ""androidx.lifecycle:lifecycle-runtime:$lifecycle_version""

// Saved state module for ViewModel
implementation ""androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version""

// Annotation processor
annotationProcessor ""androidx.lifecycle:lifecycle-compiler:$lifecycle_version""
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation ""androidx.lifecycle:lifecycle-common-java8:$lifecycle_version""

// optional - helpers for implementing LifecycleOwner in a Service
implementation ""androidx.lifecycle:lifecycle-service:$lifecycle_version""

// optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
implementation ""androidx.lifecycle:lifecycle-process:$lifecycle_version""

// optional - ReactiveStreams support for LiveData
implementation ""androidx.lifecycle:lifecycle-reactivestreams:$lifecycle_version""

// optional - Test helpers for LiveData
testImplementation ""androidx.arch.core:core-testing:$arch_version""

implementation ""androidx.lifecycle:lifecycle-reactivestreams:$lifecycle_version""

// optional - Test helpers for LiveData
testImplementation ""androidx.arch.core:core-testing:$arch_version""
implementation ""androidx.room:room-runtime:$room_version""
annotationProcessor ""androidx.room:room-compiler:$room_version""

// use kapt for Kotlin

// optional - RxJava support for Room

//implementation ""androidx.room:room-rxjava2:$room_version""

// optional - Guava support for Room, including Optional and ListenableFuture

//implementation ""androidx.room:room-guava:$room_version""

// Test helpers
testImplementation ""androidx.room:room-testing:$room_version""
testImplementation 'org.testng:testng:6.9.10'

// Required -- JUnit 4 framework
testImplementation 'junit:junit:4.12'
// Optional -- Robolectric environment
testImplementation 'androidx.test:core:1.2.0'
// Optional -- Mockito framework
testImplementation 'org.mockito:mockito-core:2.19.0'
implementation 'androidx.appcompat:appcompat:1.1.0'

implementation 'com.google.api-client:google-api-client:1.30.2'

// Core library
androidTestImplementation 'androidx.test:core:1.2.0'

// AndroidJUnitRunner and JUnit Rules
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'

// Assertions
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.ext:truth:1.2.0'
androidTestImplementation 'com.google.truth:truth:0.42'

// Espresso dependencies
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.2.0'
androidTestImplementation 'androidx.test.espresso.idling:idling-concurrent:3.2.0'

// The following Espresso dependency can be either ""implementation""
// or ""androidTestImplementation"", depending on whether you want the
// dependency to appear on your APK's compile classpath or the test APK
// classpath.
androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.2.0'
// debugImplementation because LeakCanary should only run in debug builds.
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
// Optional -- Hamcrest library
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
// Optional -- UI testing with UI Automator
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'

}

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details -&gt;
def requested = details.requested
if (requested.group == 'com.android.support') {
//if (requested.group == ""androidx"") {
if (!requested.name.startsWith(""multidex"")) {
details.useVersion '25.3.1'
}
}
}
}
</code></pre>

<p>While I might have other problems in my code, what would cause this failure to find an existing <strong>ExampleInstrumentedTest</strong> file with <code>public class ExampleInstrumentedTest{}</code> explicitly stated in that file?</p>

<p>The code seems to be formated as shown in <a href=""https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests"" rel=""nofollow noreferrer"">Build instrumented unit tests</a></p>

<p>The following provided no answer:</p>

<ul>
<li><p><a href=""https://stackoverflow.com/questions/59288305/no-tests-were-found-with-junit-5-and-intellij"">public class ExampleInstrumentedTest</a></p></li>
<li><p><a href=""https://stackoverflow.com/questions/59680668/no-tests-were-found-testng-intellij"">No tests were found - testNG, IntelliJ [duplicate]</a></p></li>
<li><p><a href=""https://stackoverflow.com/questions/59583303/no-tests-were-found-during-android-ui-testing"">“No tests were found” during Android UI Testing</a></p></li>
<li><p><a href=""https://stackoverflow.com/questions/43633432/no-test-were-found"">No test were found</a></p></li>
</ul>
",https://stackoverflow.com/questions/60675812/what-would-run-exampleunittest-but-not-find-exampleinstrumentedtest,"['android', 'unit-testing', 'android-studio', 'junit4', 'instrumented-test']",1936,True,3,3
What is the correct way to open a file from line arguments in an NSDocument application in Swift?,"<p>I'm working on a MacOS Document based application that opens a certain file type. What I want to do is write some UI tests for this application, but I want to load some mock data for these UI tests. From what I understand, I should actually use launchArguments or launchEnvironment variables to load this mock data.</p>

<p>So, it sounds to me like the correct thing to do is create some test data files, and open those files at the launch of the application using something like this:</p>

<pre><code>let app = XCUIApplication()  
app.launchArguments.append(""-url"")  
app.launchArguments.append($PATH)  
app.launch()
</code></pre>

<p>Now my question is, where should I add the code for opening a file during launch? Is there a method that NSDocumentDelegate has that I should override? Should I call <code>openDocument(withContentsOf:display:completionHandler:)</code> or just set the <code>fileURL</code> or something else entirely?</p>

<p>Right now my application opens the last opened file or opens a new document. I could try to override  <code>makeUntitledDocument(ofType typeName: String)</code> or <code>func restoreWindow(withIdentifier identifier: NSUserInterfaceItemIdentifier, state: NSCoder, completionHandler: @escaping (NSWindow?, Error?) -&gt; Void)</code> but I don't feel like either of those is the correct option.</p>

<p>So I guess I have two questions: 1) what is the correct way to pass mock data for UI testing of an NSDocument based application. 2) what is the correct way to open a file on launch of an application using a line argument.</p>
",https://stackoverflow.com/questions/61297236/what-is-the-correct-way-to-open-a-file-from-line-arguments-in-an-nsdocument-appl,"['swift', 'macos', 'xctest', 'nsdocument']",203,True,2,1
Unable to Ignore Block within React Class Components with istanbul ignore next to gain coverage,"<p>I'm writing unit tests for a client's website built with <code>Gatsby</code>. I need to be able to deliver 100% coverage. I am unable to make major edits to the source code, since I didn't build the site nor do I own the code, lest I risk breaking the UI (I'm not doing snapshot or UI testing).</p>
<p>I have been searching for an answer within Github issues, Stack Overflow, etc, and it seems there are recurring peculiarities with the usage of <code>/* istanbul ignore next */</code>.</p>
<p>With Gatsby, you have to check for references to the <code>window</code> for any scripts or Web APIs and conditionally ignore that code if <code>typeof window === 'undefined'</code>, since Gatsby statically generates the site on the server. To add coverage to those statements, branches, functions and lines, I have been able to use <code>/* istanbul ignore next */</code>. However, I am having a rough time with a particular class component.</p>
<p>I have tried using <code>/* istanbul ignore next */</code> before <code>componentDidMount</code> and <code>componentDidUpdate</code>, just inside the lifecycle definitions, between the function name and parentheses, before the <code>if</code> blocks within the lifecycles. I've also tried using <code>/* istanbul ignore if */</code>.</p>
<p>No matter what code I use, I cannot get coverage. I am open to any suggestions here, whether a better approach to using <code>ignore</code> statements or a hint on ways to create tests that would do the trick. Thank you for your help!</p>
<p>Here are uncoverable (thus far) lines of the component:</p>
<p><strong>careers.js</strong></p>
<pre class=""lang-js prettyprint-override""><code>  componentDidMount() {
    this.context.setHeaderTheme(`bright`)
    /* istanbul ignore next */
    if (typeof window !== `undefined` &amp;&amp; typeof document !== `undefined`) {
      if (!window.Grnhse) {
        const script = document.createElement(`script`)
        script.setAttribute(
          `src`,
          `&lt;hidden/path/for/security/purposes&gt;`
        )
        script.setAttribute(`width`, `100%`)
        script.onload = () =&gt; window.Grnhse &amp;&amp; window.Grnhse.Iframe.load()
        document.body.appendChild(script)
      } else {
        if (window.Grnhse) {
          window.Grnhse.Iframe.load()
        }
      }
    }
  }

  componentDidUpdate() {
    /* istanbul ignore next */
    if (
      !this.scrollDone &amp;&amp;
      typeof window !== `undefined` &amp;&amp;
      window.location.search.includes(`gh_jid`) &amp;&amp;
      this.greenhouseContainer
    ) {
      this.scrollDone = true
      window.scrollTo({
        top: this.greenhouseContainer.offsetTop,
        behavior: `smooth`,
      })
    }
  }  
</code></pre>
",https://stackoverflow.com/questions/62493593/unable-to-ignore-block-within-react-class-components-with-istanbul-ignore-next-t,"['reactjs', 'jestjs', 'gatsby', 'react-testing-library', 'istanbul']",2078,True,4,1
Office js update UI after REST call,"<p>I'm working on an Outlook plugin using the office js library. Part of the functionality of the application is to store emails in our cloud platform so they can be related to other data in the system.  In order to make it a one step process we wanted to enable the user to send the email from within of our add-in. I managed to achieve this by calling the item.saveAsync method to save the item as a draft then from the REST API I can call messages/{itemId}/send which successfully sends the email after which I can send the details to our cloud platform.  My only issue is that the Outlook UI (testing outlook.live.com right now) never updates.  I'm hunting around the office js API for a way to trigger the UI to redraw / close the editor etc etc but i'm drawing a blank.  Any help would be appreciated.  </p>

<p>If I can't update the UI is there a better way to get the details of the email after it is sent?  I know the SentItem handler is a possibility but it's my understanding that that is only used for add-ins with no UI and we need the context of the add-in to know what do do with the email information in our cloud platform.  </p>
",https://stackoverflow.com/questions/61664112/office-js-update-ui-after-rest-call,"['office-js', 'outlook-web-addins']",158,True,1,1
Is it possible to add UI test target with default test class programatically in Xcode?,"<p>Upon creating a UI target to the app two files will be created in Xcode.</p>

<blockquote>
  <p><strong>MyAppUITests.swift</strong> and <strong>info.plist</strong></p>
</blockquote>

<p>These both files are placed under the <strong>MyAppUITests</strong> folder.</p>

<p>The swift class has some default test methods to starts with whereas the plist has the settings info of the created UI test. We are then write test cases, write some utility classes etc. The utility classes also saved under the UI test target. The whole setup works fine with ""MyApp"".</p>

<p><strong>Requirement</strong>: I want to give this setup to some other tester/developer who is a newbie. Means, if they want to implement the UI testing in their app, I want to give them a sample setup which will contain the UI test target with some sample test cases and utility methods.</p>

<p><strong>Current flow:</strong> Currently we are having documents regarding the UI test setup, the usage of the written utilities, etc. A person can read those documents and do all the steps manually to setup the UI test environment.</p>

<p>We want to take it to the next level by automate this setup process. Something like, if I keep the sample files in a repo and create a run script that can import the files from repo and add it to the newbie's source code while running. I'm not sure this is possible and I appreciate the suggestions on it. </p>
",https://stackoverflow.com/questions/62185392/is-it-possible-to-add-ui-test-target-with-default-test-class-programatically-in,"['import', 'automated-tests', 'addition', 'setup-project', 'xcuitest']",318,False,0,1
Automation UI tests in a SPA application not waiting for page to load,"<p>We are using and single page application (SPA, which renders client-side) using Vue.js and we have UI automation tests using Selenium. I don't think the fact we are using Vue.js and Selenium is the issue, I think this is a general issue when UI testing with a SPA application.</p>

<p><strong>The problem</strong></p>

<p>The tests are running before the DOM has loaded...</p>

<p>In a SPA, when navigating, the browser does not reload, so the issue lies when the tests think they can run straight away.</p>

<p>In a server-side rendered application (like MVC), the browser reloads when navigating to a different page, only when the browser decides the page has loaded will the tests run.</p>

<p>This is not the case in SPA, the browser in a SPA doesn't (as far as I'm aware) have a way of telling the tests when the page is ready to test.</p>

<p>Can anyone help? I am looking for a solution or an event for the browser to let the tests know when they are ready to run.</p>

<p><strong>Tried solutions</strong></p>

<p>We have hard-coded a timeout for the tests to wait (which works sometimes), but it doesn't guarantee every pipeline build will pass since it's not guaranteed the same load speed each time and doesn't guarentee the page will load before the timeout has expired.</p>
",https://stackoverflow.com/questions/60319745/automation-ui-tests-in-a-spa-application-not-waiting-for-page-to-load,"['selenium', 'vue.js', 'testing', 'single-page-application', 'ui-automation']",242,False,0,0
How can I avoid Thread.sleep in an Android UI test?,"<p>I am creating a user interface test for an Android app. The test taps a UI element and expects another UI element to appear. The test will only pass if I include a <code>Thread.sleep</code> after tapping the first UI element. How can I avoid this?</p>
<p>Here's the test:</p>
<pre><code>@Test
public void mapInfoIsDisplayed() throws InterruptedException {
    
    // Tap on the crosshair at the centre of the map.
    onView(withId(R.id.map_crosshairs)).perform(click());

    Thread.sleep(100); // Why is this required?

    // Verify that the view is displayed
    onView(withId(R.id.feature_title)).check(matches(isCompletelyDisplayed()));
}
</code></pre>
<p>The app is written in RxJava, uses Hilt for dependency injection and Espresso as the UI testing framework.</p>
<p>I want the test dependencies to run synchronously on the main thread so my test uses:</p>
<ol>
<li>the trampoline scheduler for RxJava during tests (executes on the calling thread)</li>
<li>an in-memory Room database which allows queries on the main thread</li>
</ol>
<p>I have also disabled animations through the emulator settings and have also added the following to my <code>build.gradle</code> (although I'm not sure it does anything):</p>
<pre><code>testOptions {
    animationsDisabled = true
}
</code></pre>
<p>With all this I would expect the test to run synchronously, waiting for any dependent threads to finish before testing for whether my the new view is displayed. This doesn't appear to be happening so I'm left with a flaky test.</p>
<p>I have a strong suspicion that the production code is being executed asynchronously somewhere, the problem is I can't pinpoint where (it'd be great if there was some way in Android Studio to find this).</p>
<p>How can I ensure <em>all</em> code is executed synchronously, thus avoiding the <code>Thread.sleep</code>?</p>
",https://stackoverflow.com/questions/63832320/how-can-i-avoid-thread-sleep-in-an-android-ui-test,"['android', 'android-studio', 'rx-java', 'android-espresso', 'android-testing']",798,False,0,0
Finding the accessibility(identifier:) of DatePicker() embedded in a Form in SwiftUI using an XCUIElementQuery,"<p>I have a SwiftUI view that has a Form that contains a DatePicker:</p>
<pre><code>struct GettingUpTimeSettingView: View {
    @State private var viewModel = GettingUpTimeSettingViewModel()
    var body: some View {
        VStack {
            
            Form {
                Spacer()
                Text(viewModel.questionString)
                    .accessibility(identifier: &quot;Question&quot;)
                Spacer()
                DatePicker(&quot;Alarm Time&quot;,
                                     selection: $viewModel.gettingUpTime,
                                     displayedComponents: .hourAndMinute)
                    .accessibility(identifier: &quot;Time&quot;)
                    .animation(.easeInOut)
                Spacer()
                Text(viewModel.explanationString)
                    .accessibility(identifier: &quot;Explanation&quot;)
            }
        }
    }
}
</code></pre>
<p>And an XCTestCase class for UI Testing:</p>
<pre><code>class SleepyGPIntroUITests: XCTestCase {
    
    private var app: XCUIApplication!
    
    override func setUp() {
        continueAfterFailure = false
        app = XCUIApplication()
        app.launch()
        greeting = app.staticTexts[&quot;Greeting&quot;]
    }
    
    override func tearDown() {
        app = nil
    }
    
    func test_InitialScreen_ChangesTo_GettingUpScreen_Automatically() {
        //Given
        let questionText = &quot;What time do you want to get up?&quot;
        let explanationText = &quot;This should be the same time every day, including at weekends and on days off. Our best chance of great sleep comes when we have a regular routine.&quot;
        let timeText = &quot;7:00am&quot;
        let question = app.staticTexts[&quot;Question&quot;]
        let explanation = app.staticTexts[&quot;Explanation&quot;]
        let time = app.staticTexts[&quot;Time&quot;]
        //When
        _ = time.waitForExistence(timeout: 2)
        //Then
        XCTAssertFalse(greeting.exists)
        XCTAssertEqual(question.label, questionText, &quot;Should show question at top of view&quot;)
        XCTAssertEqual(explanation.label, explanationText, &quot;Should show explanation in view&quot;)
        XCTAssertEqual(time.label, timeText, &quot;Should show the correct default time&quot;)
    }
</code></pre>
<p>When I run the test, it fails and gives me this message:</p>
<blockquote>
<p>Failed to get matching snapshot: No matches found for Elements matching predicate '&quot;Time&quot; IN identifiers' from input {(
StaticText, identifier: 'Question', label: 'What time do you want to get up?',
StaticText, identifier: 'Explanation', label: 'This should be the same time every day, including at weekends and on days off. Our best chance of great sleep comes when we have a regular routine.'
)}</p>
</blockquote>
<p>I'm not sure whether this is down to the DatePicker() being contained in a Form, or whether it's because I'm not using the correct XCUIElementQuery to find it?</p>
<p>When I move the DatePicker outside the Form, I can find it, but only by using its label, and not its accessibility identifier.</p>
<p>The accessibility identifiers are working fine for the Text objects.</p>
<p>I can also find it using</p>
<p>app.datePickers.firstMatch</p>
<p>when it's outside the form, but not when it's contained within it.</p>
<p>I've found <a href=""https://stackoverflow.com/questions/58514891/two-buttons-inside-hstack-taking-action-of-each-other/58517085#58517085"">this</a> answer that describes some odd behaviour when SwiftUI objects are contained in forms, but still haven't managed to solve my problem.</p>
<p>Many thanks.</p>
<p><strong>tl:dr</strong> Can't get XCUIElementQuery to return DatePicker element when UITesting if the DatePicker is contained in a SwiftUI Form.</p>
",https://stackoverflow.com/questions/62969645/finding-the-accessibilityidentifier-of-datepicker-embedded-in-a-form-in-swi,"['swiftui', 'xcode-ui-testing']",734,True,0,1
How can I run integration tests on a JNI Android library?,"<p>I need to run integration tests for an Android library that leverages native
code via JNI. This has a few implications:</p>
<ul>
<li>This is a library, and as such has no GUI whatsoever. This means that test
frameworks like Espresso, Appium and the like are of no use, since there's no
GUI to test against.</li>
<li>This gives me some headaches with popular cloud services like App Center and
Firebase Test Lab, as they require both an UI instrumented test apk, written
with one of the supported UI testing frameworks, and an app apk to run these
tests against.</li>
<li>As said, the library contains C code loaded via JNI. Unfortunately, this
excludes the possibility of using Robolectric, since it doesn't support JNI.</li>
</ul>
<p>Now there are a few questions:</p>
<ul>
<li>Are there any Android simulation testing frameworks that support JNI?</li>
<li>Is there a cloud service out there which allows me to simply run a pre-built
Android instrumented unit tests apk, without any UI instrumented test
framework and without an actual app to be tested?</li>
<li>Have I missed a much simpler solution to my problem?</li>
</ul>
<p>The problem with cloud services is that currently I only have an instrumented
unit test apk, which as such has no actual GUI testing. Furthermore, that's the
sole apk I have, since there's no actual Android app to be tested.</p>
<p>I am not aware of any Android mocking test frameworks, like Robolectric, that
support JNI, which is why I am looking into instrumented tests, on real or
emulated Android devices, in the first place.</p>
",https://stackoverflow.com/questions/62897502/how-can-i-run-integration-tests-on-a-jni-android-library,"['android', 'c++', 'testing', 'android-ndk', 'java-native-interface']",178,False,2,0
Handling Basic Authentication in Karate UI scenario,"<p>I have just started implementing karate UI (v0.9.5). Have already implemented api testing using karate and it works perfectly.</p>

<p>Following the HTTP basic auth strategy on this page - <a href=""https://github.com/intuit/karate#http-basic-authentication-example"" rel=""nofollow noreferrer"">https://github.com/intuit/karate#http-basic-authentication-example</a> the basic auth handling works for api tests. I set the HTTP headers once and run all api tests. 
Now for the UI testing, the URL that I open brings up the basic auth pop-up as shown below:</p>

<p><a href=""https://i.stack.imgur.com/TPavN.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/TPavN.png"" alt=""enter image description here""></a></p>

<p>So I thought that I could use the same strategy that I used for api tests to handle this. In the background section of my feature file, i call the feature file that does the authentication and sets headers as below:</p>

<p>The called feature file to set headers (admin-headers.feature). This feature file gets the token after admin user login is performed via karate-config.js. Then assigns the token along with the Base64 encoded basic auth to the headers calling headers.js. The Base64 user and password are being input as maven arguments and read via karate-config variables.</p>

<p>(/admin-headers.feature) </p>

<pre><code>Feature: karate-config.js will perform one time login for admin and
  set the session token for all subsequent requests

  Background:
    * def session = adminAuthInfo.authSession
    * def basic_auth = call read('classpath:basic-auth.js') { username: '#(basicAuthUser)', password: '#(basicAuthPassword)' }
    * configure headers = read('classpath:headers.js')

  Scenario: One-time login for user and set the
    session token in request header
</code></pre>

<p>The js code for returning Auth and Cookie to above feature file (/headers.js).</p>

<pre><code>function() {
    var session = karate.get('session');
    var basic_auth = karate.get('basic_auth');
    if(session){
        return {
            Authorization: basic_auth,
            Cookie: ""SESSION="" + session
        };
    } else {
        return {};
    }
}
</code></pre>

<p>My UI test feature file (/ui-test.feature):</p>

<pre><code>Feature: Login test

  Background:
    # Authorise via api
    * callonce read('classpath:common/headers/admin-headers.feature') 
    * configure driver = { type: 'chrome' }

  Scenario: Test login
    Given driver 'https://test.internal.mysite.com/names'
</code></pre>

<p>Running the above feature file still shows the auth pop-up. </p>

<p>I then tried to set the cookies while I am initialising the driver (which I think is probably not the right way?) as below:</p>

<pre><code>Feature: Login test

  Background:
    # Authorise via api
    * def login = callonce read('classpath:common/headers/admin-headers.feature')
    * def uiCookie = { name: 'SESSION', value: '#(login.userAuthInfo.authSession)', domain: 'test.internal.mysite.com' }
    * configure driver = { type: 'chrome', cookie: '#(uiCookie)' }

  Scenario: Test login
    Given driver 'https://test.internal.mysite.com/names'
</code></pre>

<p>The above also does not work. What is it that I am doing wrong here? the pop-up keeps coming up because the cookie is not set when the driver is initialised and then opens the specified url?</p>

<p>Help is much appreciated.</p>
",https://stackoverflow.com/questions/60333071/handling-basic-authentication-in-karate-ui-scenario,['karate'],4606,True,2,2
How can I build SBTUITestTunnel for a Swift app using Buck?,"<p>I am trying to use <a href=""https://buck.build/"" rel=""nofollow noreferrer"">Buck</a> to include the <a href=""https://github.com/Subito-it/SBTUITestTunnel"" rel=""nofollow noreferrer"">SBTUITestTunnel</a> library in a couple of iOS apps I am working on. This library extends the standard Xcode UI-testing framework to offer additional features such as monitoring network calls. While SBTUITestTunnel is written mostly in Objective-C, The apps I hope to include this library in are written in Swift and use Buck as their build tool. I'd also like to be able to use both Buck and Xcode to execute the tests once I have them written.</p>

<p>Unfortunately, the SBTUITestTunnel <a href=""https://github.com/Subito-it/SBTUITestTunnel/blob/master/Documentation/Installation.md"" rel=""nofollow noreferrer"">Installation</a>/<a href=""https://github.com/Subito-it/SBTUITestTunnel/blob/master/Documentation/Setup.md"" rel=""nofollow noreferrer"">Setup</a>/<a href=""https://github.com/Subito-it/SBTUITestTunnel/blob/master/Documentation/Usage.md"" rel=""nofollow noreferrer"">Usage</a> docs do not seem to provide any guidance on building them with Buck. The repo does include CocoaPods config files, which I have tried to convert to a BUCK file. However, I've been unable to get that working properly after several attempts. I've even tried grabbing the prebuilt <code>.framework</code>s from the build output of the provided <a href=""https://github.com/Subito-it/SBTUITestTunnel/tree/master/Example"" rel=""nofollow noreferrer"">SBTUITestTunnel Example App</a>, but still no luck.</p>

<p>Here are the attempts I've made so far at creating a working BUCK file:</p>

<h1>Attempt 1 - Building as Libraries from Source:</h1>

<h2>Code:</h2>

<pre><code>apple_library(
  name = 'SBTUITestTunnelCommon',
  visibility = ['PUBLIC'],
  swift_version = '5',
  exported_headers = glob([
    'Pod/Common/**/*.h',
  ]),
  srcs = glob([
    'Pod/Common/**/*.swift',
    'Pod/Common/**/*.m',
  ]),
  deps = [
    '//Path/GCDWebServer:GCDWebServer',
  ]
)

apple_library(
  name = 'SBTUITestTunnelClient',
  visibility = ['PUBLIC'],
  swift_version = '5',
  exported_headers = glob([
    'Pod/Client/**/*.h',
  ]),
  srcs = glob([
    'Pod/Client/**/*.swift',
    'Pod/Client/**/*.m',
  ]),
  deps = [
    '//Path/GCDWebServer:GCDWebServer',
    '//Path/SBTUITestTunnel:SBTUITestTunnelCommon',
  ]
)

apple_library(
  name = 'SBTUITestTunnelServer',
  visibility = ['PUBLIC'],
  swift_version = '5',
  exported_headers = glob([
    'Pod/Server/**/*.h',
  ]),
  srcs = glob([
    'Pod/Server/**/*.swift',
    'Pod/Server/**/*.m',
  ]),
  deps = [
    '//Path/GCDWebServer:GCDWebServer',
    '//Path/SBTUITestTunnel:SBTUITestTunnelCommon',
  ]
)
</code></pre>

<h2>Result:</h2>

<p>Buck build completes successfully, but running tests in Buck and trying to build in Xcode both fail due with errors like this one (when trying to run <code>@import SBTUITestTunnelCommon;</code> from a file in the <code>SBTUITestTunnelServer</code> class):</p>

<pre><code>Module 'SBTUITestTunnelCommon' not found
</code></pre>

<h1>Attempt 2 - Building as Frameworks from Source:</h1>

<h2>Code:</h2>

<pre><code>sbt_ui_test_tunnel_common_bundle_name = 'SBTUITestTunnelCommon'
sbt_ui_test_tunnel_common_binary_name = sbt_ui_test_tunnel_common_bundle_name + 'Binary'
sbt_ui_test_tunnel_common_module_name = sbt_ui_test_tunnel_common_bundle_name
sbt_ui_test_tunnel_common_product_name = sbt_ui_test_tunnel_common_bundle_name
# Copied `Info.plist` from the Example app to this Pod folder:
sbt_ui_test_tunnel_common_info_plist = 'Pod/Common/' + sbt_ui_test_tunnel_common_bundle_name + '-Info.plist'

sbt_ui_test_tunnel_client_bundle_name = 'SBTUITestTunnelClient'
sbt_ui_test_tunnel_client_binary_name = sbt_ui_test_tunnel_client_bundle_name + 'Binary'
sbt_ui_test_tunnel_client_module_name = sbt_ui_test_tunnel_client_bundle_name
sbt_ui_test_tunnel_client_product_name = sbt_ui_test_tunnel_client_bundle_name
# Copied `Info.plist` from the Example app to this Pod folder:
sbt_ui_test_tunnel_client_info_plist = 'Pod/Client/' + sbt_ui_test_tunnel_client_bundle_name + '-Info.plist'

sbt_ui_test_tunnel_server_bundle_name = 'SBTUITestTunnelServer'
sbt_ui_test_tunnel_server_binary_name = sbt_ui_test_tunnel_server_bundle_name + 'Binary'
sbt_ui_test_tunnel_server_module_name = sbt_ui_test_tunnel_server_bundle_name
sbt_ui_test_tunnel_server_product_name = sbt_ui_test_tunnel_server_bundle_name
# Copied `Info.plist` from the Example app to this Pod folder:
sbt_ui_test_tunnel_server_info_plist = 'Pod/Server/' + sbt_ui_test_tunnel_server_bundle_name + '-Info.plist'

apple_binary(
  name = sbt_ui_test_tunnel_common_binary_name,
  visibility = ['PUBLIC'],
  module_name = sbt_ui_test_tunnel_common_module_name,
  swift_version = '5',
  linker_flags = [
    '-ObjC', # Have tried with and without this
  ],
  link_style = 'shared',
  exported_headers = glob([
    'Pod/Common/**/*.h',
  ]),
  srcs = glob([
    'Pod/Common/**/*.swift',
    'Pod/Common/**/*.m',
  ]),
  deps = [
    '//Path/GCDWebServer:GCDWebServer',
  ]
)

apple_bundle(
  name = sbt_ui_test_tunnel_common_bundle_name,
  visibility = ['PUBLIC'],
  product_name = sbt_ui_test_tunnel_common_product_name,
  binary = ':' + sbt_ui_test_tunnel_common_binary_name,
  extension = 'framework',
  xcode_product_type = 'com.apple.product-type.framework',
  info_plist = sbt_ui_test_tunnel_common_info_plist,
)

apple_binary(
  name = sbt_ui_test_tunnel_client_binary_name,
  visibility = ['PUBLIC'],
  module_name = sbt_ui_test_tunnel_client_module_name,
  swift_version = '5',
  linker_flags = [
    '-ObjC', # Have tried with and without this
  ],
  link_style = 'shared',
  exported_headers = glob([
    'Pod/Client/**/*.h',
  ]),
  srcs = glob([
    'Pod/Client/**/*.swift',
    'Pod/Client/**/*.m',
  ]),
  deps = [
    '//Path/GCDWebServer:GCDWebServer',
    '//Path/SBTUITestTunnel:' + sbt_ui_test_tunnel_common_binary_name,
  ]
)

apple_bundle(
  name = sbt_ui_test_tunnel_client_bundle_name,
  visibility = ['PUBLIC'],
  product_name = sbt_ui_test_tunnel_client_product_name,
  binary = ':' + sbt_ui_test_tunnel_client_binary_name,
  extension = 'framework',
  xcode_product_type = 'com.apple.product-type.framework',
  info_plist = sbt_ui_test_tunnel_client_info_plist,
)

apple_binary(
  name = sbt_ui_test_tunnel_server_binary_name,
  visibility = ['PUBLIC'],
  module_name = sbt_ui_test_tunnel_server_module_name,
  swift_version = '5',
enter code here
  linker_flags = [
    '-ObjC', # Have tried with and without this
  ],
  link_style = 'shared',
  exported_headers = glob([
    'Pod/Server/**/*.h',
  ]),
  srcs = glob([
    'Pod/Server/**/*.swift',
    'Pod/Server/**/*.m',
  ]),
  deps = [
    '//Path/GCDWebServer:GCDWebServer',
    '//Path/SBTUITestTunnel:' + sbt_ui_test_tunnel_common_binary_name,
  ]
)

apple_bundle(
  name = sbt_ui_test_tunnel_server_bundle_name,
  visibility = ['PUBLIC'],
  product_name = sbt_ui_test_tunnel_server_product_name,
  binary = ':' + sbt_ui_test_tunnel_server_binary_name,
  extension = 'framework',
  xcode_product_type = 'com.apple.product-type.framework',
  info_plist = sbt_ui_test_tunnel_server_info_plist,
)
</code></pre>

<h2>Result:</h2>

<p>Buck build fails with this error message:</p>

<pre><code>Command failed with exit code 1.
stderr: ld: warning: -sdk_version and -platform_version are not compatible, ignoring - 
sdk_version
Undefined symbols for architecture x86_64:
  ""_main"", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
</code></pre>

<h1>Attempt 3 - Building as <code>prebuilt_apple_framework</code>s:</h1>

<h2>Code:</h2>

<pre><code>sbt_ui_test_tunnel_common_framework_name = 'SBTUITestTunnelCommon'
# Copied .framework file from build output of the Example app to this Frameworks folder:
sbt_ui_test_tunnel_common_framework_path = 'Frameworks/' + sbt_ui_test_tunnel_common_framework_name + '/' + sbt_ui_test_tunnel_common_framework_name + '.framework'

sbt_ui_test_tunnel_client_framework_name = 'SBTUITestTunnelClient'
# Copied .framework file from build output of the Example app to this Frameworks folder:
sbt_ui_test_tunnel_client_framework_path = 'Frameworks/' + sbt_ui_test_tunnel_common_framework_name + '/' + sbt_ui_test_tunnel_common_framework_name + '.framework'

sbt_ui_test_tunnel_server_framework_name = 'SBTUITestTunnelServer'
# Copied .framework file from build output of the Example app to this Frameworks folder:
sbt_ui_test_tunnel_server_framework_path = 'Frameworks/' + sbt_ui_test_tunnel_common_framework_name + '/' + sbt_ui_test_tunnel_common_framework_name + '.framework'

prebuilt_apple_framework(
  name = sbt_ui_test_tunnel_common_framework_name,
  framework = sbt_ui_test_tunnel_common_framework_path,
  preferred_linkage = 'stat',
  visibility = [
    'PUBLIC'
  ],
  deps = [
    '//Path/GCDWebServer:GCDWebServer',
  ],
)

prebuilt_apple_framework(
  name = sbt_ui_test_tunnel_client_framework_name,
  framework = sbt_ui_test_tunnel_client_framework_path,
  preferred_linkage = 'shared',
  visibility = [
    'PUBLIC'
  ],
  deps = [
    '//Path/GCDWebServer:GCDWebServer',
    '//Path/SBTUITestTunnel:' + sbt_ui_test_tunnel_common_framework_name,
  ],
)

prebuilt_apple_framework(
  name = sbt_ui_test_tunnel_server_framework_name,
  framework = sbt_ui_test_tunnel_server_framework_path,
  preferred_linkage = 'shared',
  visibility = [
    'PUBLIC'
  ],
  deps = [
    '//Path/GCDWebServer:GCDWebServer',
    '//Path/SBTUITestTunnel:' + sbt_ui_test_tunnel_common_framework_name,
  ],
)
</code></pre>

<h2>Result:</h2>

<p>Buck build fails with this error message:</p>

<pre><code>Command failed with exit code 1.
stderr: /Users/me/path/BridgingHeader.h:12:9: error: 'SBTUITestTunnelServer/SBTUITestTunnelServer.h' file not found
#import &lt;SBTUITestTunnelServer/SBTUITestTunnelServer.h&gt;
        ^
&lt;unknown&gt;:0: error: failed to import bridging header 'path/BridgingHeader.h'
</code></pre>

<h1>Additional Notes:</h1>

<ul>
<li><p>I've followed all steps in the docs, including setting the <code>DEBUG</code>/<code>DEBUG=1</code> settings and adding the necessary dependencies in the <code>BridgingHeaders.h</code> files like so:</p>

<ul>
<li><p>In the Bridging Header file for the library that is to be tested:</p>

<pre><code>#import &lt;SBTUITestTunnelCommon/SBTUITestTunnelCommon.h&gt;
#import &lt;SBTUITestTunnelServer/SBTUITestTunnelServer.h&gt;
</code></pre></li>
<li><p>And in the Bridging Header file for the library that has the tests:</p>

<pre><code>#import &lt;SBTUITestTunnelClient/SBTUITunneledApplication.h&gt;
#import &lt;SBTUITestTunnelClient/XCTestCase+AppExtension.h&gt;
#import &lt;SBTUITestTunnelCommon/SBTUITestTunnelCommon.h&gt; // Have tried with and without this line
</code></pre></li>
</ul></li>
<li><p>I included the SBTUITestTunnel libraries/frameworks as dependencies in my main app's BUCK file like this:</p>

<pre><code>    apple_library(
      ...
      bridging_header = 'BridgingHeader.h',
      deps = [
        '//Path/SBTUITestTunnel:SBTUITestTunnelCommon',
        '//Path/SBTUITestTunnel:SBTUITestTunnelServer',
        '//Path/GCDWebServer:GCDWebServer',
      ]
    )

    apple_test(
      ...
      bridging_header = 'UITests/BridgingHeader.h',
      deps = [
        '//Path/SBTUITestTunnel:SBTUITestTunnelClient',
      ]
    )
</code></pre></li>
<li><p>SBTUITestTunnel depends on another library, <a href=""https://github.com/swisspol/GCDWebServer"" rel=""nofollow noreferrer"">GCDWebServer</a>, which also does not provide a BUCK file. However, I have been able to get that one working with using this:</p>

<pre><code>apple_library(
  name = 'GCDWebServer',
  visibility = ['PUBLIC'],
  swift_version = '5',
  exported_headers = glob([
    'GCDWebServer/**/*.h',
  ]),
  srcs = glob([
    'GCDWebServer/**/*.swift',
    'GCDWebServer/**/*.m',
  ])
)

apple_library(
  name = 'GCDWebDAVServer',
  visibility = ['PUBLIC'],
  swift_version = '5',
  exported_headers = glob([
    'GCDWebDAVServer/**/*.h',
  ]),
  srcs = glob([
    'GCDWebDAVServer/*.swift',
    'GCDWebDAVServer/*.m',
  ]),
  deps = [
    '//Path/GCDWebServer:GCDWebServer',
  ]
)

apple_library(
  name = 'GCDWebUploader',
  visibility = ['PUBLIC'],
  swift_version = '5',
  exported_headers = glob([
    'GCDWebUploader/**/*.h',
  ]),
  srcs = glob([
    'GCDWebUploader/**/*.swift',
    'GCDWebUploader/**/*.m',
  ]),
  deps = [
    '//Path/GCDWebServer:GCDWebServer',
  ]
)
</code></pre></li>
</ul>

<p>Any idea what I am doing wrong? Or at least maybe some advice on which of these options is most likely the best path?</p>
",https://stackoverflow.com/questions/61138705/how-can-i-build-sbtuitesttunnel-for-a-swift-app-using-buck,"['ios', 'swift', 'xcode-ui-testing', 'buck']",456,False,2,0
How to drag and drop an external item for Xcode-ui-testing,"<p>In my application I allow the user to drag and drop items from Finder (or any other source of a file based URL) into my application. What I want to do is to add a mechanism that will allow me to test this in the Xcode UI testing.</p>
<p>I can see how to use <code>XCUIElement.press(forDuration:thenDragTo:)</code> to test the drag and drop of a source and destination within the application, but I have been unable to find a way to test when the source of the drag is outside of the application.</p>
<p>In a somewhat related test, I test the copy and paste portion of the application by setting the string I want to paste into <code>NSPasteboard.general</code>, then using <code>XCUIElement.typeKey(&quot;v&quot;, modifierFlags: .command)</code> to paste it into the desired element. That is a little less than ideal as it depends on Command-v actually being implemented as the paste command, but that is unlikely to change so it is acceptable for my needs. (In fact I've written an <code>XCUIElement.paste(_ s: String)</code> extension that makes it easy for me to add this in a test.)</p>
<p>I believe that drag and drop is also using an <code>NSPasteboard</code> for its communications, so with a little investigation into the underlying mechanism, I should be able to set my object into the correct pasteboard just like I do for the cut and paste. I'm reasonably certain I can figure that part out. But I haven't figured out how to perform the actual drop.</p>
<p>My goal would be to create an <code>XCUIElement.drop(_ url)</code> that would setup the proper &quot;public.file-url&quot; object into the correct pasteboard, and then simulate/perform the drop into the element.</p>
<p>Any ideas?</p>
<p>I should note that I have already tried the following two items:</p>
<p>First, I did use the Xcode record feature to attempt to record the drag and drop operation and see what events it would give me. Unfortunately, it records absolutely nothing.</p>
<p>Second, I do have a menu based alternative where the user selects a file via the file selector. So if I could simulate the file selection, that would be a suitable testing alternative for my purposes. Unfortunately, I didn't make any progress along that path either. When I used Xcode to record the events, it recorded the menu selection, nothing that was actually done in the dialog.</p>
",https://stackoverflow.com/questions/62884594/how-to-drag-and-drop-an-external-item-for-xcode-ui-testing,"['swift', 'xcode', 'drag-and-drop', 'xcuitest']",537,True,1,2
XCUITest: How to jump into app code? How to modify the state of the app under test?,"<p>Coming from an Android/Espresso background, I am still struggling with XCUITest and UI testing for iOS.
My question is about two related but distinct issues:</p>

<ol>
<li>How to compile and link against sources of the app under test?</li>
<li>How to jump into methods of the app under test and modify its state at runtime?</li>
</ol>

<p>To tackle these questions, we should first understand the differences between XCode's ""unit test targets"" and ""UI test targets"".</p>

<ul>
<li><p>XCUITests run inside a completely separate process and cannot jump into methods of the app under test. Moreover, by default, XCUITests are not linked against any sources of the app under test.</p></li>
<li><p>In contrast, XCode's unit tests are linked against the app sources. There is also the option to do ""@testable imports"". In theory, this means that unit tests can jump into arbitrary app code. However, unit tests do not run against the actual app. Instead, unit tests run against a stripped-down version of the iOS SDK without any UI. </p></li>
</ul>

<p>Now there are different workarounds for these constraints:</p>

<ul>
<li><p>Add some selected source files to a UI test target. This does not enable to call into the app, but at least it enables to share selected code between app and UI tests.</p></li>
<li><p>Pass launch arguments via <code>CommandLine.arguments</code> from the UI tests to the app under test. This enables to apply test-specific configurations to the app under test. However, those launch arguments need to be parsed and interpreted by the app, which leads to a pollution of the app with testing code. Moreover, launch arguments are only a non-interactive way to change the behavior of the app under test.</p></li>
<li><p>Implement a ""debug UI"" that is only accessible for XCUITest. Again, this has the drawback of polluting app code.</p></li>
</ul>

<p>This leads to my concluding questions:</p>

<ul>
<li><p>Which alternative methods exist to make XCUI tests more powerful/dynamic/flexible?</p></li>
<li><p>Can I compile and link UI tests against the entire app source and all pod dependencies, instead of only a few selected files?</p></li>
<li><p>Is it possible to gain the power of Android's instrumented tests + Espresso, where we can perform arbitrary state modifications on the app under test?</p></li>
</ul>

<h1>Why We Need This</h1>

<p>In response to @theMikeSwan, I would like to clarify my stance on UI test architecture.</p>

<blockquote>
  <p>UI Tests should not need to link to app code, they are designed to
  simulate a user tapping away inside your app. If you were to jump into
  the app code during these tests you would no longer be testing what
  your app does in the the real world you would be testing what it does
  when manipulated in a way no user ever could. UI tests should not have
  any need of any app code any more than a user does.</p>
</blockquote>

<p>I agree that manipulating the app in such a way is an anti-pattern that should be only used in rare situations.
However, I have a very different stance on what should be possible.
In my view, the right approach for UI tests is not black-box testing but gray-box testing. Although we want UI tests to be as black-boxy as possible, there are situations where we want to dig deep into implementation details of the app under test.
Just to give you a few examples:</p>

<ul>
<li><p><strong>Extensibility:</strong> No UI testing framework can provide an API for each and every use case. Project requirements are different and there are times where we want to write our own function to modify the app state.</p></li>
<li><p><strong>Internal state assertions:</strong> I want to be able to write custom assertions for the state of the app (assertions that do not only rely on the UI). In my current Android project, we had a notoriously broken subsystem. I asserted this subsystem with custom methods to guard against regression bugs.</p></li>
<li><p><strong>Shared mock objects:</strong> In my current Android project, we have custom hardware that is not available for UI tests. We replaced this hardware with mock objects. We run assertions on those mock objects right from the UI tests. These assertions work seamlessly via shared memory. Moreover, I do not want to pollute the app code with all the mock implementations.</p></li>
<li><p><strong>Keep test data outside:</strong> In my current Android project, we load test data from JUnit right into the app. With XCUITest's command line arguments, this would be way more limited.</p></li>
<li><p><strong>Custom synchronization mechanisms:</strong> In my current Android project, we have wrapper classes around multithreading infrastructure to synchronize our UI tests with background tasks. This synchronization is hard to achieve without shared memory (e.g. Espresso IdlingResources).</p></li>
<li><p><strong>Trivial code sharing:</strong> In my current iOS project, I share a simple definition file for the aforementioned launch arguments. This enables to pass launch arguments in a typesafe way without duplicating string literals. Although this is a minor use case, it still shows that selected code sharing can be valuable.</p></li>
</ul>

<blockquote>
  <p>For UI tests you shouldn't have to pollute your app code too much. You
  could use a single command line argument to indicate UI tests are
  running and use that to load up some test data, login a test user, or
  pick a testing endpoint for network calls. With good architecture you
  will only need to make the adjustment once when the app first launches
  with the rest of your code oblivious that it is using test data (much
  like if you have a development environment and a production
  environment that you switch between for network calls).</p>
</blockquote>

<p>This is exactly the thing that I am doing in my current iOS project, and this is exactly the thing that I want to avoid.
Although a good architecture can avoid too much havoc, it is still a pollution of the app code. Moreover, this does not solve any of the use cases that I highlighted above.
By proposing such a solution, you essentially admit that radical black-box testing is inferior to gray-box testing.
As in many parts of life, a differentiated view is better than a radical ""<em>use only the tools that we give you, you should not need to do this</em>"".</p>
",https://stackoverflow.com/questions/59898746/xcuitest-how-to-jump-into-app-code-how-to-modify-the-state-of-the-app-under-te,"['ios', 'xcode', 'integration-testing', 'xctest', 'xcuitest']",2932,True,5,5
How can I get Xcode to find elements inside a webview for a hybrid app?,"<p>I’m an SDET on my current position, and I’ve been asked to research whether it’s possible to use Xcode and XCUITest to automate UI testing of a hybrid app. We have one we’re building internally that has a native wrapper around other apps being pulled in as cocoapods. One of these apps is webview-based and that’s the one causing me problems.</p>

<p>I’m comfortable using Xcode and Swift to write UI automation in general, and I’m comfortable using the debugger to analyze an app’s element hierarchy. For this app in particular, however, I am not able to see the elements that are descendants of the webview.</p>

<p>All I get, when I do a po commmand in the debugger, is a block that looks like this:</p>

<pre><code>WebView, 0x600002d6c000, {{0.0, 82.0}, {1024.0, 1284.0}}
    WebView, 0x600002d6c0e0, {{0.0, 82.0}, {1024.0, 1284.0}}
        WebView, 0x600002d6c1c0, {{0.0, 82.0}, {1024.0, 1284.0}}
        Other, 0x600002d6c2a0, {{991.0, 87.5}, {30.0, 1267.5}}, label: 'Vertical scroll bar, 2 pages', value: 0%
        Other, 0x600002d6c380, {{11.0, 1333.0}, {1002.0, 30.0}}, label: 'Horizontal scroll bar, 1 page', value: 0%
</code></pre>

<p>And that’s only useful up to the point of letting me verify that the webview loaded. It doesn’t let me verify anything actually IN it.</p>

<p>Now, I also know from googling that at this point, assuming I’m running my app in a simulator, I can go open Safari and see the source code of the webview. I can confirm this works for me. However, that doesn’t actually tell me whether it’s possible for me to access the webview’s elements from XCUITest automation, and if so, how I need to refer to them. Since I can’t actually see them in my debugger, it’s very difficult for me to actually reach them. Trying to do a UI Recorder session doesn’t work, as the UI Recorder can’t acknowledge the presence of the elements either.</p>

<p>One last thing I also know from googling is that the vast majority of pages I’ve found, including ones right here on Stack Overflow, talk about doing webview-based automation in Appium. However, what I’ve been specifically asked to do is see whether it’s possible in XCUITest in particular.</p>

<p>So my overall question here is: <em>is</em> it possible? Is there something I’m missing here in terms of how to get at the webview’s descendants?</p>

<p>I’ve seen discussion of Appium needing to switch “contexts” from a native to a webview context, but I am not finding any references to an equivalent concept in the realm of XCUITest. And I am coming up completely dry in any other useful data.</p>

<p>Editing to add a quick followup remark:</p>

<p>I just did a search on the Apple developer forums, and I see a comment there from someone which may in fact be the root of my problem. They say:</p>

<blockquote>
  <p>Same problem here, seems like on ios: 13.3 Webview element is empty :/ while on iOS 13.1 and 13.2 Webview comes with all the elements inside Wbview, any help ?</p>
</blockquote>

<p><a href=""https://forums.developer.apple.com/message/402040#402040"" rel=""nofollow noreferrer"">Source link</a> for this comment for those of you who are in the Apple developer program.</p>

<p>So with this addition in mind, can anyone confirm whether I’ve actually tripped across an Xcode feature change or bug here?</p>

<p>One more edit to add the details on my development environment, as they’re relevant to the question:</p>

<ul>
<li>Mac is running latest release of Catalina, 10.15.2</li>
<li>My Xcode is 11.3.1</li>
<li>I’m testing against simulators as well as a physical device running iPadOS 13.3, though I’m also about to see if the problem repros against 13.2</li>
</ul>

<p>Thanks in advance for any assistance!</p>
",https://stackoverflow.com/questions/59904130/how-can-i-get-xcode-to-find-elements-inside-a-webview-for-a-hybrid-app,"['swift', 'xcode', 'webview', 'wkwebview', 'xcuitest']",1046,True,3,1
