title,body,link,tags,view_count,is_answered,score,answer_count
iOS Webview UI Testing,"<p>Unable to access UI elements during UI testing of an iOS application based on ionic framework. For instance, I would like to tap the button with the label ""home Home"".</p>

<p>Below is my debugDescription of the app showing the element hierarchy.</p>

<pre><code>Element subtree:

 →Application, 0x600000398bb0, pid: 18354, {{0.0, 0.0}, {414.0, 736.0}},    label: 'FastlaneHelper'
  Window, 0x6000003998b0, Main Window, {{0.0, 0.0}, {414.0, 736.0}}
  Other, 0x600000398c80, traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
    Other, 0x600000398d50, traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
      WebView, 0x600000398e20, traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
        Other, 0x600000398ef0, traits: 35192962023424, {{0.0, 0.0}, {414.0, 736.0}}
          Other, 0x600000398fc0, {{0.0, 0.0}, {0.0, 0.0}}
            Other, 0x600000399090, {{0.0, 0.0}, {0.0, 0.0}}
              Other, 0x600000380750, traits: 146029019136, {{0.0, 0.0}, {414.0, 736.0}}
                Other, 0x600000399230, traits: 146029019136, {{0.0, 0.0}, {414.0, 736.0}}, label: 'Ionic App'
                  Other, 0x6000003994a0, traits: 146029019136, {{0.0, 686.0}, {414.0, 51.0}}
                    Button, 0x6000003997e0, traits: 146297454600, {{0.0, 687.0}, {138.0, 49.0}}, label: 'home Home'
                    Button, 0x600000399640, traits: 146297454592, {{138.0, 687.0}, {138.0, 49.0}}, label: 'information circle-outline About'
                    Button, 0x600000399710, traits: 146297454592, {{276.0, 687.0}, {138.0, 49.0}}, label: 'contacts outline Contact'
                  Other, 0x600000399570, traits: 146029019136, {{0.0, 0.0}, {414.0, 736.0}}, label: 'home Home, tab panel'
                    Other, 0x600000399300, traits: 146029019136, {{90.0, 30.0}, {234.0, 23.0}}
                      StaticText, 0x6000003993d0, traits: 146029019200, {{183.0, 30.0}, {48.0, 23.0}}, label: 'Home'
                    Other, 0x6000003809c0, traits: 146029084672, {{16.0, 77.0}, {382.0, 28.0}}, label: 'Welcome to Ionic!', value: 2
                      StaticText, 0x6000003808f0, traits: 146029084736, {{16.0, 76.0}, {190.0, 29.0}}, label: 'Welcome to Ionic!', value: 2
                    Other, 0x600000380b60, traits: 146029019136, {{16.0, 119.0}, {382.0, 36.0}}
                      StaticText, 0x600000380a90, traits: 146029019200, {{16.0, 119.0}, {368.0, 36.0}}, label: 'This starter project comes with simple tabs-based layout for apps that are going to primarily use a Tabbed UI.'
                    Other, 0x600000380680, traits: 146029019136, {{16.0, 169.0}, {382.0, 36.0}}
                      StaticText, 0x600000380820, traits: 146029019200, {{16.0, 169.0}, {117.0, 18.0}}, label: 'Take a look at the'
                      Other, 0x600000399160, traits: 146029019136, {{133.0, 172.0}, {84.0, 15.0}}
                        StaticText, 0x6000003805b0, traits: 146029019200, {{132.0, 172.0}, {85.0, 15.0}}, label: 'src/pages/'
                      StaticText, 0x600000399a50, traits: 146029019200, {{16.0, 169.0}, {377.0, 36.0}}, label: 'directory to add or change tabs, update any existing page or create new pages.'
    ScrollView, 0x60000039b790, traits: 8589934592, {{0.0, 0.0}, {414.0, 736.0}}
Window, 0x60000039b860, {{0.0, 0.0}, {414.0, 736.0}}
  StatusBar, 0x60000039b930, {{0.0, 0.0}, {414.0, 20.0}}
    Other, 0x60000039ba00, {{0.0, 0.0}, {414.0, 20.0}}
    Other, 0x60000039bad0, {{0.0, 0.0}, {414.0, 20.0}}
      Other, 0x60000039bc70, traits: 8388608, {{6.0, 0.0}, {39.0, 20.0}}
      Other, 0x60000039bd40, traits: 8388608, {{50.0, 0.0}, {14.0, 20.0}}, label: '3 of 3 Wi-Fi bars', value: SSID
      Other, 0x60000039be10, traits: 8389120, {{181.0, 0.0}, {56.0, 20.0}}, label: '12:32 AM'
      Other, 0x60000039bee0, traits: 8388608, {{383.0, 0.0}, {26.0, 20.0}}, label: '87% battery power'
</code></pre>

<p>I tried accessing the element these ways with no success:</p>

<pre><code>let app = XCUIApplication()
let tabs = app.tabBars
tabBars.buttons[""Home""].tap()

let app = XCUIApplication()
let tabs = app.windows.tabBars
tabBars.buttons[""Home""].tap()

let app = XCUIApplication()
let tabs = app.windows.webViews.tabBars
tabBars.buttons[""Home""].tap()
</code></pre>

<p>Even tried including ""Other"" elements from the element hierarchy, but the test failed. Can anyone please help us with the issue? </p>
",https://stackoverflow.com/questions/51050914/ios-webview-ui-testing,"['ios', 'xcode', 'ionic-framework', 'wkwebview', 'xcode-ui-testing']",2941,TRUE,0,1
UIPicker not selectable while UI Testing,"<p>I'm trying to create a test for a flow in my app that includes two UIPickerView and I'm unable to select them while running in the ""record"" mode of Xcode. Also if I check the count of datePickers, pickers or pickerWheels I always get back 0. Any idea of what can be causing this issue?</p>
",https://stackoverflow.com/questions/50905815/uipicker-not-selectable-while-ui-testing,"['ios', 'swift', 'xcode', 'xcode-ui-testing']",189,TRUE,4,1
UI Testing if a button is enabled,"<p>I want to check if a <code>Button</code> is disabled in my UI test.</p>

<p>In Android you would normally do something like this:</p>

<pre><code>onView(withId(R.id.buttonId)).check(matches(not(isEnabled())));
</code></pre>

<p>What is the equivalent when writing a UI test for Flutter?</p>
",https://stackoverflow.com/questions/50085766/ui-testing-if-a-button-is-enabled,"['dart', 'flutter']",4279,TRUE,10,1
Asynchronous UI Testing in Xcode With Swift,"<p>I am writing an app that makes plenty of network requests. As usual they are 
async, i.e. the call of the request method returns immediately and the result 
is delivered via a delegate method or in a closure after some delay. 
Now on my registration screen I sent a register request to my backend and 
want to verify that the success UI is shown when the request finishes.</p>

<p>Which options are out there to wait for the request to finish, verify the 
success UI and only after that leave the test method? </p>

<p>Also are there any more clever options than waiting for the request to finish?</p>

<p>Thanks in advance!</p>
",https://stackoverflow.com/questions/48937713/asynchronous-ui-testing-in-xcode-with-swift,"['ios', 'swift', 'xcode', 'unit-testing', 'testing']",4640,TRUE,4,1
Xcode swift UI Testing compare two screenshots,"<p>Basically what I have is a list of items and i can create a new item in that list using a button.</p>

<p>Now I want to test whether the item is added in the list when button is clicked or not.</p>

<p>While creating a test case for this, i thought of taking screenshots before and after tapping button and comparing them to know if item is added. But now i am stuck as how to compare two screenshots.</p>

<p>PS: List is complex and items may contain different data.</p>

<pre><code>private func takeScreenshot() -&gt; XCUIScreenshot{
    return XCUIScreen.main.screenshot()
}


private func testElements(){
    let app = XCUIApplication()
    app.buttons[""List Items""].tap()
    app.tables[""OuterTable""].cells.allElementsBoundByIndex.first?.tap()
    let createBar = app.otherElements[""createBar""]
    let button = app.buttons[""CreateButton""]
    let initialScreenshot = takeScreenshot()
    button.tap()
    let newScreenshot = takeScreenshot()
    //Compare initialScreenshot and new Screenshot
}
</code></pre>

<p>PS: List is displayed in bottom up manner just like you see chats new items would be added at bottom.</p>
",https://stackoverflow.com/questions/52079759/xcode-swift-ui-testing-compare-two-screenshots,"['swift', 'xcode-ui-testing', 'xcuiscreenshot']",2437,TRUE,4,2
Auto grant permissions for Espresso UI Testing,"<p>I'm trying to avoid having to manually grant permissions on every single UI test built with Espresso. </p>

<p>I have tried:</p>

<pre><code> @Rule
    public GrantPermissionRule permissionRule = GrantPermissionRule.grant(
            android.Manifest.permission.INTERNET,
            android.Manifest.permission.READ_PHONE_STATE,
            android.Manifest.permission.ACCESS_NETWORK_STATE,
            android.Manifest.permission.ACCESS_FINE_LOCATION.....)
</code></pre>

<p>and</p>

<pre><code> @Before
    public void grantPhonePermission()
        {
            if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M)
                {
                    getInstrumentation().getUiAutomation().executeShellCommand(
                            ""pm grant "" + getTargetContext().getPackageName()
                                    + "" android.permission.ACCESS_FINE_LOCATION"");
                }
        }
</code></pre>

<p>And here's most of my gradle file :</p>

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

android {
compileSdkVersion 24
buildToolsVersion '26.0.2'
defaultConfig {
    minSdkVersion 14
    targetSdkVersion 23
    testInstrumentationRunner 
'android.support.test.runner.AndroidJUnitRunner'
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.txt'
        debuggable false
        jniDebuggable false
        buildConfigField ""boolean"", ""UseProduction"", ""true""
    }
    qa {
        initWith debug
        debuggable true
        applicationIdSuffix "".qa"" 
        buildConfigField ""boolean"", ""UseProduction"", ""false""
    }
    debug {
        debuggable true
        testCoverageEnabled = false
        buildConfigField ""boolean"", ""UseProduction"", ""true""
    }

}

flavorDimensions ""standard""

productFlavors {
    standard
            {
                buildConfigField ""boolean"", ""ChinaBuild"", ""false""
                buildConfigField ""boolean"", ""YTOBuild"", ""false""
            }
   ....
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
    main {
        java.srcDirs = ['src/main/java']
    }
}


dependencies {
implementation 'com.android.support:support-v4:24.2.1'
implementation 'com.android.support:appcompat-v7:24.2.1'
implementation 'com.android.support:design:24.2.1'
implementation 'com.android.support:recyclerview-v7:24.2.1'
implementation 'com.android.support:percent:24.2.1'
implementation 'com.google.firebase:firebase-messaging:10.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso- 
core:3.0.2'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
androidTestImplementation 'org.mockito:mockito-core:2.+'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
}
</code></pre>

<p>None of it works.
As you can see I'm targeting API 23 so <code>GrantPermissionRule</code> should work. Any ideas? I've been stuck on this for 3 days. :(</p>

<p>It looks like my post is mostly code, I should add more details... But not sure what more needs to be said.</p>
",https://stackoverflow.com/questions/50856546/auto-grant-permissions-for-espresso-ui-testing,"['java', 'android', 'android-permissions', 'android-espresso']",3247,TRUE,4,2
Edit recorded element in Xcode UI Testing,"<p>After recording a UI test, Xcode produces test code with the values it has recorded. In Xcode 9 some of these are highlighted in blue and don't appear to be editable:</p>
<p><a href=""https://i.stack.imgur.com/ai2Rv.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/ai2Rv.png"" alt=""Xcode UI test lines"" /></a></p>
<p>I would like to be able to copy/paste/modify these values without manually retyping them. Is there a way to do this?</p>
",https://stackoverflow.com/questions/48852835/edit-recorded-element-in-xcode-ui-testing,"['swift', 'xcode', 'xctest', 'xcode-ui-testing', 'xcuitest']",266,TRUE,3,1
IOS UI Testing issue for Logout scenario,"<p>I am facing an issue while writing UI test cases for IOS using XCTest framework.<br>
Consider a 3 step signup process and 3 test cases for each step. And for running each test case, it requires the user to be logged out. So, I have written the code as</p>

<pre><code>test1(){
    //some code here for step 1
}

test2(){
    test1()
    //some code here for step 2
}

test3(){
    test2()
    //some code here for step 3
}
</code></pre>

<p>This works fine while running the test cases individually. But when running it collectively, the first test runs successfully but the second test fails, as it requires the registered user to logged out before running the text. 
Now to solve this, I write the code as follows :</p>

<pre><code>test1(){
    //some code here for step 1
    //logout code
}

test2(){
    test1()
    //some code here for step 2
    //logout code
}

test3(){
    test2()
    //some code here for step 3
    //logout code
}
</code></pre>

<p>Now the issue is, while running the second test case, it calls the first function which logs out the user and we cannot reuse the code. 
Any better way to do this?</p>
",https://stackoverflow.com/questions/48948359/ios-ui-testing-issue-for-logout-scenario,"['xctest', 'xcode-ui-testing', 'ios-ui-automation']",339,TRUE,1,2
Appropriate way for ui testing in android,"<p>I'm a beginner in ui test. At first step my ui test, tests the app from beginning to the end non-stop with using all features, after that test finishes.</p>

<p>But I think there must be a more convenient way, for example testing all activities at seperate tests etc.</p>

<p>How should I do?</p>
",https://stackoverflow.com/questions/50023361/appropriate-way-for-ui-testing-in-android,"['android', 'android-studio', 'android-espresso']",44,TRUE,-1,1
JSON (in SOAP UI- testing WSO2 services),"<p>I tried giving a string value 'abccccc' in date field to test the functionality of the Date. It gave a error 500 exception. Shouldn't that be a 400 validation exception?</p>

<pre><code>{
  ""id"": ""rr56"",
  ""name"":""reeta"",
  ""date"": ""abccccc""
}
</code></pre>
",https://stackoverflow.com/questions/50845145/json-in-soap-ui-testing-wso2-services,"['json', 'wso2', 'soapui']",41,TRUE,0,1
IOS UI Testing - Waiting for the network calls,"<p>I am writing a test cases for IOS using the XCTest framework. How can we wait for a network call and start our execution once our network call is finished.
Currently, I am using sleep() for waiting. But, its not the best way to do it as it.<br>
So, is there any other way to do it?</p>
",https://stackoverflow.com/questions/48903660/ios-ui-testing-waiting-for-the-network-calls,"['ios', 'xctest', 'ios-ui-automation', 'xctestcase']",1584,TRUE,2,1
How to query labels in Xcode UI testing,"<p>I see I can query textfields, tables, buttons, but not labels, why?</p>

<pre><code>app.textFields[""Username""].typeText(""bcyops"")
app.secureTextFields[""Password""].typeText(""ops15"")
app.buttons[""Submit""].tap()
app.tabBars.buttons[""Main""].tap()
let tablesQuery = app.tables
</code></pre>
",https://stackoverflow.com/questions/53161073/how-to-query-labels-in-xcode-ui-testing,['xcode-ui-testing'],2622,TRUE,1,3
Selenium ui testing with its api or extjs,"<p>We have a huge web app, SPA that is written in Extjs 6. 
We test it sometimes using Selenium web driver that runs Extjs code and sometimes uses its Selenium Apis. 
Can you highlight the pros and cons of each method?</p>
",https://stackoverflow.com/questions/50638335/selenium-ui-testing-with-its-api-or-extjs,"['selenium', 'extjs']",52,FALSE,0,0
Headless Xcode UI testing for a macOS app,"<p>We're trying to run our tests automatically on a test machine where all the non-UI tests run perfectly well. We have scripts that run the tests on the command line and collect results for analysis.</p>

<p>The test machine (a Mac mini) runs in a headless manner.</p>

<p>For UI tests, however, the test fails to launch the app with an error of the kind,</p>

<p><code>t =    83.86s             Assertion Failure: &lt;TestCaseName&gt;: Application '&lt;XCUIApplicationImpl: 0x60400026e300 com.&lt;app-identifier&gt; at &lt;app-name&gt;.app&gt;' failed to activate (current state: Running Background)
</code></p>

<p>It seems that it's due to the fact that there's no GUI session around when the machine is running headless (macOS calls such a session an Aqua session). We've tried to find a way around this, but haven't made any real progress.</p>

<p>If anyone has any ideas, we'd appreciate.</p>
",https://stackoverflow.com/questions/50295734/headless-xcode-ui-testing-for-a-macos-app,"['xcode', 'xctest', 'xcode-ui-testing', 'uitest', 'xctestcase']",1042,FALSE,1,1
How to automate Acumatica UI testing with Selenium,"<p>Is there a way to use Selenium to do UI test automations.  All Acumatica UI elements don't have ID's so Selenium will not find elements when going through the UI tests.  Do we have a way to automate UI testing for Acumatica using Selenium?</p>
",https://stackoverflow.com/questions/52882190/how-to-automate-acumatica-ui-testing-with-selenium,['acumatica'],141,FALSE,0,1
How to invoke an onStop for espresso UI testing,"<p>I am testing my UI, and need to test a case that results in the UI changing once onStop() has been called. Does anyone know a good way to mock an onStop()?</p>
",https://stackoverflow.com/questions/52474667/how-to-invoke-an-onstop-for-espresso-ui-testing,"['android', 'android-espresso', 'coded-ui-tests']",96,FALSE,0,1
Load controller from storyboard using Cucumberish with UI Testing,"<p>I am trying to implement UI testing with BDD using <a href=""https://github.com/Ahmed-Ali/Cucumberish"" rel=""nofollow noreferrer"">Cucumberish</a> framework.
I understand quite well the Feature files parsing system and I managed to tests some UI elements of the main screen.</p>

<p>However I would like to load any controller from storyboard before using UI testing on the corresponding screen.</p>

<p>Here is my initialization code:</p>

<pre><code>@objc class CucumberishSwiftInit: NSObject {
@objc class func CucumberishSwiftInit()
{
    var application : XCUIApplication!
    //A closure that will be executed just before executing any of your features
    beforeStart { () -&gt; Void in
        application = XCUIApplication()
    }
    //A Given step definition
    Given(""the app is running"") { (args, userInfo) -&gt; Void in
        application.launch()
        let bundle = Bundle.main

        // I double checked the storyboard name and I can access it in my Unit Tests target
        // application crashes here
        let storyboard = UIStoryboard(name: ""Main"", bundle: bundle)

        // never executed 
        Swift.print(""storyboard \(storyboard)"")
    }
    let bundle = Bundle(for: CucumberishSwiftInit.self)

    Cucumberish.executeFeatures(inDirectory: ""Features"", from: bundle, includeTags: nil, excludeTags: [""skip""])
}
}
</code></pre>

<p>Some feature file:</p>

<pre><code>@run @welcome
Feature: Some feature
Some feature desc

Scenario: Can load screen
    Given the app is running
    ...
</code></pre>

<p>The application crashed on the UIStoryboard init statement, caught ""NSInvalidArgumentException"", ""Could not find a storyboard named 'Main' in bundle NSBundle  (loaded). I have no clue why as it is working using with my unit tests.</p>
",https://stackoverflow.com/questions/53926214/load-controller-from-storyboard-using-cucumberish-with-ui-testing,"['swift', 'user-interface', 'testing', 'cucumber', 'bdd']",171,TRUE,0,1
IPhone UI Testing - How to access delete key on keyboard,"<p>I'm currently testing a textfield. I can select all the text, but then the keyboard pops up and I want to hit the delete key on the keyboard to delete all the text. How can I do this?</p>

<p><strong>What I currently have:</strong></p>

<pre><code>[_app.menuItems[@""Select All""] tap];
</code></pre>

<p><strong>What I want:</strong></p>

<pre><code>[_app.menuItems[@""Select All""] tap];
[_app.keyboard[@""delete""] tap]; // How do I do this?
</code></pre>
",https://stackoverflow.com/questions/50879523/iphone-ui-testing-how-to-access-delete-key-on-keyboard,"['objective-c', 'iphone', 'xcode-ui-testing']",1897,TRUE,3,3
Write custom strings to logs during UI testing / unit testing,"<p>Is there any way to add text to the logs of a test?</p>

<p>Neither NSLog nor Swift.print seem to log any remaining text to any logs that I can see, when running UI and/or unit testing in Xcode 9. I am running on device.</p>

<p>Whatever I do, I do not see any NSLog/print stuff in Report navigator, clicking on the Test. I tried expanding everything...</p>
",https://stackoverflow.com/questions/50403718/write-custom-strings-to-logs-during-ui-testing-unit-testing,"['xcode', 'unit-testing', 'xcode-ui-testing']",3970,FALSE,1,1
How to surpass location enabler dialogue in UI testing Espresso android?,"<p>I am using Espresso for UI testing android. I wanted to run a test with location off in the settings and I got stuck with the location enabler dialogue as it fails other test. I have mentioned my observations and what I have tried so far</p>

<ul>
<li>Used UiAutomator, it works only on single test case but it fails on
complete run of test suite. </li>
<li>Used Grant permission rule, it gave permission but the dialogue still
exists.  </li>
<li><p>Used Roboelectric, it had no effect on the problem.</p></li>
<li><p>Used Shadow operation, it had no effect on the problem.</p></li>
</ul>

<p>I have also attached a sample image of the location dialogue.
<a href=""https://i.stack.imgur.com/ycBOz.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/ycBOz.png"" alt=""enter image description here""></a></p>

<p>Thank you.</p>
",https://stackoverflow.com/questions/49129710/how-to-surpass-location-enabler-dialogue-in-ui-testing-espresso-android,"['android', 'android-permissions', 'android-espresso']",2186,TRUE,6,1
Unable to trigger the Photo deletion window during UI testing,"<p>I am attempting to create a UI Test in <strong>XCode 10</strong> that includes a step where the following window will appear:</p>

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

<p>(FYI - this is to support the creation of a video script, so we want to provide a full experience for the viewer)</p>

<p>Initially, I just recorded the steps to make sure I was properly capturing this request screen, and XCode dutifully logged out all of the steps.</p>

<p>Below is a lightly modified version from what XCode generates. For the record, using the unmodified version also fails.</p>

<pre><code>func testDeletePhotos() {
    let app = XCUIApplication()
    continueAfterFailure = false
    app.launch()
    // Select two images from within app to delete
    let collectionViewsQuery = app.collectionViews
    collectionViewsQuery.children(matching: .cell)
        .element(boundBy: 1)
        .children(matching: .other)
        .element.children(matching: .other)
        .element(boundBy: 1)
        .tap()
    collectionViewsQuery.children(matching: .cell)
        .element(boundBy: 0).children(matching: .other)
        .element.children(matching: .other)
        .element(boundBy: 1)
        .tap()
    let navigationBar = app.navigationBars[""MY_APP_NAME""]
    // Select the ""Trash can"" in nav bar to start delete process
    navigationBar.buttons[""Delete""].tap()
    // Prompt appears properly and text is a precise match for string below
    // Below step fails with error seen below
    app.alerts[""Allow “MY_APP_NAME” to delete 2 photos?""].buttons[""Delete""].tap()

    navigationBar.buttons[""Back""].tap()
}
</code></pre>

<p>However, when I attempt to re-run this script, it fails to locate the <strong>Delete</strong> button as seen in the above image.</p>

<blockquote>
  <p>UI Test Activity:  Assertion Failure: MyVideoScript.swift:###: No
  matches found for Find: Descendants matching type Alert from input {(
      Application, pid: 17838, label: 'MY_APP_NAME' )}</p>
</blockquote>

<p>Also, since someone may mention this - the quantity of photos is the same, as this will change the text that appears in the alert. I also attempted to use the <code>app.alerts.element(boundBy: 0)</code> in place of the name search and got the same error.</p>
",https://stackoverflow.com/questions/53886743/unable-to-trigger-the-photo-deletion-window-during-ui-testing,"['ios', 'swift', 'xcode', 'xcode-ui-testing']",86,FALSE,0,1
Xcode 9.3 staticText element query limits 128 characters for UI testing,"<p>In Xcode 9.3, when I try to run UI test cases it started giving me below exception where ever it found lengthy messages exceeding 128 characters - </p>

<blockquote>
  <p><em>Terminating app due to uncaught exception  'NSInternalInconsistencyException', reason: 'Invalid query - string
  identifier ""lengthy message more than 128 characters..."" exceeds
  maximum length of 128 characters. You can work around this limitation
  by constructing a query with a custom NSPredicate that specifies the
  property (label, title, value, placeholderValue, or identifier) to
  match against.'</em> </p>
</blockquote>

<p>Workaround given is to use custom NSPredicate something like below,</p>

<pre><code>let predicate = NSPredicate(format: ""label BEGINSWITH 'Empty '"")
let label = app.staticTexts.element(matching: predicate)
XCTAssert(label.exists)
</code></pre>

<p>But If we use predicate like above, we might not be able to assert the entire text message.Is there any other possible way where we can assert the entire text? Please let me know.</p>

<p>Thanks, Cheers:)</p>
",https://stackoverflow.com/questions/50291593/xcode-9-3-statictext-element-query-limits-128-characters-for-ui-testing,['xcode-ui-testing'],2231,TRUE,5,1
Straightforward yet isolated view controller UI testing in Xcode Simulator possible?,"<p>Is it possible to run UI tests with the Xcode Simulator, for example, by manually initiating a view controller from an <code>XCTestCase</code>? I'm familiar with configuring the environment for a test via <code>NSProcessInfo</code> (or <code>ProcessInfo</code>) in Swift, but I have a certain case where it'd really be easier just to show a single view controller and run a series of gestures on it... versus navigating to it under certain conditions.</p>

<p>While I could create another target to do that, and then UI tests for that, I was wondering if there was a simpler approach.</p>
",https://stackoverflow.com/questions/53535963/straightforward-yet-isolated-view-controller-ui-testing-in-xcode-simulator-possi,"['ios', 'xcode', 'xctest', 'xcode-ui-testing', 'ui-testing']",1107,TRUE,3,1
Xcode UI testing: How to know table reached end in iOS,"<p>Wanted to know the table is reached end or not using UI testing. Basically I have the requirement to find the button with in the tableview and the button will display some cases and wont for some cases. If the table reached end i will stop swiping up. Currently managing with some hard coded number of swipes. </p>

<p>Using hard coded number of swipes though the table content is less it will scrolls up. Is there any way to find the option to know table reached end or not.</p>
",https://stackoverflow.com/questions/49876401/xcode-ui-testing-how-to-know-table-reached-end-in-ios,"['ios', 'swift', 'uitest']",120,FALSE,1,0
How to do UI testing for kotlin file with dagger in android?,"<p>Below is my stack trace, I have gone through all the questions and answers on SO but can't find any solution</p>

<pre><code>java.lang.IllegalStateException: Could not initialize plugin: interface 
org.mockito.plugins.MockMaker (alternate: null)
at org.mockito.internal.configuration.plugins.PluginLoader$1.invoke(PluginLoader.java:74)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
at $Proxy6.isTypeMockable(Unknown Source)
at org.mockito.internal.util.MockUtil.typeMockabilityOf(MockUtil.java:29)
at org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidator.java:22)
at org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImpl.java:232)
at org.mockito.internal.creation.MockSettingsImpl.build(MockSettingsImpl.java:226)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:64)
at org.mockito.Mockito.mock(Mockito.java:1871)
at org.mockito.Mockito.mock(Mockito.java:1780)
at SplashActivityTest.init(SplashActivityTest.kt:126)
at java.lang.reflect.Method.invoke(Native Method) 
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lnet/bytebuddy/dynamic/loading/ClassInjector$UsingReflection;
at org.mockito.internal.creation.bytebuddy.SubclassInjectionLoader.&lt;init&gt;(SubclassInjectionLoader.java:28)
at org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker.&lt;init&gt;(SubclassByteBuddyMockMaker.java:33)
at org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.&lt;init&gt;(ByteBuddyMockMaker.java:21)
at java.lang.Class.newInstance(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class ""net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection"" on path: DexPathList[[zip file ""/system/framework/android.test.runner.jar"", zip file ""/system/framework/android.test.mock.jar"", zip file ""/data/app/com.test-Ceb6_iDz-8wl1a3HhgqEEg==/base.apk"", zip file ""/data/app/YwRi3yxfA1u5ckInmXjV-A==/base.apk""],nativeLibraryDirectories=[/data/app/test-Ceb6_iDz-8wl1a3HhgqEEg==/lib/x86, /data/app/YwRi3yxfA1u5ckInmXjV-A==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
</code></pre>

<p>Below is my splashActivityTest,</p>

<pre><code>import android.view.View
import android.view.ViewGroup
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.filters.LargeTest
import androidx.test.rule.ActivityTestRule
import androidx.test.runner.AndroidJUnit4
import org.hamcrest.Description
import org.hamcrest.Matcher
import org.hamcrest.Matchers.allOf
import org.hamcrest.TypeSafeMatcher
import org.hamcrest.core.IsInstanceOf
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@LargeTest
@RunWith(AndroidJUnit4::class)
class SplashActivityTest {

@Rule
@JvmField
var mActivityTestRule = ActivityTestRule(SplashActivity::class.java)
@Rule
@JvmField
val executorRule = TaskExecutorWithIdlingResourceRule()
@Rule
@JvmField
val countingAppExecutors = CountingAppExecutorsRule()
@Rule
@JvmField
val dataBindingIdlingResourceRule = DataBindingIdlingResourceRule(mActivityTestRule)

private lateinit var prefUtils: PrefUtils
private lateinit var navigationController: NavigationController

@Before
fun init() {
    prefUtils = mock()
    navigationController = mock()
}

@Test
fun splashActivityTest() {
    // Added a sleep statement to match the app's execution delay.
    // The recommended way to handle such scenarios is to use Espresso idling resources:
    // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
    Thread.sleep(2000)

    val imageView = onView(
        allOf(
            withId(R.id.logo),
            childAtPosition(
                childAtPosition(
                    IsInstanceOf.instanceOf(android.widget.FrameLayout::class.java),
                    0
                ),
                0
            ),
            isDisplayed()
        )
    )
    imageView.check(matches(isDisplayed()))

    val frameLayout = onView(
        allOf(
            childAtPosition(
                childAtPosition(
                    withId(android.R.id.content),
                    0
                ),
                0
            ),
            isDisplayed()
        )
    )
    frameLayout.check(matches(isDisplayed()))

    val frameLayout2 = onView(
        allOf(
            childAtPosition(
                childAtPosition(
                    withId(android.R.id.content),
                    0
                ),
                0
            ),
            isDisplayed()
        )
    )
    frameLayout2.check(matches(isDisplayed()))
}

private fun childAtPosition(
    parentMatcher: Matcher&lt;View&gt;, position: Int
): Matcher&lt;View&gt; {

    return object : TypeSafeMatcher&lt;View&gt;() {
        override fun describeTo(description: Description) {
            description.appendText(""Child at position $position in parent "")
            parentMatcher.describeTo(description)
        }

        public override fun matchesSafely(view: View): Boolean {
            val parent = view.parent
            return parent is ViewGroup &amp;&amp; parentMatcher.matches(parent)
                    &amp;&amp; view == parent.getChildAt(position)
        }
    }
  }
}
</code></pre>

<p>Actual SplashActivity</p>

<pre><code>@OpenForTesting
class SplashActivity : BaseActivity() {

/**
 * Returns layout file ID
 * */
override fun layoutId() = R.layout.activity_splash

/**
 * this method gets called when this activity gets created
 * all tasks those need to be executed when this activity get created
 * */
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    /**
     * TO Load Gif in #ImageView
     */
    Glide.with(this).load(R.raw.new_loading_logo).into(logo)
    /**
     * Handles Timer of 2000 millSeconds to open another Activity
     * prefUtils.isUserLogin() == true -&gt; Opens DashBoard as User is already Logged In
     * else -&gt; Opens Log In Page
     */
    //*while UI test runs, Here when prefUtils.isUserLogin() gets executed See error log below*
    Handler().postDelayed({
        if (prefUtils.isUserLogin())
            navigationController.navigateToDashBoard(this)
        else
            navigationController.navigateToLogin(this)
        finish()
    }, 2000)
  }
}
</code></pre>

<p>This Activity extends BaseActivity which is having below lines, hence after launch of splash, my test goes failed and stats that lateinit var prefUtils has not been initialised, now for this i have used mocking but still getting java.lang.IllegalStateException: Could not initialize plugin: interface 
org.mockito.plugins.MockMaker (alternate: null).</p>

<pre><code>@Inject
lateinit var navigationController: NavigationController
@Inject
lateinit var prefUtils: PrefUtils
@Inject
lateinit var viewModelFactory: ViewModelProvider.Factory
</code></pre>

<p>I have added dependencies as below, </p>

<pre><code>testImplementation ""junit:junit:$junitVersion""
testImplementation ""org.mockito:mockito-core:$mockito""
testImplementation ""org.mockito:mockito-inline:$mockito""
</code></pre>

<p>Below error happens when i dont mock anything,</p>

<pre><code>kotlin.UninitializedPropertyAccessException: lateinit property prefUtils has not been initialized
at BaseActivity.getPrefUtils(BaseActivity.kt:41)
at SplashActivity$onCreate$1.run(SplashActivity.kt:38)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Test running failed: Instrumentation run failed due to 'Process crashed.'
</code></pre>

<p>as baseActivity has below line
    @Inject
    lateinit var prefUtils: PrefUtils
Hence for solving this error i am using Mock</p>

<p>Now I have tried power mock too but it failed on compile time !!, It states </p>

<pre><code>Unresolved reference: powermock
</code></pre>

<p>on below line</p>

<pre><code>@RunWith(PowerMockRunner::class)
</code></pre>
",https://stackoverflow.com/questions/53880101/how-to-do-ui-testing-for-kotlin-file-with-dagger-in-android,"['android', 'unit-testing', 'kotlin', 'mockito', 'ui-testing']",1332,TRUE,3,1
Unable to upload APKs to App Center to perform Espresso UI testing,"<p>I'll try being as detailed as I possibly can. Please excuse any formatting or language issues.</p>

<p><strong>What I'm trying to do?</strong></p>

<p>I'm trying to make an app to upload APKs to <a href=""http://appcenter.ms/"" rel=""nofollow noreferrer"">Appcenter</a> to execute UI test cases on whatever devices a user provided. When finished, my app will show the results of the UI tests executed.</p>

<p><strong>How am I doing it?</strong></p>

<p>App center has provided a lot of APIs which may be viewed <a href=""https://openapi.appcenter.ms/"" rel=""nofollow noreferrer"">here</a>. Executing a UI test is a 4 step process.</p>

<ol>
<li>Create a new test run. <em>This is working</em></li>
<li>Create hashses of files to be uploaded. <em>This is working</em></li>
<li>Upload the actual files. <em>I keep getting a 400 bad request OR ""payload is too big"" error. My APK file is only 1 MB &amp; the upload works through <a href=""https://github.com/Microsoft/appcenter-cli"" rel=""nofollow noreferrer"">Appcenter CLI</a></em>.</li>
<li>Execute the test run created. <em>This API is not working. Probably due to failure of 3rd step</em>.</li>
</ol>

<p><strong>What do I need help with?</strong></p>

<p>Step 3. above is not working for me. I keep getting the following error when I try to upload the APK file through curl/postman. </p>

<p>Curl command : </p>

<pre><code>curl -i -F ""data=@app-debug-androidTest.apk"" -H ""X-API-Token:API_TOKEN_HERE"" -H ""Content-Type:application/json"" -X POST https://api.appcenter.ms/v0.1/apps/{ORG_NAME}/{APP_NAME}/test_runs/{TEST_RUN_ID_CREATED_IN_STEP_1}/files
</code></pre>

<p>Error received : </p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html lang=""en""&gt;
    &lt;head&gt;
        &lt;meta charset=""utf-8""&gt;
        &lt;title&gt;Error&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;pre&gt;Payload Too Large&lt;/pre&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>The irony is, when the exact same API is executed by the Appcenter CLI, it works. If UI tests are executed as part of the build step, App center uses the exact same procedure &amp; set of APIs to upload the APK. Please view the complete log <a href=""https://justpaste.it/5ufn1"" rel=""nofollow noreferrer"">here</a>. For formatting purposes, I did not add in inline.</p>

<p>What am I doing wrong?</p>
",https://stackoverflow.com/questions/50756384/unable-to-upload-apks-to-app-center-to-perform-espresso-ui-testing,"['android', 'continuous-integration', 'visual-studio-app-center']",1543,TRUE,0,2
Appium &amp; Xcode 9: UI testing in safari view controller not possible anymore?,"<p>Is there any way I can automate ui tests in safari view controller? Since I'm using Xcode 9 I cannot reference UI elements inside fo SFSafariViewController anymore. When I debug the view hierarchy, I cannot see any XCUIElements, for example UITextFields in order to perform an automated login. In Xcode 8, I could access those elements via XCUIPath. </p>
",https://stackoverflow.com/questions/48827479/appium-xcode-9-ui-testing-in-safari-view-controller-not-possible-anymore,"['ios', 'xcode9', 'appium-ios', 'sfsafariviewcontroller', 'uitest']",660,TRUE,0,1
UI Testing: accessibilityIdentifier is set and detected by accessibilityInspector but not by recorder,"<p>This issue occurs when using a different iPhone version.</p>

<p>Using iPhone 5 and recorder:</p>

<pre><code>app.scrollViews.otherElements.collectionViews.staticText[“TEXT”]
</code></pre>

<p>Using iPhone 7 and recorder:</p>

<pre><code>app.children(matching: .window).element(boundBy: 0).children(matching: .other).element(boundBy: 1).scrollViews.children(matching: .other).element.children(matching: .collectionView).element.children(matching: .cell).element(boundBy: 0).children(matching: .other).element(boundBy: 0)`
</code></pre>

<p>Tests breaks because It couldn't locate the element when testing on iPhone 7, although using accessibilityInspector on iPhone 7 will state that the accessibilityValue is ""TEXT""</p>
",https://stackoverflow.com/questions/49867798/ui-testing-accessibilityidentifier-is-set-and-detected-by-accessibilityinspecto,"['ios', 'swift', 'xctest', 'xcuitest']",199,FALSE,0,0
IOS UI Testing - How to write test cases for opening camera and file chooser,"<p>I am writing test cases for IOS using the XCTest framework. I want to select a photo for setting the user profiles, which can be done in 2 ways:
1. Capturing the image using the camera.
2. Selecting an image from the file chooser.</p>

<p>I am having following issues :
1. I am running this test on simulators. So, how to access cameras?
2. I am able to open page file chooser page by clicking on ""Choose on Photo album"". But, not able to detect tap on page file chooser page.</p>

<p>My code is as follows : </p>

<pre><code>app.buttons[""Choose from Photo Album""].tap()
app.tables.firstMatch.cells.element(boundBy: 0).tap()
</code></pre>

<p>Line 2 gives me error :
    NSInternalInconsistencyException invalid parameter not satisfying</p>

<p>Not found a single documentation for the above mentioned cases.</p>
",https://stackoverflow.com/questions/48866256/ios-ui-testing-how-to-write-test-cases-for-opening-camera-and-file-chooser,"['xctest', 'ios-ui-automation', 'xctestcase']",3564,TRUE,1,2
Code signing is required for product type &#39;UI Testing Bundle&#39; in SDK &#39;iOS 11.2&#39;,"<p>Are there any other solutions other than setting the code signing entity to <code>iPhone Developer</code> ? The reason why I can't do that is because of Fastlane issues (profiles are currently specified).</p>

<p>Where do I set it to so that the uitest bundle will be manual instead of automatic?</p>
",https://stackoverflow.com/questions/49254920/code-signing-is-required-for-product-type-ui-testing-bundle-in-sdk-ios-11-2,['xcode'],246,FALSE,1,0
Cannot access swift object&#39;s function from objc even adding the @objcMembers tag while running UI testing,"<p>I'm working on UI testing code for iOS app recently,
my UI testing code is using swift, but the project itself has some objective-c code, and I create a singleton object for launch arguments settings, which also written by swift, so I adding the @objcMembers tag to the class.</p>

<p>but while running the UI testing code, it seems not capable to reach the variables and functions, the singleton itself also not exists?
something I missed?</p>

<pre><code>import UIKit

#if DEBUG

@objcMembers
class EALaunchArugments: NSObject {

static let sharedInstance = EALaunchArugments()

// key for property
static private let UITestingKey = ""-UITesting""

var isUITesting: Bool {
    let value = self.getLaunchArgumentValue(key: EALaunchArugments.UITestingKey)
    return Bool(value ?? """") ?? false
}

private func getLaunchArgumentValue(key: String) -&gt; String? {
    let arguments = ProcessInfo.processInfo.arguments
    let indexOfKey = arguments.firstIndex(of: key)

    guard let index = indexOfKey, index != NSNotFound else {
        return nil
    }

    guard index + 1 &gt;= arguments.count else {
        return nil
    }

    return arguments[index + 1]
}

func setAllLaunchArgumentsSettingsForUITesting() {
// some work

}
}

#endif
</code></pre>
",https://stackoverflow.com/questions/53804132/cannot-access-swift-objects-function-from-objc-even-adding-the-objcmembers-tag,"['objective-c', 'swift', 'xcode-ui-testing']",232,FALSE,1,0
"iCloud UI Testing displays alert Sign In to iCloud, although logged in and iCloud is enabled for the app","<p>My app uses iCloud, and I want to UI test it using simulators.<br>
Thus, I logged in the simulators into iCloud using the system settings.<br>
Now I can run my app without problems.  </p>

<p>The problem arises when I try to UI test what happens when iCloud usage is disabled in the system settings app.  </p>

<p>To do so, I launch first my app using  </p>

<pre><code>app = XCUIApplication()
app.launch()  
</code></pre>

<p>Then, I want to disable iCloud usage in the settings app. Thus, I open this app using  </p>

<pre><code>let settingsApp = XCUIApplication(bundleIdentifier: ""com.apple.Preferences"")
settingsApp.launch()  
</code></pre>

<p>This does indeed open the settings app, but for some reason, it displays an alert  </p>

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

<p>I don’t why this alert is shown, because it happen only during UI testing, not when I run the app, hit the home button, and launch then settings app.  </p>

<p>Moreover, I was not able to catch this alert using  </p>

<pre><code>let signInAlert = app.alerts[""Sign In to iCloud""]
let signInAlertShown = signInAlert.waitForExistence(timeout: 10)
</code></pre>

<p><code>signInAlertShown</code> is set to <code>false</code> if I set a breakpoint after this statement in a UI test.  </p>

<p>So my questions are:<br>
1) Why is this alert shown?<br>
2) How can I handle it?</p>
",https://stackoverflow.com/questions/49097652/icloud-ui-testing-displays-alert-sign-in-to-icloud-although-logged-in-and-iclou,"['xcode', 'icloud', 'xcode-ui-testing']",205,TRUE,1,1
How to modify app build for UI tests,"<p>I am using <code>XCUITests</code> to UI test my app. The app currently reads <code>ProcessInfo.processInfo.environment</code> in the main App target (inside AppDelegate) to override some of its settings to be better suited for UI tests. Such as disabling UI animations, override API endpoints, etc.</p>

<p>However, I would like my release version of the app to be free of these overrides and only include these testing hooks if actually building the app for UI testing.</p>

<p>What is the best way of achieving this?</p>

<p>For example is there a preprocessor define I can use to include code only when building the app for UI testing? Or can I only include a source file if building for UI testing?</p>
",https://stackoverflow.com/questions/48826418/how-to-modify-app-build-for-ui-tests,"['xcode', 'xcode-ui-testing', 'xcuitest']",478,FALSE,0,2
How to set the accessibilityIdentifier on a React Native component?,"<p>I’d like to add an <code>accessibilityIdentifier</code> to a React Native component, so that I can use Xcode’s UI testing to navigate around my app.</p>

<p>Is there a way to specify the <code>accessibilityIdentifier</code> (<em>not</em> the <code>accessibilityLabel</code>) for React Native?</p>
",https://stackoverflow.com/questions/48178965/how-to-set-the-accessibilityidentifier-on-a-react-native-component,"['react-native', 'accessibility', 'xcode-ui-testing', 'react-native-ios', 'uiaccessibility']",4595,TRUE,10,1
How to set zoom level of IE to 100% using python _winreg,"<p>I am trying to do UI testing and trying to set IE zoom percentage as 100% during run time.</p>

<p>This is what I have tried till now</p>

<pre><code>from _winreg import *
""""""POC to fix Zoom value to 100 percent""""""
keyVal = r'Software\Microsoft\Internet Explorer\Zoom'
key = OpenKey(HKEY_CURRENT_USER, keyVal, 0, KEY_ALL_ACCESS)
SetValueEx(key, ""100000"", 0, REG_DWORD, 0)
</code></pre>
",https://stackoverflow.com/questions/49398660/how-to-set-zoom-level-of-ie-to-100-using-python-winreg,"['python', 'selenium', 'winreg']",850,FALSE,1,1
Testing notification between 2 apps,"<p>is there any way of UI testing a notification sent between 2 apps with espresso, UIAutomator or other framework?</p>

<p>This would include testing the third party provider.</p>

<p>Any experience?</p>
",https://stackoverflow.com/questions/52950537/testing-notification-between-2-apps,"['android-espresso', 'android-uiautomator']",60,TRUE,0,1
Meaning of allElementsBoundByAccessibilityElement,"<p>I'm learning to use <code>XCTest</code> for UI testing. I couldn't understand of doc of <code>XCUIElementQuery.allElementsBoundByAccessibilityElement</code>:</p>

<blockquote>
  <p>Immediately evaluates the query and returns an array of elements bound
  to the resulting accessibility elements.</p>
</blockquote>

<p>What does ""elements bound to the resulting accessibility elements"" mean? Also, what's the difference from <code>allElementsBoundByIndex</code>? </p>
",https://stackoverflow.com/questions/49307513/meaning-of-allelementsboundbyaccessibilityelement,"['xctest', 'xcode-ui-testing']",2505,TRUE,13,1
Espresso test click withIn EditText CompoundDrawables,"<p>I am learning UI testing using Espresso. In espresso on click of drawable should show another page. But using custom matcher also didn't click that drawable item. How to approach for this?</p>

<p>Want <code>edittext</code> with <code>drawable</code> like below:-
<a href=""https://i.stack.imgur.com/ThT5G.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/ThT5G.png"" alt=""enter image description here""></a></p>
",https://stackoverflow.com/questions/48767237/espresso-test-click-within-edittext-compounddrawables,"['android', 'user-interface', 'android-edittext', 'android-drawable', 'android-espresso']",138,FALSE,1,0
How to mock location using google&#39;s FusedLocationProviderClient,"<p>I am working on Espresso UI Testing, When I request the location using FusedLocationProviderClient I turned the testing state to idle when I tried to mock the location using setMockLocation(Location mockLocation) method I did not get the LocationCallback get called.</p>
",https://stackoverflow.com/questions/48618872/how-to-mock-location-using-googles-fusedlocationproviderclient,"['android', 'testing', 'location', 'android-espresso']",359,FALSE,4,0
How do I add an extension for XCUIElement?,"<p>I am new to UI testing and xcode/ios development in general. How do I add extensions that hold methods that can be called within UI test targets?</p>

<p>This is a SAMPLE extension I'd like to add:</p>

<pre><code>extension XCUIElement {
    /**
     Removes any current text in the field before typing in the new         
     value
   - Parameter text: the text to enter into the field
    */
    func clearAndEnterText(text: String) {
        guard let stringValue = self.value as? String else {
            XCTFail(""Tried to clear and enter text into a non string     
            value"")
            return
    }

        self.tap()

        let deleteString = stringValue.characters.map { _ in     
        XCUIKeyboardKeyDelete }.joined(separator: """")

        self.typeText(deleteString)
        self.typeText(text)
    }
}
</code></pre>
",https://stackoverflow.com/questions/51975963/how-do-i-add-an-extension-for-xcuielement,"['ios', 'swift', 'xcuitest']",568,FALSE,0,0
Detox does not handle universal links,"<p>I've been trying to get iOS Universal Links to work with Detox using <code>device.openURL</code> from <a href=""https://github.com/wix/Detox/blob/master/docs/APIRef.MockingOpenFromURL.md"" rel=""nofollow noreferrer"">https://github.com/wix/Detox/blob/master/docs/APIRef.MockingOpenFromURL.md</a> but it does not work.</p>

<p>Sample of what I've tried:</p>

<pre><code>it('should work', async () =&gt; {
  await device.sendToHome();
  await device.openURL({
    url: 'https://name.page.link/somewhere,
    sourceApp: 'com.apple.MobileSMS'
  });
});
</code></pre>

<p>It never opens my app and after testing various things it seems detox only support deep links and not universal links.</p>

<p>I can mention that when running the app (both on device and simulator) the universal links work fine which leads me to believe the issue is not with how I have configured universal links but with detox support for it.</p>

<p>In iOS UI Testing it is doable to test universal links by going through iMessage app (see <a href=""https://blog.branch.io/ui-testing-universal-links-in-xcode-9/"" rel=""nofollow noreferrer"">https://blog.branch.io/ui-testing-universal-links-in-xcode-9/</a>). Anyone know of a similar workaround for detox?</p>
",https://stackoverflow.com/questions/53576538/detox-does-not-handle-universal-links,"['ios', 'ios-universal-links', 'detox']",828,FALSE,0,1
Adding UI Tests in Unit testing target,"<p>I don't want to pollute/mix the unit test cases(written using QuickSpec) which I have written in <strong>UNIT TESTING TARGET</strong> with UI tests from EarlGrey.</p>

<p>Is there any alternative that I can have EarlGrey tests to be added to <strong>UI TESTING TARGET</strong>?</p>
",https://stackoverflow.com/questions/51189769/adding-ui-tests-in-unit-testing-target,['earlgrey'],92,FALSE,0,1
Automation testing for RestApi and UI in one application,"<p>I have an application in which I need to do UI testing as well as rest Api testing.Could anyone suggest me any testing tool for this.
My framework will be data driven.
Also, it is 20% UI and 80% rest api testing.</p>
",https://stackoverflow.com/questions/52941554/automation-testing-for-restapi-and-ui-in-one-application,"['rest', 'selenium', 'testing']",901,FALSE,0,1
How to attach image on react page,"<p>How to upload(attach image)  the image on react pages using (capybara webkit+ cucumber) for integration UI testing.</p>

<p>I am able to attach an image to rails page but react pages i am unable to upload?</p>

<p>I tried some solutions, still unable to find solution.</p>

<p>1) <code>attach_file('.pb-text-field__browse_file_label', image_file_name)</code></p>

<p>2) <code>find('.pb-text-field__browse_file_label').set('/scratch/data/1.png')</code></p>

<p>Actual HTML:</p>

<pre><code>&lt;form&gt;
  &lt;div class=""file text-field""&gt;
    &lt;div class=""text-field__input-wrapper""&gt;
      &lt;div class=""text-field__box""&gt;&lt;/div&gt;
      &lt;div class=""text-field__upload_file""&gt;
        &lt;input class=""text-field__file-input"" placeholder=""Upload only jpeg or png images"" disabled=""""&gt; 
        &lt;div class=""text-field__browse_file""&gt; 
          &lt;label class=""text-field__browse_file_label"" for=""image-file""&gt;Browse&lt;/label&gt; 
          &lt;input id=""image-file"" class=""text-field__browse"" type=""file""&gt;{this is invisible} 
        &lt;/div&gt;
      &lt;/div&gt; 
</code></pre>
",https://stackoverflow.com/questions/50760364/how-to-attach-image-on-react-page,"['reactjs', 'cucumber', 'capybara-webkit']",686,TRUE,0,1
F# Canopy: Can a test be excluded from the report?,"<p>I am a beginner in f# canopy UI testing and I have one small problem:</p>

<p>I want to exclude one test from the report. I use LiveHtmlReporter and I do not want this test to be displayed in the final table. Is there a way to do this?</p>
",https://stackoverflow.com/questions/51321437/f-canopy-can-a-test-be-excluded-from-the-report,"['f#', 'reporters', 'canopy-web-testing']",46,FALSE,0,0
AutomationPeer.GetChildrenCore () only reports first child to VisualStudio.TestTools,"<p>I'm not able to override GetChildrenCore correctly. I use this for a Canvas to get information about it's children (Line, Rectangle).</p>

<p>The output correctly indicates the first child but misses the second. Even though the Canvas already contains both.</p>

<pre><code>Custom Canvas  
    Custom Line Childs of Canvas parent: 2  
</code></pre>

<p>Instead it should be like this:</p>

<pre><code>Custom Canvas  
    Custom Line Childs of Canvas parent: 2  
    Custom Rectangle Childs of Canvas parent: 2  
</code></pre>

<p><strong>App side side:</strong></p>

<pre><code>public class ElementAP : FrameworkElementAutomationPeer
{
    private FrameworkElement Owner = null;
    private Int32 Count = 0;

    public ElementAP(FrameworkElement owner, Int32 count) : base (owner)
    {
        Owner = owner;
        Count = count;
    }

    protected override AutomationControlType GetAutomationControlTypeCore()
    {
        return AutomationControlType.Custom;
    }

    protected override string GetClassNameCore()
    {
        return $""{Owner.GetType().Name} Childs of Canvas parent: {Count}""; 
    }
}

public class CanvasAP : FrameworkElementAutomationPeer
{
    public CanvasAP(Windows.UI.Xaml.Controls.Canvas owner) : base(owner)
    {
    }

    protected override AutomationControlType GetAutomationControlTypeCore()
    {
        return AutomationControlType.Custom;
    }

    protected override string GetClassNameCore()
    {
        return ""Canvas"";
    }

    protected override IList&lt;AutomationPeer&gt; GetChildrenCore()
    {
        var owner = (Windows.UI.Xaml.Controls.Canvas)Owner;           
        var list = new List&lt;AutomationPeer&gt; ();

        foreach (var child in owner.Children)
        {
            var peer = new ElementAP(child as FrameworkElement, owner.Children.Count);

            list.Add(peer);
        }

        return list;
    }
}       
</code></pre>

<p><strong>UI Testing side:</strong></p>

<pre><code>private static string WalkTree(UITestControl element, Int32 level = 0)
{
    var children = element.GetChildren();

    var str = """";
    foreach (var c in children)
    {
        str += GetElementString(c, level);
        str += WalkTree(c, level + 1);
    }

    return str;
}

private static string GetElementString(UITestControl element, Int32 level = 0)
{
    var xaml = element as XamlControl;
    var str = """";
    for (var i = 0; i &lt; level; i++)
        str += ""  "";

    str += $""{element.ControlType} {element.ClassName} {element.Name} {xaml?.AutomationId ?? """"}\n"";

    return str;
}   
</code></pre>
",https://stackoverflow.com/questions/48832213/automationpeer-getchildrencore-only-reports-first-child-to-visualstudio-testt,"['xamarin', 'windows-store-apps', 'ui-automation', 'visualstudio.testtools']",201,TRUE,0,1
How to call &quot;OpenURL&quot; function of Appdelegate from UI Xctest,"<p>My application contains ""OpenIn"" functionality i.e. user can share any file to my application. I want to test this using UI testing in Xcode. </p>

<ol>
<li>How do I access Appdelegate's/UIApplicaiton's ""OpenURL"" method in XctestCase class?</li>
<li>How can I show a ""OpenIn"" window i.e. share with application popup where I can share the file?</li>
</ol>
",https://stackoverflow.com/questions/50921299/how-to-call-openurl-function-of-appdelegate-from-ui-xctest,"['ios', 'swift', 'xctest', 'xctestcase']",214,FALSE,1,1
How to pause XCUITest for manual Simulator manipulation?,"<p>I'm trying to automate parts of my UI testing using XCUITest. I wan't the test do automatically do parts of the test, and then wait for me to do some stuff manually. Is there a good way to do this?</p>

<p>Right now I'm just doing this:</p>

<pre><code>class QDBUITestHost: XCTestCase {

  override func setUp() {
    continueAfterFailure = false
    XCUIApplication().launch()
  }

  override func tearDown() {}

  func testHosting() {
    let app = XCUIApplication()
    app.buttons[""Select Group""].tap()
    app.sheets.buttons[""com-mist-qdb-1""].tap()
    app.buttons[""Host""].tap()
    sleep(600) // This is an ugly hack
  }

}
</code></pre>

<p>So, is there a better way to do this, rather than to just <code>sleep(600)</code>?</p>
",https://stackoverflow.com/questions/53252948/how-to-pause-xcuitest-for-manual-simulator-manipulation,"['ios', 'swift', 'xcode', 'xcuitest']",554,FALSE,3,1
Cannot override init() function in Swift XCTestCase,"<p>I'd like to override the init function for XCTestCase in UI testing for a few reasons:</p>

<ul>
<li>To launch the app, outside of setUp() so that the app doesn't need to relaunch for every test (this is tedious and slows down tests)</li>
<li>To initialize other classes that provide general navigation through the app, which must me initialized with a test case (<em>self</em>).</li>
</ul>

<p>What I have now looks like this:</p>

<pre><code>import XCTest

class UITest: XCTestCase {

    let app = XCUIApplication()

    // Helper packages
    var helper: UITestHelper!

    override func setUp() {
        super.setUp()

        // Helper package instantiation
        helper = UITestHelper(withTestCase: self, forApp: app)

        continueAfterFailure = false
        app.launch()
    }

... tearDown(), tests ....
</code></pre>

<p>When I call:</p>

<pre><code>override init() {
    super.init()
    foo()
}
</code></pre>

<p>I get <code>Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)</code></p>
",https://stackoverflow.com/questions/50763777/cannot-override-init-function-in-swift-xctestcase,"['ios', 'swift', 'xcode', 'xcode-ui-testing']",2098,TRUE,12,1
Generate UITouch event from an app in iOS 11,"<p>Is it possible to generate a UITouch event, from an iOS 11 app, which will never be submitted to the App Store?</p>

<p>I've seen several articles, dating back to around 2010 describing some old methods of doing this which are no longer valid.  Does anyone know of a way to do this in iOS 11?</p>

<p>This app would never be submitted to the app store, it would only be used for UI testing of a second app so that this second app would not have to include hooks from some 3rd party test framework such as Squish.</p>

<p>Edit: I should add that the UI testing to be done will use a camera pointed at the a physical phone and then we want to be able to, remotely from a PC, generate simulated touches on the phone at specific screen coordinates based on where different UI elements are located using some machine vision.  So it's not strictly a software only setup, we have physical hardware in the loop.</p>
",https://stackoverflow.com/questions/50702208/generate-uitouch-event-from-an-app-in-ios-11,"['ios', 'uitouch', 'generate']",102,FALSE,1,0
Set identifiers for reusable tableViewCell dynamically,"<p>The tableViewCell contains two labels and the contents of the label are updated in each iteration. For UI testing, I need to set identifier of the labels to check if the content of the labels are same as those expected or not.
<strong>How can I set identifiers for the labels inside the reusable cell dynamically?</strong></p>

<pre><code>@interface MyDetailsTableViewCell : UITableViewCell

@property (weak, nonatomic) IBOutlet UIDLabel *myDetailsTitlelabel;
@property (weak, nonatomic) IBOutlet UIDLabel *myDetailsContentLabel;

@end
</code></pre>

<p>These are the two labels inside my tableViewCell. </p>
",https://stackoverflow.com/questions/48745216/set-identifiers-for-reusable-tableviewcell-dynamically,"['ios', 'objective-c', 'uitableview', 'ui-testing']",566,FALSE,1,1
How can we apply static analysis tool for robot framework rflint to all of the repository?,"<p>I'm using the rflint static analysis tool in order to improve the quality of my robot scripts and review its code for UI testing. </p>

<p>I use current code to get an output in cmd related to a specific file: </p>

<pre><code>rflint myTestSuite.robot
</code></pre>

<p>How can I apply it to the folder that contains all of my robot tests in just one click to get the result?</p>
",https://stackoverflow.com/questions/50807360/how-can-we-apply-static-analysis-tool-for-robot-framework-rflint-to-all-of-the-r,"['robotframework', 'static-analysis', 'lint']",1097,TRUE,0,1
How can I mark a test story as PENDING in JAVA,"<p>I am doing UI testing in JAVA selenium cucumber environment
How can I make the status of a test PENDING deliberately? Now I get FAILED and PASSED.
I need this feature temporarily, I know tests should only pass or fail and it's not a good choice to have other options. (I don't want to make any configurations in jenkins.)</p>

<p>Thank you</p>
",https://stackoverflow.com/questions/49909002/how-can-i-mark-a-test-story-as-pending-in-java,"['java', 'selenium', 'cucumber', 'scenarios']",1236,TRUE,-4,1
Can I use TestCafe for non-browser testing?,"<p>I have a test suite that requires a browser for UI testing. I also have a non-browser API test suite (HTTP requests/responses). </p>

<p>I would like to use TestCafe as my test runner for both test suites, but I don't want TestCafe to use a browser when executing the API HTTP tests. Is this not possible?</p>

<p>I couldn't find any TestCafe documentation for this use case. Thanks in advance!</p>
",https://stackoverflow.com/questions/52728914/can-i-use-testcafe-for-non-browser-testing,"['testing', 'browser', 'automated-tests', 'e2e-testing', 'testcafe']",1527,TRUE,3,2
How do I export a HAR file from CefSharp,"<p>I have CefSharp (WinForms) to display a browser for UI Testing. I want to implement some functionality to automatically save the network requests as HAR File - similar to chrome devtools, when you access the network tab. </p>

<p>I could not figure out if this is possible using some of the handlers in the CefSharp.WinForms.ChromiumWebBrowser (for example by implementing RequestHandler).  But there I do not see any timing information. </p>
",https://stackoverflow.com/questions/50701688/how-do-i-export-a-har-file-from-cefsharp,"['cefsharp', 'har']",448,FALSE,0,0
Can we automate website testing on a mobile device?,"<p>I am doing UI testing for a web application which needs to be tested on mobile devices as well. I have been using selenium for desktop testing, but I can't find any information on a mobile equivalent. I am learning swift and I'm experienced with java so if it's possible to do this,any pointers in the right direction would be of great help!</p>
",https://stackoverflow.com/questions/51064249/can-we-automate-website-testing-on-a-mobile-device,"['android', 'ios', 'selenium', 'automated-tests']",72,TRUE,-1,2
Writing tests for a basic jekyll site,"<p>I wanted to experiment on some UI testing on web, basically Jekyll, I found a blog <a href=""https://medium.com/espark-engineering-blog/testing-your-jekyll-site-the-ruby-way-ccfa386a8318"" rel=""nofollow noreferrer"">here</a> but my site won't build as it uses gulp to do so.</p>

<pre><code>Configuration file: /Users/rohithazra/Work/zivost/zivost-com/_config.yml
Generating site: /Users/rohithazra/Work/zivost/zivost-com -&gt; /Users/rohithazra/Work/zivost/zivost-com/_site
Capybara starting Puma...
* Version 3.12.0 , codename: Llamas in Pajamas
* Min threads: 0, max threads: 4
* Listening on tcp://127.0.0.1:56328
F

Failures:

  1) sample has the page title
     Failure/Error: visit '/'

     Selenium::WebDriver::Error::UnknownError:
       unknown error: unable to discover open pages
         (Driver info: chromedriver=2.0,platform=Mac OS X 10.14.0 x86_64)
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/response.rb:69:in `assert_ok'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/response.rb:32:in `initialize'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/http/common.rb:84:in `new'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/http/common.rb:84:in `create_response'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/http/default.rb:104:in `request'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/http/common.rb:62:in `call'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/bridge.rb:164:in `execute'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/bridge.rb:97:in `create_session'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/bridge.rb:53:in `handshake'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/chrome/driver.rb:48:in `initialize'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/common/driver.rb:44:in `new'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/common/driver.rb:44:in `for'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver.rb:86:in `for'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/capybara-3.9.0/lib/capybara/selenium/driver.rb:27:in `browser'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/capybara-3.9.0/lib/capybara/selenium/driver.rb:46:in `visit'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/capybara-3.9.0/lib/capybara/session.rb:265:in `visit'
     # /Users/rohithazra/.rvm/gems/ruby-2.5.1/gems/capybara-3.9.0/lib/capybara/dsl.rb:51:in `block (2 levels) in &lt;module:DSL&gt;'
     # ./spec/sample_spec.rb:3:in `block (2 levels) in &lt;top (required)&gt;'

Finished in 22.71 seconds (files took 3.81 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/sample_spec.rb:2 # sample has the page title
</code></pre>

<p>I am unsure on how to approach this and it would be helpful if someone can point me in the right direction.</p>

<p>code repo - <a href=""https://github.com/zivost/zivost-com"" rel=""nofollow noreferrer"">https://github.com/zivost/zivost-com</a> .<br>
I am writing the test code via the blog above.</p>
",https://stackoverflow.com/questions/52923471/writing-tests-for-a-basic-jekyll-site,"['ruby', 'testing', 'rspec', 'gulp', 'jekyll']",143,FALSE,0,0
How use Different code on UI test,"<p>I do Ui-testing on xamarin Forms on Mac
I have a login over Auth0 in the productive App at the Ui-test you can't test the Auth0 login. For that problem I built a <code>TestloginPage</code>. </p>

<p>How I can make that only on UI-test open the test Login Page and in the Productive app open the normal login page?</p>

<p>The UI- test is included in the solution with the app.</p>
",https://stackoverflow.com/questions/50060625/how-use-different-code-on-ui-test,['xamarin.forms'],116,TRUE,0,1
How can i use different source files with same class name in Xcode for mocking?,"<p>My Xcode project contains two target:</p>

<ul>
<li>main that contain the main source code</li>
<li>uiTest that contain code for ui testing</li>
</ul>

<p>So it has a file called <code>DIResolver</code> that used to provide my dependencies.
When i build main target it works fine but when i start UI tests i need to mock some dependencies.</p>

<p>The main question is: can i use the same filename in two different place (<code>real</code> and <code>mock</code> for example) resolving by scheme and how?</p>
",https://stackoverflow.com/questions/53653384/how-can-i-use-different-source-files-with-same-class-name-in-xcode-for-mocking,"['xcode', 'xcode-scheme']",47,FALSE,1,0
Xamerin UI Test project is not executing in Visual Studio 2017,"<p>I'm trying to automate UI testing of Xamarin forms (Android app emulator) using  Xamarin.UI.Tests and Visual Studio 2017. </p>

<p>I created a ""Xamarin.UI.Test"" project and write a test cases.  But Xamarin.UI.Tests are not running when I trying to run the test using visual studio 2017. When trying to run ""debug all test"" project will start in debug mode and stop immediately. There is no error in error console or output window of VS2017</p>
",https://stackoverflow.com/questions/52667158/xamerin-ui-test-project-is-not-executing-in-visual-studio-2017,"['xamarin.forms', 'android-emulator', 'ui-automation', 'xamarin.uitest']",665,TRUE,0,1
What is the root cause for org.openqa.selenium.WebDriverException error?,"<p>I encountered following error, during UI Testing. </p>

<blockquote>
  <p>org.openqa.selenium.WebDriverException: Element not found or not
  visible for xpath:
  (//div[@class='popupContent'])[last()]/div/div/div/div/div[2]/div/table/tbody
  Build info: version: '3.13.0', revision: '2f0d292', time:
  '2018-06-25T15:24:21.231Z' System info: host: 'x', ip: '172.25.x.x',
  os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1',
  java.version: '1.8.0_60' Driver info: driver.version: unknown</p>
</blockquote>

<p>Can anyone let me know what has caused this error?</p>

<p>Thank you</p>
",https://stackoverflow.com/questions/51979073/what-is-the-root-cause-for-org-openqa-selenium-webdriverexception-error,"['java', 'selenium', 'selenium-webdriver', 'webdriver']",1732,TRUE,0,2
Clarifications on Botium support,"<p>I'm evaluating Botium for chatbot testing. Could you please confirm if Botium supports below operations ?</p>

<ol>
<li><p>UI testing - Send request from ChatBot UI and capture the response from UI (Black box testing)</p></li>
<li><p>How Botium handles dynamic requests and dynamic responses  (Not static content requests/responses in the excel sheet). Dynamic requests/responses are prepared from difference sources like database, APIs etc.,</p></li>
</ol>

<p>Please let me know if more details are needed in this regard.</p>
",https://stackoverflow.com/questions/53811871/clarifications-on-botium-support,"['testing', 'chatbot']",201,FALSE,-2,1
how to correctly configure material-ui with create-react-app for testing?,"<p>I've made an example from the material-ui Testing page from the site. I've made the app using create-react-app and I've imported enzyme into my project.</p>

<pre><code>import { createMount } from '@material-ui/core/test-utils';
import MyComponent from './src/MyComponent';

describe('&lt;MyComponent /&gt;', () =&gt; {
  let mount;

 before(() =&gt; {
   mount = createMount();
});

after(() =&gt; {
   mount.cleanUp();
});

it('should work', () =&gt; {
   const wrapper = mount(&lt;MyComponent /&gt;);
 });
});
</code></pre>

<p>All my tests fail to run throwing the following error
    <code>ReferenceError: before is not defined</code></p>

<p>Everywhere I've read states that I don't need to configure jest, as it comes out of the box with create-react-app. Below is my package.json, how am I supposed to configure my application so I can run these tests?</p>

<pre><code>{
""name"": ""client"",
""version"": ""1.3.0"",
""private"": true,
""license"": ""private"",
""proxy"": {
    ""/media/*"": {
        ""target"": ""website""
    },
    ""/updates/*"": {
        ""target"": ""website""
    },
    ""/okta/*"": {
        ""target"": ""website""
    }
},
""homepage"": ""http:website"",
""dependencies"": {
    ""@material-ui/core"": ""^1.5.1"",
    ""@material-ui/icons"": ""^2.0.3"",
    ""axios"": ""^0.17.1"",
    ""lodash"": ""^4.17.4"",
    ""material-ui-pickers"": ""^1.0.0-beta.12"",
    ""materialize-css"": ""^0.100.2"",
    ""moment"": ""^2.20.1"",
    ""prop-types"": ""^15.6.0"",
    ""react"": ""^16.2.0"",
    ""react-addons-shallow-compare"": ""^15.6.2"",
    ""react-dates"": ""^16.0.1"",
    ""react-day-picker"": ""^7.0.7"",
    ""react-dom"": ""^16.2.0"",
    ""react-props"": ""^0.0.3"",
    ""react-redux"": ""^5.0.6"",
    ""react-router-dom"": ""^4.2.2"",
    ""react-scripts"": ""1.0.17"",
    ""react-with-direction"": ""^1.1.0"",
    ""redux"": ""^3.7.2"",
    ""redux-logger"": ""^3.0.6"",
    ""redux-saga"": ""^0.16.0"",
    ""redux-thunk"": ""^2.2.0"",
    ""universal-cookie"": ""^2.1.2"",
    ""video.js"": ""^6.6.0"",
    ""videojs-contrib-hls.js"": ""^3.1.0""
},
""scripts"": {
    ""start"": ""react-scripts start"",
    ""build"": ""react-scripts build"",
    ""test"": ""react-scripts test --env=jsdom"",
    ""eject"": ""react-scripts eject""
},
""devDependencies"": {
    ""jest-enzyme"": ""^6.0.4""
}
</code></pre>
",https://stackoverflow.com/questions/52649820/how-to-correctly-configure-material-ui-with-create-react-app-for-testing,"['reactjs', 'testing', 'jestjs', 'material-ui']",467,TRUE,1,1
Tool for Android and iOS app test automation?,"<p>Is there any tool for testing Android and iOS apps? I know of Appium but that is used for web apps. 
I'm looking for something which I can use to automate UI testing just like selenium for web but on Android and iOS apps. </p>

<p>Also, the company I work for only provides me access to the various app builds and not the code itself so I want to be able to just test the downloaded apps.</p>

<p>cheers</p>
",https://stackoverflow.com/questions/51839886/tool-for-android-and-ios-app-test-automation,"['android', 'ios', 'testing', 'ui-automation']",273,TRUE,-1,1
AWS device farm cannot find .xctest in ipa,"<p>I am using aws device farm to test my iOS and android application.</p>

<p>It asks for the .ipa for xctest and xctestUI test cases which I provide by compiling them in xcode and exporting them under adhoc distribution.</p>

<p>Every time I drag and drop it I get that either the plugin folder is missing (fo UI testing) or that the .xctest directory is missing.</p>

<p>Is there a way to have everything included when using xcode to export? </p>
",https://stackoverflow.com/questions/50504145/aws-device-farm-cannot-find-xctest-in-ipa,"['android', 'ios', 'amazon-web-services', 'device']",74,FALSE,0,0
What are the correct dependencies for Espresso tests?,"<p>On different official Android sites there is different information on how to set up Espresso tests:</p>

<p>1) <a href=""https://developer.android.com/training/testing/ui-testing/espresso-testing"" rel=""nofollow noreferrer"">https://developer.android.com/training/testing/ui-testing/espresso-testing</a></p>

<pre class=""lang-java prettyprint-override""><code>dependencies {
    // Other dependencies ...
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
</code></pre>

<p>2) <a href=""https://developer.android.com/studio/test/"" rel=""nofollow noreferrer"">https://developer.android.com/studio/test/</a></p>

<pre class=""lang-java prettyprint-override""><code>dependencies {
    // Required for local unit tests (JUnit 4 framework)
    testCompile 'junit:junit:4.12'

    // Required for instrumented tests
    androidTestCompile 'com.android.support:support-annotations:24.0.0'
    androidTestCompile 'com.android.support.test:runner:0.5'
}
</code></pre>

<p>3) <a href=""https://developer.android.com/training/testing/espresso/setup"" rel=""nofollow noreferrer"">https://developer.android.com/training/testing/espresso/setup</a></p>

<pre class=""lang-java prettyprint-override""><code>androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
</code></pre>

<ul>
<li><p>With some configurations I get library conflicts ((2) explains that this is due to dependencies requiring the same other dependency but with different versions).</p>

<ul>
<li>Even excluding with </li>
</ul>

<p><code>androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
}</code>
might not help.</p></li>
<li><p>With some configurations I get an error on the import of <code>android.support.test.rule.ActivityTestRule</code></p></li>
</ul>
",https://stackoverflow.com/questions/50179597/what-are-the-correct-dependencies-for-espresso-tests,"['dependencies', 'android-espresso']",3553,FALSE,0,3
IOS UI Test case for toggle button inside text field,"<p>I am using the XCTest framework which is the default testing framework for UI Testing in IOS. 
I am writing a test case to check whether the text inside the text field is visible or hidden by clicking the hide show toggle button.</p>

<p><img src=""https://i.stack.imgur.com/xMoTy.png"" alt=""IOS Toggle button inside text field""></p>

<p>The problem is that the toggle button is inside the text field and I am unable to access the toggle button.
On recording, it considers the tap on toggle button as tap on text field and generates code as follows :</p>

<pre><code>let secureTextField = element3.children(matching: .other).element(boundBy: 1).children(matching: .secureTextField).element
        secureTextField.tap()
</code></pre>
",https://stackoverflow.com/questions/48794528/ios-ui-test-case-for-toggle-button-inside-text-field,"['ios', 'xcode-ui-testing']",1602,TRUE,0,1
Getting Started Unit Testing Xamarin iOS,"<p>My question is about UI testing for Xamarion.iOS and Xamarion.Android.</p>

<p>I have an app for Android and iOS built using Xamarin.Android and Xamarin.iOS with a PCL.  These were not made using Xamarin.Forms.<br>
I've been trying to start UI unit testing the apps and I've read over NUnit, NUnitLite, and Xamarin.UITest and looking through guides on how to get the testing started but have been unsuccessful at starting my app's UI.</p>

<p>When I build a project with Xamarin.UITest, the Platform class does not exist and when attempting to do an Android test while pointing the app to the apk file, it wasn't successful.</p>

<p>I have created test projects for NUnit 3 platform-specific testing following this guide: <a href=""http://www.alteridem.net/2015/12/21/testing-xamarin-projects-using-nunit-3/"" rel=""nofollow noreferrer"">http://www.alteridem.net/2015/12/21/testing-xamarin-projects-using-nunit-3/</a> I can run the app, get to the page showing the tests passed/failed, but after that, I've been unable to wire up the UI.</p>

<p>I have not found any documentation on how to do UI testing in either Android or iOS. I've been over the MS's docs like on <a href=""https://learn.microsoft.com/en-us/xamarin/ios/deploy-test/touch.unit?tabs=vswin"" rel=""nofollow noreferrer"">https://learn.microsoft.com/en-us/xamarin/ios/deploy-test/touch.unit?tabs=vswin</a> </p>

<p>Can anyone shed some light on how I can start a simple UI test?  Preferably with NUnit 3.</p>
",https://stackoverflow.com/questions/52376184/getting-started-unit-testing-xamarin-ios,"['ios', 'unit-testing', 'xamarin']",473,TRUE,1,1
swing application opens and closes down immediately when invoked with assertJ command (TestNG + assertJ Swing),"<p>Trying assertJ-swing for UI testing of java-swing based application.</p>

<p><strong>Situation</strong>: Sample application in JavaApp.java (with Main class) works fine when it is invoked from this java file (running it as Java application). But when it is invoked from TestNG with assertj-swing's command:</p>

<pre><code>application(JavaApp.class).start(); 
</code></pre>

<p>the application opens up but closes down immediately.</p>

<p>Question: Is it the only approach? Please suggest resolution or any other approach to launch the application and keep it open so further operations can be performed.</p>

<p>JavaApp:</p>

<pre><code>package jdialogdemo;

import java.awt.*;
import java.awt.event.*;

import javax.lang.model.util.SimpleElementVisitor6;
import javax.swing.*;

public class JavaApp {
    public static void main(String[] args) throws Exception {
        final JFrame frame = new JFrame(""JDialog Demo"");
        final JButton btnLogin = new JButton(""Click to login"");

        btnLogin.addActionListener(
                new ActionListener(){
                    public void actionPerformed(ActionEvent e) {
                        LoginDialog loginDlg = new LoginDialog(frame);
                        loginDlg.setVisible(true);
                        // if logon successfully
                        if(loginDlg.isSucceeded()){
                            btnLogin.setText(""Hi "" + loginDlg.getUsername() + ""!"");
                        }
                    }
                });

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(700, 200);
        frame.setLocationRelativeTo(null);
        frame.setLayout(new FlowLayout());
        frame.getContentPane().add(btnLogin);
        frame.setVisible(true);
     }
}
</code></pre>
",https://stackoverflow.com/questions/49508432/swing-application-opens-and-closes-down-immediately-when-invoked-with-assertj-co,"['swing', 'user-interface', 'ui-testing', 'gui-testing', 'assertj']",231,FALSE,0,1
VSTS Build and Selenium,"<p>I am attempting to use Selenium to do some UI testing for a .net web app i am working on. 
Every build fails with ether no Tests to run in the new configuration or #[warning]DistributedTests: Error : Test run directory 'C:\temp\' does not contain any assemblies that match the specified criteria: '***test*.dll'. Verify that the test run directory contains the target assemblies and the source filter is correct.  in the deprecated version.</p>

<p>the test runs correctly when run from Visual Studio</p>
",https://stackoverflow.com/questions/48695251/vsts-build-and-selenium,"['selenium', 'azure-devops']",65,FALSE,-1,1
Disabling system animations make UI test fail Espresso?,"<p>My device: Samsung S8</p>

<p>The documentation of <a href=""https://developer.android.com/training/testing/espresso/setup#set-up-environment"" rel=""nofollow noreferrer"">Espresso setup instructions</a> say that</p>

<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>I followed Android UI testing tutorial from this <a href=""https://codelabs.developers.google.com/codelabs/android-testing/index.html#6"" rel=""nofollow noreferrer"">Android Testing Codelab</a>. But the test fail when i turn off the system animations. Instead the test passed when i turn on the system animations.</p>

<p>Animation: <strong>on</strong></p>

<pre class=""lang-none prettyprint-override""><code>Testing started at 7:44 PM ...

11/06 19:44:43: Launching addNoteToNotesList()
No apk changes detected since last installation, skipping installation of D:\Android\Exercise\android-testing-step-1-5\app\build\outputs\apk\prod\debug\app-prod-debug.apk
No apk changes detected since last installation, skipping installation of D:\Android\Exercise\android-testing-step-1-5\app\build\outputs\apk\androidTest\prod\debug\app-prod-debug-androidTest.apk
Running tests

$ adb shell am instrument -w -r   -e debug false -e class 'com.example.android.testing.notes.notes.NotesScreenTest#addNoteToNotesList' com.example.android.testing.notes.test/android.support.test.runner.AndroidJUnitRunner
Client not ready yet..
Started running tests
Tests ran to completion.
</code></pre>

<p>Animation: <strong>off</strong>
</p>

<pre><code>Testing started at 7:51 PM ...

11/06 19:51:04: Launching addNoteToNotesList()
No apk changes detected since last installation, skipping installation of D:\Android\Exercise\android-testing-step-1-5\app\build\outputs\apk\prod\debug\app-prod-debug.apk
No apk changes detected since last installation, skipping installation of D:\Android\Exercise\android-testing-step-1-5\app\build\outputs\apk\androidTest\prod\debug\app-prod-debug-androidTest.apk
Running tests

$ adb shell am instrument -w -r   -e debug false -e class 'com.example.android.testing.notes.notes.NotesScreenTest#addNoteToNotesList' com.example.android.testing.notes.test/android.support.test.runner.AndroidJUnitRunner
Client not ready yet..
Started running tests

android.support.test.espresso.PerformException: Error performing 'scroll RecyclerView to: holder with view: has descendant: with text: is ""UI testing for Android""' on view 'with id: com.example.android.testing.notes:id/notes_list'.
at android.support.test.espresso.PerformException$Builder.build(PerformException.java:82)
at android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:79)
at android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:51)
at android.support.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:312)
at android.support.test.espresso.ViewInteraction.desugaredPerform(ViewInteraction.java:173)
at android.support.test.espresso.ViewInteraction.perform(ViewInteraction.java:114)
at com.example.android.testing.notes.notes.NotesScreenTest.addNoteToNotesList(NotesScreenTest.java:128)
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 android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:527)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
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 android.support.test.runner.AndroidJUnit4.run(AndroidJUnit4.java:101)
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 android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:384)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2106)
Caused by: java.lang.RuntimeException: Found 0 items matching holder with view: has descendant: with text: is ""UI testing for Android"", but position -1 was requested.
at android.support.test.espresso.contrib.RecyclerViewActions$ScrollToViewAction.perform(RecyclerViewActions.java:361)
at android.support.test.espresso.ViewInteraction$SingleExecutionViewAction.perform(ViewInteraction.java:356)
at android.support.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:248)
at android.support.test.espresso.ViewInteraction.access$100(ViewInteraction.java:63)
at android.support.test.espresso.ViewInteraction$1.call(ViewInteraction.java:153)
at android.support.test.espresso.ViewInteraction$1.call(ViewInteraction.java:150)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Tests ran to completion.
</code></pre>

<p>I don't know what happened. The doc say to turn it off but it make the test fail. How can this happened ?</p>
",https://stackoverflow.com/questions/53172355/disabling-system-animations-make-ui-test-fail-espresso,"['android', 'android-espresso']",999,FALSE,2,0
How to access UIAPane items in UIAutomation,"<p>I recently started using UIAutomation framework for Powershell from MSDN, and i noticed that Get-Uiapane commandlet giving timeout error, 
i am running this command for UI Testing for audio page in dell systems. by inspector tool i get Hierarchy of the elements in the  window shown the hierarchy below. 
is there any idea wny get-UIapane is not working?  any thoughts..</p>

<ul>
<li>I can see Get-UIAwindow command let working with supported windows.</li>
</ul>

<p>Command i tried</p>

<blockquote>
  <p>Get-UiaPane -Class '#32770' -Name 'Dell Audio'</p>
</blockquote>

<p>Inspect Element output for this window.
<a href=""https://i.stack.imgur.com/aqN8l.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/aqN8l.png"" alt=""enter image description here""></a></p>
",https://stackoverflow.com/questions/51713945/how-to-access-uiapane-items-in-uiautomation,"['powershell', 'ui-automation', 'microsoft-ui-automation']",365,FALSE,1,0
Having same Unit/UI tests for both project Targets?,"<p>I want to add unit and UI testing to my iOS project on which it has 2 Targets A and B. A and B are flavors of the app with the same logic but with a different style (colors, fonts..).</p>

<p>When I try to add a Test target from the + button it asks me to choose a Target to be tested either A or B. my tests are the same on both targets. </p>

<p>This is where I am confused. How can I have same units tests across all targets? Thanks .</p>
",https://stackoverflow.com/questions/53904566/having-same-unit-ui-tests-for-both-project-targets,"['ios', 'swift', 'xcode', 'unit-testing']",178,FALSE,1,2
Applitools: How to implement it?,"<p>I would like to implement visual UI comparison but I don't have the idea on how to implement it. Anyone please give some idea on how to implement visual UI comparison. I know that need to compare the actual and expected screenshot but I don't know when to execute it (Whether it is different test cases or integrate it together to functional testing). </p>

<p>PS: I got an idea - Is it execute all functional testing first then execute visual UI testing? </p>

<p>Please provide some ideas. A billion thanks for your help.  </p>
",https://stackoverflow.com/questions/53844181/applitools-how-to-implement-it,"['java', 'im4java']",283,FALSE,-1,1
XCTest UI when using iOS Buttons,"<p>I'm doing some UI testing which is working in EN (Development language). But not so when tested with other languages. For example, the Cancel button in a SearchBar can be tapped by </p>

<pre><code>    app.buttons[""Cancel""].tap()
</code></pre>

<p>But in Spanish ""Cancel"" is actually ""Cancelar"" so the test fails to find the button when ran in Spanish.</p>

<p>One way would be to look for buttons by index but this is dangerous because it could break if Apple moves the button to a different index.</p>

<pre><code>app.buttons.element(boundBy: indexOfCancelButton).tap()
</code></pre>

<p>Is there an easier and more reliable way to handle this?</p>

<p>Thanks!</p>
",https://stackoverflow.com/questions/49312294/xctest-ui-when-using-ios-buttons,"['localization', 'xcuitest']",304,FALSE,0,1
How can I run multiple UI tests in a single browser?,"<p>first of all: I'm a student and I am trying to learn UI testing (I only understand the basics). I want to run multiple UI tests without closing the browser after every single test. I am using TestNG, arquillian and graphene, but I don't mind to switch to JUnit if that helps. What I've got so far is:</p>

<pre><code>public class ParentTest extends Arquillian
{
}


public class Test2and1 extends ParentTest
{
    @Test(dependsOnGroups = {""test1""})
    public void test2and1()
    {
        assertFalse(driver.getTitle().equals(""123""));
    }
}

public class Test1 extends ParentTest
{
    @Test(groups = {""test1""})
    public void test1()
    {
        assertFalse(driver.getTitle().equals(""123""));
    }
}
</code></pre>

<p>What I've tried as well is to bring the driver to the superclass <code>ParentTest</code>, but that gives the same result. I've searched the whole internet, but their solutions don't seem to work on my situation :(</p>
",https://stackoverflow.com/questions/52850150/how-can-i-run-multiple-ui-tests-in-a-single-browser,"['java', 'selenium', 'junit', 'testng', 'jboss-arquillian']",139,TRUE,0,2
XCUI Test fails due to MBProgressHud,"<p>I am running a XCUI test on a view controller. Every time the view is initialize, an api call is made and an MBProgressHud is shown. My test demands to search for a button and tap on it, however I can't tap since an overlapping MBProgressHud is shown and also the api doesn't receive the response it needs to show the button. This led to failure of test. </p>

<p>My questions is what I am doing wrong.</p>

<ol>
<li>Can we include this type of scenarios (like api calling) in our ui testing?</li>
<li>How to wait for the api call completion to continue our ui test?</li>
</ol>
",https://stackoverflow.com/questions/53786116/xcui-test-fails-due-to-mbprogresshud,"['ios', 'xcuitest']",112,TRUE,4,2
Simple integration testing using Flutter,"<p>I am testing a flutter application. I am to run an integration testing, just like Espresso and Selenium allow UI testing, based on my reading, I got to understand that testing Flutter UI will require setting up the integration model. In Selenium <code>findById</code> and Espresso, we can use , <code>R.id.unique_element_id</code>.</p>

<p>I have tried undertsanding the unique id to reference widgets in Flutter but do not understand. Any simple test for a form like this</p>

<pre><code>mainAxisAlignment: MainAxisAlignment.center,
          children: &lt;Widget&gt;[
            new Text(
              'You have pushed the button this many times:',
            ),
            new TextFormField(
              decoration: new InputDecoration(
                  labelText: 'Enter your username'
              ),
            ),
            new TextFormField(
              decoration: new InputDecoration(
                  labelText: 'Enter your phone number'
              ),
              keyboardType: TextInputType.number,
            ),

            new Text(
              '$_counter',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
</code></pre>

<p>Setup the test file like this</p>

<pre><code>    import 'package:flutter_driver/flutter_driver.dart';
    import 'package:test/test.dart';

    void main() {
      FlutterDriver driver;

      setUpAll(() async {
        driver = await FlutterDriver.connect();
      });

      tearDownAll(() async {
        if(driver != null){
          driver.close();
        }
      });


test('tap on the button, verify result', () async {
    final SerializableFinder username = find.byValueKey('usernametextfield');
    expect(username, isNotNull);
    //insert value into username

    final SerializableFinder phonenumber = find.byValueKey('phone');
    expect(phonenumber, isNotNull);
    //insert value into phonenumber
});
</code></pre>

<p>How do I create such a tetscase and run. the comments <code>//insert value into username</code> and <code>//insert value into phonenumber</code> are actual testcases I want to complete.</p>
",https://stackoverflow.com/questions/50472826/simple-integration-testing-using-flutter,"['widget', 'integration-testing', 'testcase', 'flutter-test']",2472,TRUE,3,3
How to test background audio in iOS UI Tests,"<p>I want to test various aspects of background music and speech in iOS UI Testing;</p>

<ul>
<li>is background music playing?</li>
<li>did music change on new scene?</li>
<li>does music mute on interruptions from phone call, FaceTime etc?</li>
<li>is speech uttered when required ?</li>
</ul>

<p>Can't seem to find any api documentation or tutorials that show how to do these types of tests.</p>

<p>Have tried the following code in my UI test class just to test if music is playing. The code attempts to either detect audioSession state (<code>audioSession.isOtherAudioPlaying</code>) or events related to playback (<code>AVAudioSessionInterruption</code>). Neither approach is detecting the music. </p>

<pre><code>override func setUp() {
    super.setUp()
    continueAfterFailure = false
    XCUIApplication().launch()

    app = XCUIApplication();
    NotificationCenter.default.addObserver(self, selector: #selector(self.handleInterruption(_:)), name: NSNotification.Name.AVAudioSessionInterruption, object: nil)

}

@objc func handleInterruption(_ notification: Notification) {

    print(""Received audio interrupt"", notification);

}

override func tearDown() {
    super.tearDown()
}


func testIsBackgroundMusicPlaying() {
    let audioSession: AVAudioSession = AVAudioSession.sharedInstance();

    if (audioSession.isOtherAudioPlaying) {
        print (""Other audio is playing"");
    }


}
</code></pre>

<p>Any suggestions?</p>
",https://stackoverflow.com/questions/48480237/how-to-test-background-audio-in-ios-ui-tests,"['ios', 'swift', 'avfoundation', 'ui-testing']",983,FALSE,3,0
How to check if intent (activity) contains string in it&#39;s package name (Espresso)?,"<p>I test my app with UI testing and would like to check if the camera app opens.</p>

<p>I have did this with:</p>

<pre><code>  @Test
  public void profileImageClickOpensCamera() {

        mIntentsRule.getActivity().startActivity(new Intent(mIntentsRule.getActivity(), ProfileActivity.class));

        onView(withId(R.id.circleProfileImage)).perform(click());
        intended(toPackage(""com.android.camera""));

    }
</code></pre>

<p><strong>It is working fine on most device</strong>s, however if I rain it on SAMSUNG Galaxy S8, which has <strong>""com.sec.android.app.camera"" package of it's camera app, the test fails.</strong></p>

<p>My question is, how could I check with espresso that <strong>the package contains the word ""camera"" ?</strong> </p>

<p>It's not the best solution because a device's camera app's package name could be anything, but even better then what I got know.</p>

<p><strong>So I would like to do something like:</strong></p>

<pre><code>intended(StringContains(toPackage(""com.android.camera"")));
</code></pre>

<p>Any suggestions? </p>

<p>Thanks in advance.</p>
",https://stackoverflow.com/questions/48563725/how-to-check-if-intent-activity-contains-string-in-its-package-name-espresso,"['android', 'camera', 'android-espresso', 'android-uiautomator']",859,TRUE,2,2
How to write test cases for buttons in another fragment in android?,"<p>I have multiple fragments in my main activity, and I'm using bottom navigation too.<br><br> I'm learning to write test cases with expresso for UI testing. I can test the buttons that are displayed on the opening fragment but the <code>OnView()</code> method only looks for views displayed currently in the view. How can I test the buttons in other fragments or activities ?<br><br> Do I have to navigate there first by using <code>performclick()</code> or do i have to load them through the <code>onData()</code> method ? Can anyone help me ? I've attached some pictures below to help you understand.</p>

<p>Opening Fragment:</p>

<p><a href=""https://i.stack.imgur.com/MvtZ4.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/MvtZ4.png"" alt=""openinig Fragment""></a></p>

<p>Second Fragment aka Devices fragment from the navbar:</p>

<p><a href=""https://i.stack.imgur.com/9gDgp.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/9gDgp.png"" alt=""second Fragment""></a></p>
",https://stackoverflow.com/questions/53621660/how-to-write-test-cases-for-buttons-in-another-fragment-in-android,"['android', 'unit-testing', 'user-interface']",182,TRUE,2,1
"after Maven job build success, Jenkins displayed failure with failed to parse POM","<p>Background info: </p>

<ol>
<li><p>I have a simple maven project on Mac using eclipse, doing ui testing.</p></li>
<li><p>setup jenkins server on localhost:8080  (with latest jenkins version)</p></li>
<li>configure Root POM as where the pom.xml is located locally(/Users/username/eclipse-workspace/ui-test/pom.xml)</li>
<li>It can build successfully with maven locally</li>
<li>also build successfully on Jenkins</li>
</ol>

<p>However, after the jenkins shows BUILD SUCCESS, it ""Waiting for Jenkins to finish collecting data"" then displays: </p>

<p>""ERROR: Failed to parse POMs
java.nio.file.NoSuchFileException: /Users/username/.jenkins/workspace/UI-Automation-Job/Users/username/eclipse-workspace/ui-test/pom.xml""</p>

<p>I'd appreciate your help. Thanks. </p>

<pre><code>---detailed jenkins log---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 43.119 s
[INFO] Finished at: 2018-03-29T17:19:40-04:00
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /Users/username/eclipse-workspace/ui-test/pom.xml to ui-test/ui-test/0.0.1-SNAPSHOT/ui-test-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving /Users/username/eclipse-workspace/ui-test/target/ui-test-0.0.1-SNAPSHOT.jar to ui-test/ui-test/0.0.1-SNAPSHOT/ui-test-0.0.1-SNAPSHOT.jar
/Users/username/eclipse-workspace/ui-test/pom.xml is not inside /Users/username/.jenkins/workspace/UI-Automation-Job/Users/username/eclipse-workspace/ui-test/; will archive in a separate pass
/Users/username/eclipse-workspace/ui-test/target/ui-test-0.0.1-SNAPSHOT.jar is not inside /Users/username/.jenkins/workspace/UI-Automation-Job/Users/username/eclipse-workspace/ui-test/; will archive in a separate pass
ERROR: Failed to parse POMs
java.nio.file.NoSuchFileException: /Users/username/.jenkins/workspace/UI-Automation-Job/Users/username/eclipse-workspace/ui-test/pom.xml
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
    at java.nio.file.Files.newByteChannel(Files.java:361)
    at java.nio.file.Files.newByteChannel(Files.java:407)
    at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
    at java.nio.file.Files.newInputStream(Files.java:152)
    at hudson.FilePath.read(FilePath.java:1849)
    at jenkins.plugins.maveninfo.extractor.properties.PomPropertiesFinder.findProperties(PomPropertiesFinder.java:50)
    at jenkins.plugins.maveninfo.extractor.MavenInfoExtractor.extract(MavenInfoExtractor.java:58)
    at jenkins.plugins.maveninfo.extractor.MavenInfoEnvironment.tearDown(MavenInfoEnvironment.java:42)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:908)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
    at hudson.model.Run.execute(Run.java:1727)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
channel stopped
....
....
</code></pre>
",https://stackoverflow.com/questions/49565479/after-maven-job-build-success-jenkins-displayed-failure-with-failed-to-parse-po,"['maven', 'jenkins']",1532,TRUE,1,1
How to tap on a specific point on Xcode simulator,"<p>I work with swift's UI testing, and I need to be able to tap a specific point on my app. I followed the answers from <a href=""https://stackoverflow.com/questions/36285090/how-to-tap-on-a-specific-point-using-xcode-uitests"">How to tap on a specific point using Xcode UITests</a>, which worked great for testing on iPad. However, when doing the same on the simulator nothing happens. No errors, the program simply acts like I'm pressing <em>something</em>, but not anything in particular, and the program can't continue executing since the right info isn't there.</p>

<p>Is this possibly a local problem? If not, what can I do to tap at specific coordinates on the simulator?</p>
",https://stackoverflow.com/questions/53186926/how-to-tap-on-a-specific-point-on-xcode-simulator,"['ios', 'swift', 'xcode', 'xctest', 'xcode-ui-testing']",971,FALSE,1,1
Trying to understand browser.elementIdText command,"<p>I couldn't find much information or useful examples to understand how this  method works on a Javascript UI testing framework. I have the following element which is returned in an array:</p>

<pre><code>console.log(elementarray[0]);

{ ELEMENT: '25',
  'element-6066-11e4-a52e-4f735466cecf': '25',
  selector: '[data=""abc""]',
  value: { ELEMENT: '25' },
  index: 0 }
</code></pre>

<p>however when I run:</p>

<pre><code>browser.elementIdText(elementarray[0].ELEMENT)
</code></pre>

<p>I see this:</p>

<pre><code>{ state: 'success',
  sessionId: 'af7ef2fb-7d1d-456e-ad14-c5c1fd9d83c2',
  hCode: 1013623656,
  value: '17:55',
  class: 'org.openqa.selenium.remote.Response',
  _status: 0 }
</code></pre>

<p>How exactly is browser.elementIdText working here, can anyone provide a simple explanation with an example pls. I see information here that I am not seeing when I log the first item in the array and surely the value of elementarray[0].ELEMENT is just 25 right? as it's shown in the first property of the object?</p>

<p>Thanks for any useful replies.</p>
",https://stackoverflow.com/questions/53160103/trying-to-understand-browser-elementidtext-command,"['javascript', 'selenium-webdriver', 'webdriver', 'nightwatch.js', 'webdriver-io']",837,TRUE,0,1
Cypress w/graphql - having issues getting AUTH with testing via UI. Better way to stub mutation?,"<p>So, if I am testing pages in a vacuum without much interaction with the backend, it works great. I am having issues with actually interacting with my UI if it hits any type of service. Basically, nothing is Auth'd. I try programmatically setCookie, no dice. I try to read the cookie, nope. Btw, my whole site requires a login.</p>

<pre><code>cy.setCookie('sess', ';askjdfa;skdjfa;skdjfa;skdjfa;skfjd');&lt;-- does not work

cy.getCookie('sess').should('exist') &lt;-- does not work
</code></pre>

<p>I am having an issue on really the best way to ""test"" this. For example, I have an account section that a user can ""update"" their personals. I try, fill out the form (via UI testing), but the submission is rejected, no Auth. EVEN THOUGH I just logged in (via UI testing). - I know I need to remove that since it is bad practice to UI-Login for every section of my site.</p>

<p>So, I don't know how to stub graphql calls with cy.request(). Here is my mutation.</p>

<pre><code>mutation Login($email: Email!, $password: String!) {
  login(email: $email, password: $password) {
    userID
    firstName
    lastName
  }
}
</code></pre>

<ol>
<li><p>Right now, I am importing the login spec for each section of the site i am testing. I know this is an anti-pattern. Like to solve this problem.</p></li>
<li><p>My AUTH (cookie) is not being set. Even when I try to set it, programmatically, doesn't work.</p></li>
<li><p>Maybe I should just stub out my graphql mutations? How?</p></li>
<li><p>Lastly, IF I am stubbing out my graphql mututations, how do I update the session ( via my main session query ). If I can get these mutations to work, then refreshing the page will get my my updated data, so I'm not completely needing this part.</p></li>
</ol>

<p>Any ideas?</p>
",https://stackoverflow.com/questions/51012988/cypress-w-graphql-having-issues-getting-auth-with-testing-via-ui-better-way-t,['cypress'],2343,TRUE,3,2
Simulate camera output on iOS,"<p>I'm currently trying to implement UI tests in my iOS app. An important feature of my app is the ability to let users scan QR codes so they can quickly retrieve the ID's of certain objects. I'm struggling to write tests for this however. What I would like to achieve is to supply mock images to the camera during UI testing so I can essentially simulate the scanning action. So far I haven't really been able to find anything that mentions whether it is even possible to supply image data to the camera, let alone how this would be implemented. </p>

<p>So my question is, is this even possible?</p>
",https://stackoverflow.com/questions/49252072/simulate-camera-output-on-ios,"['ios', 'avfoundation', 'xcode-ui-testing']",260,FALSE,2,0
Unable connect to page. Browserstack,"<p>I use protractor with Browserstack.exe for e2e (UI) testing.</p>

<p>I have to check authorization proccess. It goes in this way:</p>

<ol>
<li>go to domain/#login</li>
<li>redirect to auth0.com to get authorized (hosted auth0 authorization)</li>
<li>enter credentials</li>
<li>redirect to my angular client with finished authentification.</li>
</ol>

<p>I read that for testing separate login page we have to use 
browser.ignoreSynchronization = true;</p>

<p>Sometimes it works, some - not. 
I don't understand why and what depends on this.</p>

<p>I have this error while run protractor:
Expected '<a href=""http://localhost:8001/app/#/login"" rel=""nofollow noreferrer"">http://localhost:8001/app/#/login</a>' to contain 'domen.auth0.com'.</p>

<p>and this screen:
<a href=""https://i.stack.imgur.com/yTIBC.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/yTIBC.png"" alt=""browserstack screenshot""></a></p>

<p>my code :</p>

<pre><code>describe('[domain.reports]', function () {

    beforeAll(function() {
        // it makes protractor not wait for Angular promises
        // for testing separate login page.
        browser.ignoreSynchronization = true;
    });

    beforeEach(function () {
        browser.wait(browser.get('#/login'), 5000);
        expect(browser.getCurrentUrl()).toContain('domain.auth0.com');
    });

    it('should automatically redirect to /samples when location hash/fragment is empty', function () {

        var EC = protractor.ExpectedConditions;
        var el = element(by.css('.auth0-lock-submit'));
        browser.wait(EC.visibilityOf(el), 10000);
        protractor.loginHelpers.loginToPage('test_customer@gmail.com', 'Qazxsw123456');
        protractor.waitHelpers.waitForUrlToBeChanged(""/samples"");

        //browser.wait(browser.get('#/samples'), 5000);
        expect(browser.getCurrentUrl()).toMatch(""/samples"");
        browser.get('#/api');
        expect(browser.getCurrentUrl()).not.toContain(""/api"");
    });
});
</code></pre>

<p>It works at another scenarious... </p>

<p>Thank you in advise for any thoughts!</p>
",https://stackoverflow.com/questions/48189712/unable-connect-to-page-browserstack,"['angularjs', 'protractor', 'e2e-testing', 'browserstack', 'gulp-protractor']",623,FALSE,1,0
Xamarin UI Test: Is it possible to interact with the OS level dialogues during UITesting,"<p>Is it possible to automate OS level dialogues during xamarin UI testing?
I.E - Tap the upload button, which brings up a gallery modal which would allow you to select a photo of your choice to upload? Or tapping an overflow menu and be given the choice to open via external app, or go fullscreen?</p>

<p>Is it possible to automate the selection of the photo? Is it possible to trigger airplane mode so the app is offline during the test execution? I'm just trying to find out how limited i am when it comes to automating the app im responsible for as there are a few scenarios like this. </p>
",https://stackoverflow.com/questions/50620347/xamarin-ui-test-is-it-possible-to-interact-with-the-os-level-dialogues-during-u,"['c#', 'testing', 'xamarin', 'xamarin.forms', 'automated-tests']",806,TRUE,0,1
Concatenating Angular &lt;Routes&gt;array results in compile error,"<p>The application has standard routes which will be used by the customer and one for (UI) testing scoped modules (components) of the application. The developer must be able to use all the routes the customer has access to and additionally be able to acces the ""dev-routes"".</p>

<p>I've tried checking on the current environment and concatenating the two arrays (<em>of the same type</em>) into one array, this results in the compiler throwing an error:  </p>



<pre><code>webpack: Failed to compile.
webpack: Compiling...
Date: 2018-04-05T09:20:50.790Z - Hash: 4640ed7a42057bb6f11f - Time: 2046ms
6 unchanged chunks

ERROR in Cannot read property 'loadChildren' of undefined

webpack: Failed to compile.
</code></pre>

<p>This is the error in the browser:</p>

<p><a href=""https://i.stack.imgur.com/8kkq2.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/8kkq2.png"" alt=""Error log in inspector""></a></p>

<p>When the <code>.concat()</code> function is not used – simply by using only a ternary operator or by just having a dead simple routes variable – the routes do work as expected.</p>

<p><strong>app-routing.module.ts</strong></p>



<pre class=""lang-js prettyprint-override""><code>import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { environment } from '@app/environment';

const devRoutes: Routes = [
    {
        path: 'dev',
        loadChildren: 'app/families/dev/dev.module#DevModule'
    },
];

const routes: Routes = [
    {
        path: '',
        redirectTo: '',
        pathMatch: 'full'
    }
];

@NgModule({
    imports: [
        RouterModule.forRoot(environment.production ? routes : devRoutes.concat(routes))
    ],
    exports: [RouterModule]
})
export class AppRoutingModule {
}
</code></pre>

<p><strong>dev.module.ts</strong></p>

<pre class=""lang-js prettyprint-override""><code>import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { DevRoutingModule } from './dev-routing.module';
import { DevHomeComponent } from './dev-home/dev-home.component';
import { DevTypographyComponent } from './dev-typography/dev-typography.component';
import { DevInputComponent } from './dev-input/dev-input.component';
import { DevExecuteComponent } from './dev-execute/dev-execute.component';
import { DevColorComponent } from './dev-color/dev-color.component';
import { DevVariablesComponent } from './dev-variables/dev-variables.component';

@NgModule({
    imports: [
        CommonModule,
        DevRoutingModule
    ],
    declarations: [
        DevHomeComponent,
        DevTypographyComponent,
        DevInputComponent,
        DevExecuteComponent,
        DevColorComponent,
        DevVariablesComponent
    ]
})
export class DevModule {
}
</code></pre>

<p><strong>dev-routing.module.ts</strong></p>

<pre class=""lang-js prettyprint-override""><code>import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { DevHomeComponent } from './dev-home/dev-home.component';
import { DevTypographyComponent } from './dev-typography/dev-typography.component';
import { DevInputComponent } from './dev-input/dev-input.component';
import { DevExecuteComponent } from './dev-execute/dev-execute.component';
import { DevColorComponent } from './dev-color/dev-color.component';
import { DevVariablesComponent } from './dev-variables/dev-variables.component';

const routes: Routes = [
    {
        path: '',
        component: DevHomeComponent
    },
    {
        path: 'typography',
        component: DevTypographyComponent
    },
    {
        path: 'input',
        component: DevInputComponent
    },
    {
        path: 'execute',
        component: DevExecuteComponent
    },
    {
        path: 'colors',
        component: DevColorComponent
    },
    {
        path: 'variables',
        component: DevVariablesComponent
    }
];

@NgModule({
    imports: [RouterModule.forChild(routes)],
    exports: [RouterModule]
})
export class DevRoutingModule {
}
</code></pre>
",https://stackoverflow.com/questions/49668232/concatenating-angular-routesarray-results-in-compile-error,"['angular', 'angular2-routing']",590,FALSE,1,1
Cloning SOAP UI Test Steps using Groovy Script,"<p>Recently I have started to improve my SOAP UI testing projects by using Groovy Scripts. I am just on a beginner level more often amending and reusing scripts than creating ones of my own, hope that soon I will be able to create custom scripts :)</p>

<p>These days I have searched for a way to clone existing Test Steps from a Test Case into another Test Case. I have searched in the net for some ways or ready scripts that I can implement in my projects, but so far I have no luck finding what I need :(</p>

<p>Can you help me with this by showing me some examples how this can be done?</p>

<p>Kind regards,
Kristiyan</p>
",https://stackoverflow.com/questions/49673473/cloning-soap-ui-test-steps-using-groovy-script,"['groovy', 'soapui']",1241,TRUE,1,3
UITextFieldDelegate not called in XCTestCase,"<p>I'm just starting to get familiar with writing tests using <code>XCTestCase</code> and am exploring its capabilities. I have a simple (if contrived) app that loads a screen with a button and a textfield. When the textfield is selected the view controller populates the textfield:</p>

<pre><code>public func textFieldDidBeginEditing(_ textField: UITextField) {
    textField.text = ""abcd""
}
</code></pre>

<p>I also have functionality that selects the field when the button is pressed:</p>

<pre><code>@IBAction public func selectField(_ sender: Any?) {
    print(""button press"")
    textfield.becomeFirstResponder()
}
</code></pre>

<p>The code in my test case, programatically taps the button using <code>vc.button.sendActions(for: .touchUpInside)</code></p>

<p>However, it doesn't appear that the textfield ever becomes first responder and thus the delegate methods are not called. Below is the full test case class:</p>

<pre><code>var vc: ViewController!

override func setUp() {
    let sb = UIStoryboard(name: ""Main"", bundle: nil)
    vc = sb.instantiateInitialViewController() as? ViewController
    _ = vc.view
}

override func tearDown() {

}

func test_textfieldPopulatesOnSelection() {

    vc.button.sendActions(for: .touchUpInside)

    let expectation = XCTestExpectation(description: ""waiting for textfield to become first responder"")
    DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
        print(""textfield.text: \(self.vc.textfield.text ?? """")"")
        expectation.fulfill()
    }

    wait(for: [expectation], timeout: 13.0)
}
</code></pre>

<p>While I realize that I'm probably conflating the concepts of UI testing and unit testing, I'm still curious why my delegate methods are not being called.</p>
",https://stackoverflow.com/questions/53380233/uitextfielddelegate-not-called-in-xctestcase,"['swift', 'cocoa-touch', 'xctest', 'xctestcase']",1080,TRUE,0,2
Dagger 2. Empty test component unresolved,"<p>I've just started off compiling classes and modules for UI testing of android project. The one is using di and there is a necessity of injecting some dependencies in my tests. Right away I've faced some troubles resolving my test component. Trying to simplify the issue, I created an empty test and empty test component. Despite this the component stays unresolved while the same construct was successfully resolved inside the other android project.</p>

<p>In my opinion using such empty component allows to cut off the majority of places where the mistake can be hided except for gradle files (anyway it can be wrong). </p>

<p>Here are component and test class:</p>

<pre><code>class LoginTest {
    init {
        try {
            UiThreadStatement.runOnUiThread {
                val testTest: TestComponent = DaggerTestComponent
                    .builder()
                    .build()
            }
        } catch (throwable: Throwable) {
            throwable.printStackTrace()
        }
    }

    @Test
    fun test() {

    }
}

---------------------

@Component
interface TestComponent {

}
</code></pre>

<p>And here is an app gradle:</p>

<pre><code>apply plugin: 'com.android.application'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion configuration.compileSdkVersion
    buildToolsVersion configuration.buildToolsVersion

    defaultConfig {
        applicationId configuration.package
        minSdkVersion configuration.minSdkVersion
        targetSdkVersion configuration.targetSdkVersion
        versionCode configuration.versionCode
        versionName ""${configuration.versionMajor}"" +
                "".${configuration.versionMinor}"" +
                "".${configuration.versionPatch}""
        testInstrumentationRunner ""android.support.test.runner.AndroidJUnitRunner""
        vectorDrawables.useSupportLibrary = true
    }

    signingConfigs {
        debug {
            storeFile file(""debug.keystore"")
        }
        release {
            storePassword KEYSTORE_PASSWORD
            keyAlias KEY_ALIAS
            keyPassword KEY_PASSWORD
        }
    }

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

    flavorDimensions ""default""

    productFlavors {
        mock {
            dimension ""default""
            minSdkVersion configuration.minSdkVersion
            ext.enableCrashlytics = false
        }
        dev {
            versionNameSuffix ""-dev""
            applicationIdSuffix '.dev'
            minSdkVersion configuration.minSdkVersion
            ext.enableCrashlytics = false
        }
        prod {
            dimension ""default""
            minSdkVersion configuration.minSdkVersion
        }
    }

    kapt {
        generateStubs = true
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
        prod.java.srcDirs += 'src/prod/kotlin'
        dev.java.srcDirs += 'src/dev/kotlin'
        debug.java.srcDirs += 'src/debug/kotlin'
        test.java.srcDirs += 'src/test/kotlin'
        mock.java.srcDirs += 'src/mock/kotlin'
        androidTest.java.srcDirs += 'src/androidTest/kotlin'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    // Kotlin
    implementation ""org.jetbrains.kotlin:kotlin-stdlib-jdk7:$libraries.kotlin_version""

    // Support
    implementation ""com.android.support:appcompat-v7:$libraries.supportVersion""
    implementation ""com.android.support:design:$libraries.supportVersion""
    implementation ""com.android.support:recyclerview-v7:$libraries.supportVersion""

    // Rx
    implementation ""io.reactivex.rxjava2:rxjava:$libraries.rxjava""
    implementation ""io.reactivex.rxjava2:rxandroid:$libraries.rxandroid""
    implementation ""com.jakewharton.rxbinding2:rxbinding-kotlin:$libraries.rxbinding""
    implementation ""com.jakewharton.rxbinding2:rxbinding-design-kotlin:$libraries.rxbinding""
    implementation ""com.jakewharton.rxbinding2:rxbinding-recyclerview-v7-kotlin:$libraries.rxbinding""

    // OkHttpVersion
    implementation ""com.squareup.okhttp3:okhttp:$libraries.okhttpVersion""
    implementation ""com.squareup.okhttp3:logging-interceptor:$libraries.okhttpVersion""

    // Retrofit
    implementation ""com.squareup.retrofit2:converter-gson:$libraries.retrofit""
    implementation ""com.squareup.retrofit2:retrofit:$libraries.retrofit""
    implementation ""com.squareup.retrofit2:adapter-rxjava2:$libraries.retrofit""

    // Dagger
    implementation ""com.google.dagger:dagger:$libraries.dagger""
    implementation ""com.google.dagger:dagger-android-support:$libraries.dagger""
    kapt ""com.google.dagger:dagger-android-processor:$libraries.dagger""
    kapt ""com.google.dagger:dagger-compiler:$libraries.dagger_compiler""

    // Junit
    testImplementation ""junit:junit:$libraries.junitVersion""

    // Runner
    androidTestImplementation ""com.android.support.test:runner:$libraries.testRunner""

    // Espresso
    androidTestImplementation ""com.android.support.test.espresso:espresso-core:$libraries.espressoCore""

    // Spoon
    androidTestImplementation 'com.squareup.spoon:spoon-client:1.7.1'
}
</code></pre>

<p>UPD: The error is extremely uninformative and looks like:</p>

<pre><code>e: ...\LoginTest.kt: (11, 37): Unresolved reference: DaggerTestComponent
:app:compileMockDebugAndroidTestKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileMockDebugAndroidTestKotlin'.
&gt; Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
</code></pre>
",https://stackoverflow.com/questions/53633711/dagger-2-empty-test-component-unresolved,"['kotlin', 'android-testing', 'dagger']",191,TRUE,1,1
Some files not visible in xcode. But they are visible in finder,"<p>I am writing test cases for IOS. For that I created a new target for ""IOS UI Testing"" bundle and some files for writing test cases.
It created a folder ""UITests"" with some test files in it.</p>

<p>The problem is they are not visible in the xcode after xcode is restarted.
I am able to find the code in the finder and they are also recognized by the git. But not able to find them in the xcode</p>

<p>What might be the reason for this unpredictable behaviour?</p>

<p>Here's a screenshot of my xcode project, after I add the files manually.</p>

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

<p>Now, I can see the files, but I am unable to run my tests as it gives me error ""Cannot load underlying module for XCTest"".</p>
",https://stackoverflow.com/questions/48959706/some-files-not-visible-in-xcode-but-they-are-visible-in-finder,['xcode'],1298,TRUE,1,1
kGREYNoMatchingElementException is being raised even if element is present in hierarchy,"<p><strong>Code</strong></p>

<pre><code>    let label_interactable_matcher = grey_allOf([grey_accessibilityLabel(""お知らせ""), GREYMatchers.matcherForInteractable()])
    let action = GREYActions.actionForTap()
    EarlGrey.selectElement(with: label_interactable_matcher).atIndex(0).perform(action)
</code></pre>

<p><strong>Exception</strong></p>

<p>Exception Name: NoMatchingElementException
Exception Reason: Cannot find UI element.
Exception with Action: {
  ""Action Name"":  ""Tap"",
  ""Element Matcher"":  ""(((respondsToSelector(isAccessibilityElement) &amp;&amp; isAccessibilityElement) &amp;&amp; accessibilityLabel('お知らせ')) &amp;&amp; interactable)"",
  ""Recovery Suggestion"":  ""Check if the element exists in the UI hierarchy printed below. If it exists, adjust the matcher so that it accurately matches element.""
}</p>

<p>Exception Details: Error Trace: [
  {
    ""Description"":  ""Interaction cannot continue because the desired element was not found."",
    ""Error Domain"":  ""com.google.earlgrey.ElementInteractionErrorDomain"",
    ""Error Code"":  ""0"",
    ""File Name"":  ""GREYElementInteraction.m"",
    ""Function Name"":  ""-[GREYElementInteraction matchedElementsWithTimeout:error:]"",
    ""Line"":  ""124"",
    ""TestCase Class"":  ""MyAppTests.Myunittest"",
    ""TestCase Method"":  ""testExample""
  }
]</p>

<p><strong>View Hierarchy</strong></p>

<p>ECKit_iOS.IconButton:0x7f86af9aea00; AX=Y; AX.label='お知らせ'; AX.frame={{351, 81}, {55, 50}}; AX.activationPoint={378.5, 106}; AX.traits='UIAccessibilityTraitButton'; AX.focused='N'; frame={{0, 0}, {55, 50}}; alpha=1>
-UIButtonLabel:0x7f86aed75130; AX=Y; AX.label='お知らせ'; AX.frame={{362, 115}, {33, 10}}; AX.activationPoint={378.5, 120}; AX.traits='UIAccessibilityTraitStaticText'; AX.focused='N'; frame={{11, 34}, {33, 10}}; alpha=1; UIE=N; text='お知らせ'></p>

<p><strong>Screenshot At Failure</strong></p>

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

<p><strong>Concerns</strong></p>

<ol>
<li>There is a contradiction between view hierarchy &amp; exception being printed</li>
<li>If the exception is ""NoMatchingElementException"" why would Recovery Suggestion says ""Check if the element exists in the UI hierarchy printed below. If it exists, adjust the matcher so that it accurately matches element""</li>
<li>In my existing app after the installation if I add a new XCTestCase in UNIT TESTING TARGET, app show in black background(I was expecting it in white).</li>
<li>For the splash screen suggestion in <a href=""https://github.com/google/EarlGrey/blob/master/docs/faq.md#my-app-shows-a-splash-screen-how-can-i-make-my-test-wait-for-the-main-screen"" rel=""nofollow noreferrer"">FAQ</a>, the swift implementation solution seems difficult to implement(app module should be imported in testing module &amp; rootViewController class </li>
<li>Running the app by play button in unit testing target vs directly launching  the app. Unexpected black background appears instead of white one. <a href=""https://i.stack.imgur.com/huGWn.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/huGWn.png"" alt=""enter image description here""></a></li>
<li>We can't use autogenerated code from UI Testing Target in Unit Test Target &amp; Management of UI tests become difficult if we opt for both Xcode's UI Testing &amp; EarlGrey</li>
<li>Screenshot At Failure(Black screen) is contradicting with View Hierarchy</li>
</ol>
",https://stackoverflow.com/questions/51202584/kgreynomatchingelementexception-is-being-raised-even-if-element-is-present-in-hi,['earlgrey'],349,FALSE,0,1
How to log to the fastlane screengrab output,"<p>I am using fastlanes screengrab to capture screenshots of an app. screengrab is utilizing androids ui testing framework espresso to navigate through the app. if one of my ui tests fails I want the other tests to continue capturing screenshots but at the same time I want to be notified about the failed test.</p>

<p>To prevent the test to fail and stopping the whole program I surrounded all my tests with <code>try / catch</code>. When a test fails I want the the exception to be logged to the screengrab output:</p>

<pre><code>[10:24:37]: Running tests for locale: bs-BA  
[10:24:37]: $ adb -s emulator-5554 shell am instrument --no-window-animation -w \  
-e testLocale bs_BA \  
-e endingLocale en_US \  
-e class my.app.tests.MainLocationScreenshots \  
-e isScreengrab true \  
my.app.test/my.app.runners.RxTestRunner  
[10:24:40]: ▸ my.app.tests.MainLocationScreenshots:  
[10:24:41]: ▸ my.app.tests.MainLocationScreenshots:....  
[10:25:37]: ▸ Time: 42.311  
[10:25:37]: ▸ OK (7 tests)  
</code></pre>

<p>I tried the following without success:</p>

<pre><code>Log.d("""", ""Can you read this?????????"")
Log.d(""Screengrab"", ""Can you read this?"")
Log.println(Log.ERROR,""Screengrab"",""What about this?"")
System.out.print(""But I bet this works"")
</code></pre>

<p>All the <code>Log</code> calls appear in Logcat but not in the screengrab output, the <code>System.out.print</code> does not appear in either.</p>

<p>Is there a way to log the the screengrab output? Is it documented somewhere I haven't looked?</p>

<p>Thanks!</p>
",https://stackoverflow.com/questions/49487297/how-to-log-to-the-fastlane-screengrab-output,"['android', 'android-espresso', 'fastlane', 'screen-grab']",420,FALSE,3,0
Check for specific attribute/check for staleness of an element in puppeteer?,"<p>Hi I am a little new to this, but I am in the process of moving over from Selenium with Node.js over to Puppeteer for UI testing, I wanted to know what would be the best way to check in Puppeteer if an element has become stale (removed from the DOM) and also the best way to check for a change in an element specific attribute (e.g. if an element's opacity has changed from 0 to 1 or an element has become disabled)</p>

<p>Here are some examples of how I used to achieve the two in Selenium:</p>

<p>Check for attribute change -</p>

<pre><code>function waitForOpacity(driver, obj, time) {
  driver.wait(() =&gt; {
    return obj.getCssValue('opacity').then(opacity =&gt; opacity === '1')
  }, time)
} 

waitForOpacity(driver, submitButton, 30000)
submitButton.click()
</code></pre>

<p>Check for staleness of an element -</p>

<pre><code>function stalenessOf(driver, until, obj, time) {
 return driver.wait(until.stalenessOf(obj), time)
}

stalenessOf(driver, until, someModalElement, 60000)
</code></pre>

<p>I have tried something like this in Puppeteer -</p>

<pre><code>await page.waitForSelector('.myButton');
  await page.evaluate(() =&gt; {
    document.querySelector('.myButton').style.opacity === '1';
  }); 
  await page.click('.myButton');
</code></pre>

<p>However I don't think this is the right syntax...any help is appreciated, thanks so much!</p>
",https://stackoverflow.com/questions/50515682/check-for-specific-attribute-check-for-staleness-of-an-element-in-puppeteer,"['javascript', 'node.js', 'selenium', 'ui-testing', 'puppeteer']",970,TRUE,1,1
Selenium (Node.js) screenshots are too slow,"<p>I am using Selenium + Mocha (in Node.js) to do some UI testing on a site.  After each test, I want to capture a screen shot so that I can review/share the visible results.</p>

<p>However, after the basic UI changes are made (i.e. insert text and hit submit), there is an AJAX call + JavaScript animation that triggers after that I would like to be part of my screen shot.</p>

<p>The screenshots I'm getting appear to be in taken after the next step has already started. (So, the first test runs > trigger the screenshot > second test starts > screenshot is actually captured)</p>

<p>I've tried <code>.sleep()</code> and timeouts -- however my use could have been wrong.</p>

<pre class=""lang-js prettyprint-override""><code>function takeScreenshot(name='out'){
      driver.takeScreenshot().then(function(data){
        var base64Data = data.replace(/^data:image\/png;base64,/,"""")
        fs.writeFile(`screenshots/${name}.png`, base64Data, 'base64', function(err) {
          if(err) console.log(err);
        });
      });
}

describe('UI Tests', async function() {

  before(async function() {
    driver = await new Builder().forBrowser('chrome').build();
    await driver.get('http://localhost:8000').then( async function(){ await getAssets(); });
    /* search | submit | reset are declared in getAssets() */
  });

  after(async function() {
    driver.quit();
  });

  afterEach(async function(){
    step++;
    driver.sleep(3000).then(
      takeScreenshot(step) 
    );
  });

  describe('User Types/Modifies Input and Submits Query', async function() {

    it('type in search + click submit', async function(){
        search.sendKeys(""Puppies and Kittens"");
        submit.click();
    });

    it('click the X icon to clear search', async function(){
        reset.click();
    });

  });

});
</code></pre>

<p>In the above snippet, the screenshot for the first test (<code>'type in search + click submit'</code>) would show the input field already cleared from the second test.</p>
",https://stackoverflow.com/questions/49183379/selenium-node-js-screenshots-are-too-slow,"['javascript', 'node.js', 'selenium', 'mocha.js', 'screenshot']",1406,TRUE,1,1
Object is found but click does not happen,"<p>I am using <code>selenium</code> and <code>python</code> to do UI testing of my application.
The click works for some objects but not all.
This is the simplest form I have tried:</p>

<pre><code>element = self.driver.findElement(By.xpath(""(//a[contains(@id,'col1') and 
[starts-with(.,'"" + text + ""')])[1]""))              
element.click()
</code></pre>

<p>One issue that I have come across when I have tried to see if the <code>xpath</code> works is the following:<br>
I manually clear the browsing data, log into my application, search for the object of interest.<br>
Object is found.<br>
I use the chrome developers tool and go to the Console and try the following xpath: </p>

<pre><code>$x('//a[contains(@id,""col1"") and starts-with(.,""Auto_Smk_SETask"")][1]') 
</code></pre>

<p>but no match is found.<br>
I then go to Elements tab and select the object.
I go back to the Console and try the same xpath and this time it works.<br>
Why is that the case? 
I have spent many hours on this with no luck!!!         </p>
",https://stackoverflow.com/questions/53733452/object-is-found-but-click-does-not-happen,"['selenium', 'xpath', 'click']",68,TRUE,0,1
Can a Binding value be created as a XAML Page resource?,"<p>Hi for rapid UI testing of Binding data at design-time in a UWP app, I was wondering if there was a way to create Binding values as resources in XAML.   So instead of having to create a model, instantiate that model at design-time in Page.Resources, I just wanted to create essentially some constants I could use as Bindings.</p>

<p>Here are some examples of where I’d like the test bindings to work:</p>

<pre><code>&lt;TextBlock Text=""{Binding title, ConverterParameter=lower, Converter={StaticResource StringFormatConverter}, Mode=TwoWay}"" /&gt;

&lt;TextBlock Text=""{Binding title}"" /&gt;
</code></pre>

<p>Given that scenario is there a way I could say define title as a named key with a string value that would work above?</p>

<p>Note that I am using Binding and not x:Bind since I want to use design-time data and I don’t want to have to rely on using the FallbackValue parameter.</p>

<p>Thanks for any ideas!</p>

<p>Rick</p>
",https://stackoverflow.com/questions/48957899/can-a-binding-value-be-created-as-a-xaml-page-resource,"['xaml', 'binding', 'uwp', 'design-time']",512,TRUE,0,1
Espresso: Ignore AppNotIdleException,"<p>I have written a UI Testing framework using Espresso to read CSV files and run certain UI commands. I would like this to be able to run all day and all night testing the UI and calling the API and just trying to break it.</p>

<p>I am using wait(), although I know it is actively discouraged, because the system creates and prints physical paper tickets meaning that espresso tends to move too quickly and because it needs to run for a long time and we don't want millions of tickets created. It's not very efficient to try and stay within the 60 seconds espresso gives you before AppNotIdleException is thrown, so I'm wondering if there is a way to deactivate this or to extend it or to catch the exception and deal with it another way</p>
",https://stackoverflow.com/questions/48281161/espresso-ignore-appnotidleexception,"['java', 'android', 'android-espresso']",323,TRUE,0,2
Unable to use Alamofire in an xcode UI Test with Swift,"<p>The issue I am having is getting <code>Alamofire</code> to work with the xcode UI Testing. </p>

<p>I have isolated the parts down as much as I can to try and identify where the issue might be, but still can't solve this one. With a new xcode project using swift, I can use <code>Alamofire</code> as expected with the main <code>ViewController.swift</code> and the <code>func viewDidLoad()</code> function okay, but when creating a UI Test, I am unable to use the same code in the <code>func testExample()</code> function.</p>

<p><strong>Versions of tools used:</strong>    </p>

<pre><code>Xcode     = 9.2(9C40b)    
Swift     = 4.0
cocoapods = 1.4.0     
macOS     = High Sierra Version 10.13.2 (17C205)  
Alamofire = 4.5    
</code></pre>

<p><strong>ViewController.swift - Working okay</strong>       </p>

<pre><code>import UIKit
import Alamofire

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

        Alamofire.request(""https://httpbin.org/get"").responseJSON { response in
            print(""Request: \(String(describing: response.request))"")   // original url request
            print(""Response: \(String(describing: response.response))"") // http url response
            print(""Result: \(response.result)"")                         // response serialization result

            if let json = response.result.value {
                print(""JSON: \(json)"") // serialized json response
            }

            if let data = response.data, let utf8Text = String(data: data, encoding: .utf8) {
                print(""Data: \(utf8Text)"") // original server data as UTF8 string
            }

        }


    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}
</code></pre>

<p><strong>Result</strong> </p>

<blockquote>
  <p>Request: Optional(<a href=""https://httpbin.org/get"" rel=""nofollow noreferrer"">https://httpbin.org/get</a>)
  Response: Optional( { URL: <a href=""https://httpbin.org/get"" rel=""nofollow noreferrer"">https://httpbin.org/get</a> } { Status Code: 200, Headers {
      ""Access-Control-Allow-Credentials"" =     (
          true
  etc...</p>
</blockquote>

<p><strong>UITestExample() - Not Working</strong>   </p>

<pre><code>//
//  exalamUITests.swift
//  exalamUITests
//


import XCTest
import Alamofire

class exalamUITests: XCTestCase {

    override func setUp() {
        super.setUp()

        // Put setup code here. This method is called before the invocation of each test method in the class.

        // In UI tests it is usually best to stop immediately when a failure occurs.
        continueAfterFailure = false
        // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
        XCUIApplication().launch()

    // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp     method is a good place to do this.
    }

    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }

    func testExample() {
        Alamofire.request(""https://httpbin.org/get"").responseJSON { response in
            print(""Request: \(String(describing: response.request))"")   // original url request
            print(""Response: \(String(describing: response.response))"") // http url response
            print(""Result: \(response.result)"")                         // response serialization result

            if let json = response.result.value {
                print(""JSON: \(json)"") // serialized json response
            }

            if let data = response.data, let utf8Text = String(data: data, encoding: .utf8) {
                print(""Data: \(utf8Text)"") // original server data as UTF8 string
            }

        }
    }

}
</code></pre>

<p><strong>Result</strong>  </p>

<pre><code>2018-01-29 14:55:25.974425+1000 exalamUITests-Runner[12450:454722] +[CATransaction synchronize] called within transaction
2018-01-29 14:55:26.022366+1000 exalamUITests-Runner[12450:454722] Running tests...
2018-01-29 14:55:29.229531+1000 exalamUITests-Runner[12450:454722] Continuing to run tests in the background with task ID 1
Test Suite 'Selected tests' started at 2018-01-29 14:55:29.896
Test Suite 'exalamUITests.xctest' started at 2018-01-29 14:55:29.900
Test Suite 'exalamUITests' started at 2018-01-29 14:55:29.902
Test Case '-[exalamUITests.exalamUITests testExample]' started.
    t =     0.00s Start Test at 2018-01-29 14:55:29.908
    t =     0.17s Set Up
    t =     0.18s     Open Company.exalam
    t =     0.28s         Launch Company.exalam
    t =     6.39s             Wait for Company.exalam to idle
    t =     9.13s Tear Down
Test Case '-[exalamUITests.exalamUITests testExample]' passed (9.339 seconds).
Test Suite 'exalamUITests' passed at 2018-01-29 14:55:39.244.
     Executed 1 test, with 0 failures (0 unexpected) in 9.339 (9.342) seconds
Test Suite 'exalamUITests.xctest' passed at 2018-01-29 14:55:39.245.
     Executed 1 test, with 0 failures (0 unexpected) in 9.339 (9.346) seconds
Test Suite 'Selected tests' passed at 2018-01-29 14:55:39.249.
     Executed 1 test, with 0 failures (0 unexpected) in 9.339 (9.353) seconds


Test session log:
/var/folders/ys/9lh0sqdd62s03g_d10zs46z00000gn/T/com.apple.dt.XCTest/IDETestRunSession-8C0D5A43-AB22-47EA-88C7-6AB878853EBF/    exalamUITests-9DA87773-7D75-4A9A-8127-BAE3CAB18354/Session-exalamUITests-2018-01-29_145508-bLBnaC.log
</code></pre>

<p><strong>Podfile</strong>   </p>

<pre><code># Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'exalam' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  pod 'Alamofire', '~&gt; 4.5'

  # Pods for exalam

  target 'exalamTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'exalamUITests' do
    inherit! :search_paths
    use_frameworks!
    pod 'Alamofire', '~&gt; 4.5'
    # Pods for testing
  end

end
</code></pre>

<p><a href=""https://stackoverflow.com/questions/36949190/using-alamofire-in-ui-test-target"">This Question</a> was similar, but it is over a year old and I thought I could add more detail.</p>

<p>I'm new to Mac, swift, xcode, and cocoapods, but I have tried all similar S.O. related answers already and tried many different things. 
(Usually work in python and linux)</p>

<p>Any help would be very much appreciated. </p>
",https://stackoverflow.com/questions/48494761/unable-to-use-alamofire-in-an-xcode-ui-test-with-swift,"['swift', 'xcode', 'cocoapods', 'alamofire', 'xcode-ui-testing']",1182,TRUE,5,1
Espresso always gives me success whether dialog having text success or fail,"<p>I am using Espresso for my UI testing, I am new to this framework, I have written some code by doing some research and tried to run the code. I am trying to get the existence of dialog after API get hit. In my case, the dialog text for success is ""success"" and for failure is ""Failure"". But my test is giving me the green flag for both the cases it's showing that the test has been passed, Even if my condition does not match with the expected result.</p>

<p>Here is the code:-</p>

<pre><code>@RunWith(AndroidJUnit4.class)
public class LoginActivityTest {
    String emailAddress,password;
    @Rule
    public ActivityTestRule&lt;LoginActivity&gt; mActivityRule =
            new ActivityTestRule&lt;&gt;(LoginActivity.class);

    @Before
    public void prepareData(){
         emailAddress = ""dsf@gmail.com"";
         password = ""Password123#"";
        onView(withId(R.id.et_email)).perform(typeText(emailAddress), closeSoftKeyboard());
        onView(withId(R.id.et_password)).perform(typeText(password), closeSoftKeyboard());
    }

    @Test
    public void clickSignUpButtonAfterFillingForm_showProgressAndSuccessScreen() {

        onView(withId(R.id.btn_login)).perform(click());
//        onView(withId(R.id.tv_login_email_error)).check(matches(not(isDisplayed())));
//        onView(withId(R.id.tv_login_password_error)).check(matches(not(isDisplayed())));

        try {
            Thread.sleep(2000);
            onView(withText(""Faliure""))
                    .inRoot(isDialog()) // &lt;---
                    .check(matches(isDisplayed()));
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
</code></pre>

<p>The credentials I have passed is correct and as per my condition, the test should get fail as I am expecting a dialog with text ""Failure"" but as the credentials, I am filling is correct so the dialog will come up with ""success"" message.</p>

<p>Can anyone let me know what i am doing wrong in the code ?</p>

<p>Regards</p>
",https://stackoverflow.com/questions/51401317/espresso-always-gives-me-success-whether-dialog-having-text-success-or-fail,"['android', 'dialog', 'android-espresso']",120,FALSE,0,0
The bundle “MyProjectUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle,"<p>I'm willing to add unit and UI tests to my app.</p>

<p>I first configured unit tests with success, I tried to do the same with UI tests. Here is my Podfile, after adding a new UI Testing Bundle target :</p>

<pre><code>platform :ios, '8.0'
use_frameworks!
inhibit_all_warnings!

def shared_pods
pod 'Bolts'
pod 'Branch'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
pod 'GoogleAnalytics'
pod 'GooglePlaces'
pod 'Parse'
pod 'Toast-Swift'
end

target 'MyTarget' do
shared_pods
end

target 'MyTargetUITests' do
shared_pods
end

target 'MyTargetUnitTests' do
shared_pods
end
</code></pre>

<p>However, when I try to run the automatically created <code>MyProjectUITests</code> test case, which only contains the basic setup and without even a <code>@testable import MyProject</code>:</p>

<pre><code>import XCTest

class MyProjectUITests: XCTestCase {

    override func setUp() {
        continueAfterFailure = false
        XCUIApplication().launch()
    }
}
</code></pre>

<p>I'm getting this error: </p>

<blockquote>
  <p>Running tests...
  The bundle “MyProjectUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.</p>
  
  <p>(dlopen_preflight(/var/containers/Bundle/Application/5A1FE39F-E675-4A47-9BF4-FBCDB96F5821/MyProjectUITests-Runner.app/PlugIns/MyProjectUITests.xctest/MyProjectUITests): Library not loaded: @rpath/libswiftSwiftOnoneSupport.dylib</p>
  
  <p>Referenced from: /private/var/containers/Bundle/Application/5A1FE39F-E675-4A47-9BF4-FBCDB96F5821/MyProjectUITests-Runner.app/PlugIns/MyProjectUITests.xctest/Frameworks/Toast_Swift.framework/Toast_Swift</p>
  
  <p>Reason: image not found)</p>
</blockquote>

<p>What is wrong? Thanks for your help.</p>

<p><strong>EDIT</strong> : for information, it works fine when I remove that <code>Toast_swift</code> pod from my UI test target and let it only in my app and unit test targets.</p>
",https://stackoverflow.com/questions/52666055/the-bundle-myprojectuitests-couldn-t-be-loaded-because-it-is-damaged-or-missin,"['ios', 'xcode-ui-testing']",4004,TRUE,4,3
What decides which part of the common XAML controls is accessible through UIAutomation,"<p>I am trying to automate UI testing through <code>WinAppDriver</code> of a UWP app. The doc says that anything that is visible through the <code>inspect.exe</code> (i.e <code>UIAutomation</code>) could be controlled through <code>WinAppDriver</code>. This means the basic controls can be accessed through UIAutomation. And sometimes even content within these controls is accessible through UI Automation. Like the header for a <code>TextBlock</code> or <code>ToggleSwitch</code>, or the popup of a <code>ComboBox</code>.</p>

<p>Encouraged with this, I am modified the <code>ControlTemplate</code> of the common controls to make certain elements of the control visible through UIAutomation. See the example of <a href=""https://github.com/Microsoft/WinAppDriver/issues/404"" rel=""nofollow noreferrer""><code>ToggleSwitch</code></a> (The default <code>ControlTemplate</code> does not expose the <code>OnContent</code> and <code>OffContent</code> properties of the <code>ToggleSwitch</code> as it is marked with <code>AutomationProperties.AutomationView = ""Raw""</code>)</p>

<p>However, when I <a href=""https://social.msdn.microsoft.com/Forums/windowsapps/en-US/512d6607-99fd-4363-9482-270a2f7da901/unable-to-access-xaml-elements-in-combobox-header-through-uiautomation?forum=windowsaccessibilityandautomation"" rel=""nofollow noreferrer"">attempted</a> to get the header of the <code>ComboBox</code>, I could not access it through <code>UIAutomation</code>. </p>

<pre><code>&lt;ComboBox x:Name=""Box""&gt;
    &lt;ComboBox.Header&gt;
        &lt;StackPanel Orientation=""Horizontal""&gt;
            &lt;TextBlock Text=""This is a combobox"" x:Name=""Block"" AutomationProperties.Name=""TextBlock1"" /&gt;
            &lt;FontIcon VerticalAlignment=""Top""
                      AutomationProperties.AutomationId=""Error""
                      FontFamily=""Segoe MDL2 Assets""
                      Margin=""2 0""
                      Glyph=""&amp;#xEB90;""
                      x:Name=""FontIcon""
                      Foreground=""DarkRed""/&gt;
        &lt;/StackPanel&gt;
    &lt;/ComboBox.Header&gt;
    &lt;ComboBoxItem&gt;Green&lt;/ComboBoxItem&gt;
    &lt;ComboBoxItem&gt;Red&lt;/ComboBoxItem&gt;
&lt;/ComboBox&gt;
</code></pre>

<p>The <code>ControlTemplate</code> looks similar to other controls like <code>ToggleSwitch</code> and <code>TextBox</code>, but for whatever reason nothing defined in the <code>ControlTemplate</code> is made accessible to <code>UIAutomation</code>, except for the id and the popup list for <code>ComboBox</code>. So my question is what makes certain UI control expose their content (say <code>Header</code>) and some other not?</p>
",https://stackoverflow.com/questions/50780541/what-decides-which-part-of-the-common-xaml-controls-is-accessible-through-uiauto,"['ui-automation', 'uwp-xaml', 'controltemplate', 'microsoft-ui-automation', 'winappdriver']",197,FALSE,2,0
How to get IE and/or Edge console logs using Selenium,"<p>I am making a selenium test suite (automated UI testing framework) using python. I want to get the browser console logs for my tests run on the IE and Edge webdrivers. To do this in chrome I do something like:</p>

<pre><code>self.browser = webdriver.Chrome
d = DesiredCapabilities.CHROME  # Start with default Chrome capabilites
d['loggingPrefs'] = {'browser': 'ALL'}  # Add flag to track logs
# And then later on I dump logs with the return value from this selenium method:
self.browser.get_log('browser')
</code></pre>

<p>I have read a ton of old posts saying that IE doesn't support Getting console logs. I say old because the newest post I could find was from 2015. I was wondering if that has changed? Does anyone working with a modern selenium test suite know how to get console logs from the IE webdriver? Or Edge? Using a similar <code>self.browser.get_log('browser')</code> on Edge gives me an error ""Not implemented""</p>

<p>Is there no point in trying to get console logs from IE/Edge? Or is there a workaround I am not aware of?</p>

<p>After discussion below I have tried a solution involving overriding the console.log method but I cant seem to figure out how to return the value to the webdriver. This is what I did:</p>

<pre><code>    driver.execute_script('x = {}')  # Make an empty JS dict
    # Override the console.log method. This just appends the msg to x as an incrementing key
    driver.execute_script(""console.log = function(msg){var key=Object.keys(x).length + 1; x[key] = msg;}"")
    driver.execute_script('console.log(""whatever"")')  # Log something
    print(driver.execute_script('x'))  # I thought this would return the value of ""x"" but it returns None
</code></pre>
",https://stackoverflow.com/questions/53104271/how-to-get-ie-and-or-edge-console-logs-using-selenium,"['python', 'selenium', 'selenium-webdriver', 'logging']",1141,FALSE,2,0
Fluent API how to handle splits to different types,"<p>I'm using Fluent API as part of Selenium UI testing I'm doing in a project.
I read this article as a reference to fluent api <a href=""https://scottlilly.com/how-to-create-a-fluent-interface-in-c/"" rel=""nofollow noreferrer"">Scott Lilly Fluent API</a>.
The purpose is to control the flow of the tests and to make it as readable as possible.<br>
I have a simple wizard as you can see in the picture.
login page directs to the first page which directs to the second page (so far everything is simple) but the issue starts with the second page that can take you back to the first page or to the last page.
so I wonder what should I return to let the user both options but only those options?</p>

<p>I would for it to look something like this:</p>

<pre><code>DoLogin().WithText().FillForm().GoToSecondPage().FillForm().xxx 
</code></pre>

<p>xxx = here I want to have both options to go back to the first page or to the last page</p>

<p>In code its looks something like this so far:</p>

<pre><code>public interface IFirstPage
{
    void WithText();
    IGoToSecondPage FillForm();
}

public interface ISecondPage
{
    //Here starts the problem
    //From this page you can go back to the first page or continue to the last page

    Object FillForm();
}

public interface ILastPage
{
    void SetSomething();
    IGoToSecondPage FillForm();
}

public interface IGoToSecondPage
{
    void GoToSecondPage();
}

public interface IGoToFirstPage
{
    void GoToFirstPage();
}

public interface IGoToLastPage
{
    void GoToSecondPage();
}

public class FirstPage : IFirstPage
{
    public void WithText()
    {
    }

    public IGoToSecondPage FillForm()
    {
        throw new System.NotImplementedException();
    }
}

public class SecondPage : ISecondPage
{
    public object FillForm()
    {
        throw new NotImplementedException();
    }
}
</code></pre>

<p><a href=""https://i.stack.imgur.com/igDed.jpg"" rel=""nofollow noreferrer"">Wizard pages flow</a></p>
",https://stackoverflow.com/questions/48470247/fluent-api-how-to-handle-splits-to-different-types,"['c#', 'selenium', 'testing', 'fluent', 'method-chaining']",115,FALSE,0,1
UI tests fail on Fastlane/CircleCI because no location is set on a fresh simulator,"<p>Currently our tests fail because when location permissions are granted, we never progress to the next screen because a location update never happens.</p>

<p>This is because a fresh simulator instance set up with Fastlane doesn't set a location. The app target scheme specifies a default location, and so does the UI testing target; neither are honoured. The locations DO get honoured when the tests are run from Xcode, just not when the simulator activates from the command line, because the simulator app never actually opens, just exists, owned by terminal but not visible. The location on the test suite is also set.</p>

<p>How can I set the location of the simulator in a script that will be honoured when the simulator runs in a non-visible way?</p>

<p>I've found this: <a href=""https://github.com/lyft/set-simulator-location"" rel=""noreferrer"">https://github.com/lyft/set-simulator-location</a></p>

<p>It requires this script:</p>

<pre><code># download set-simulator-location
brew install lyft/formulae/set-simulator-location

# run simulator
export IOS_SIMULATOR_UDID=`instruments -s devices | grep ""iPhone 6 (10.3) \["" | awk -F '[ ]' '{print $4}' | awk -F '[\[]' '{print $2}' | sed 's/.$//'`
echo $IOS_SIMULATOR_UDID
open -a ""simulator"" --args -CurrentDeviceUDID $IOS_SIMULATOR_UDID

# wait simulator to start fully
sleep 15

# set location
set-simulator-location -q London
</code></pre>

<p>But it seems clunky, and requires hard coding the specific simulator and then opening it, waiting 15 seconds, then setting the location on it. I feel like there must be a better way.</p>
",https://stackoverflow.com/questions/49951247/ui-tests-fail-on-fastlane-circleci-because-no-location-is-set-on-a-fresh-simulat,"['xcode', 'xcode-ui-testing', 'circleci', 'fastlane']",627,FALSE,5,0
Ruby on Rails test coverage with simplecov,"<p><br>
I want to analyse the test coverage of our code , and therefore, installed the simplecov gem.<br>
<br>
Our testing environement has 2 seperate project: REST API test (Java+Rest-Assured) and Web UI testing (Java-Selenium).<br>
As you can see, we dont have unit testing inside the rails app, and we are testing using external projects.
<br>
<br>
I configured the simplecov gem as descriped in the tutorial and put this, in the rails script:</p>

<pre><code>require 'simplecov'
SimpleCov.start 'rails'
puts ""require simplecov""
</code></pre>

<p>When loading the app, I see the string I printed.
<br>
<br>
I ran both automation test projects, saw their printouts in the rails log, but I don't see <strong>any</strong> coverage of controllers/models, I see only small precentage of initializtion files of some gems and rails.<br>
<br>
I searched the net, and tried putting the code phrase in boot.rb or even puma.rb and it returned the same results.</p>

<p><br>
<br></p>

<p>Any ideas?<br><br></p>

<p><strong><em>EDIT</em></strong></p>

<p>Nothing helped with all the comments, but I figured out something very interesting, in all cases, I only see the name of methods marked as tested, not the content (in controllers).<br>
I tried to put the simplecov start phrase in both bin/rails, puma.rb, config.ru, environment.rb, all not given the desired results of code coverage.</p>
",https://stackoverflow.com/questions/51809678/ruby-on-rails-test-coverage-with-simplecov,"['ruby-on-rails', 'ruby', 'automated-tests', 'simplecov']",3954,TRUE,11,3
Selenium WebDriver + Java -- Element not visible,"<p>I am starting out with Selenium WebDriver and trying to automate the UI testing of the following site: <a href=""https://retirementtools.legalandgeneral.com/an_form.cfm"" rel=""nofollow noreferrer"">https://retirementtools.legalandgeneral.com/an_form.cfm</a>.</p>

<p>On the second page, I'm unable to get it to click on the ""Save and Continue"" button (it works fine on the landing page and I've already got the code to make the selection of the provider on the first page to proceed. That all works fine).</p>

<p>The HTML for this button is: </p>

<pre><code>&lt;a href=""javascript:tabButtonClick(1)"" onclick=""$(this).addClass('clicked')"" id=""nextBtn"" class=""nextBtn button blue align-right""&gt;Save and Continue&lt;/a&gt;
</code></pre>

<p>I started off just trying to use findElement and the ID with the following code but no luck:</p>

<pre><code>driver.findElement(By.id(""nextBtn"")).click();
</code></pre>

<p>I've tried changing this to find by CSS selector and XPath, also no luck.</p>

<p>I've added in waits to make sure the element has loaded, didn't help.</p>

<p>I've also tried adding a scroll, but that didn't seem to help either.</p>

<p>The Save and Continue button appears multiple times within the page but each has a different ID so I assume that isn't stopping it from working?</p>

<p>As I mentioned, I'm quite new to this so apologies if I'm missing something obvious.</p>

<p>Many thanks!</p>
",https://stackoverflow.com/questions/49938476/selenium-webdriver-java-element-not-visible,"['java', 'selenium', 'selenium-webdriver', 'xpath', 'css-selectors']",1489,FALSE,0,7
Xcode fetch keyboard plus suggestions height,"<p>I'm having an issue getting the correct height of the keyboard. It does not return the keyboard plus suggestions height. </p>

<p>Below is some sample code </p>

<pre><code>NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillBeShown(notification:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
        NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillBeHidden(notification:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil)
</code></pre>

<p>Then I have a utility method which returns keyboard frame from notification. Code looks like this</p>

<pre><code> var userInfo = notification.userInfo!
 var keyboardFrame:CGRect = (userInfo[UIKeyboardFrameBeginUserInfoKey] as! NSValue).cgRectValue
 if keyboardFrame.size.height &lt;= 0 { // to fix bug on iOS 11
     keyboardFrame = (userInfo[UIKeyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
 }
 keyboardFrame = view.convert(keyboardFrame, from: nil)
</code></pre>

<p>The keyboard is not returning the keyboard height + suggestions</p>

<p>I require this as I'm doing some UI testing on iPhone 5 and on certain screens the keyboard clips the textfield. So I have this code to check if it overlaps</p>

<pre><code>// fetches keyboard frame
let keyboardFrame = UtilityMethods.getKeyboardFrame(notification: notification, view: view)

let fieldFrame = lastNameField!.frame

// check if keyboard frame overlaps with field frame
if(keyboardFrame.intersects(fieldFrame)){    
   let newY = view.frame.origin.y - (fieldFrame.origin.y - keyboardFrame.height)
   UtilityMethods.animateViewMoving(viewToAnimate: view, newYValue: newY)
}
</code></pre>

<p>But because it is not returning the height of the keyboard + suggestions, the if statement fails. The only way this works is if I select another text field while keyboard is open, that then becomes first responder, then it returns keyboard height properly.</p>

<p>You can see when I print out the keyboard height</p>

<p>So when select fextfield, this height is printed out</p>

<pre><code>216.0
</code></pre>

<p>Then if I select second text field, this height is then printed out</p>

<pre><code>253.0
</code></pre>

<p>How do I make sure I'm always getting the keybaord height that includes the suggestions?</p>

<p>Any help would be much appreciated.</p>
",https://stackoverflow.com/questions/48093018/xcode-fetch-keyboard-plus-suggestions-height,"['swift', 'keyboard']",298,FALSE,0,0
What&#39;s the best approach for modular apps UI test scripts?,"<p>I'd like to know if any of You have experience in automation UI testing of modular-like apps. The whole app is like all typical CRM-related apps, where based on Your personal client needs You just put together some of the available modules (that have been predefined earlier) in order to provide all necessary functionalities.</p>

<p>If there would be ""static"" app built of all these modules put together then we could test it in a quite easy way, just going through all defined test classes, because we would know the behaviour/interactions between all these modules.</p>

<p>But in case we would need to test app behaviour while putting some of its random pieces/modules together in order to check if they work well, we would need some other approach.</p>

<p>If there's a solution, some recommended architect pattern or anything that can help me to perform such automation tests (using i.e. Selenium WebDriver)? Or does this kind of tests are even possible to perform using WebDriver library?</p>

<p>I'd be grateful if You'll share any of Your thoughts and experiences in this area.</p>
",https://stackoverflow.com/questions/52202585/whats-the-best-approach-for-modular-apps-ui-test-scripts,"['java', 'selenium-webdriver', 'dynamics-crm', 'ui-automation', 'modular-design']",114,TRUE,0,2
Webdriver and Chrome: DevToolsActivePort file doesn&#39;t exist,"<p>I am trying to install/configure Selenium to do some UI testing while a team mate is out of the office. I have installed Selenium Webdriver and Eclipse, as well as the Chrome, Firefox and Edge browser drivers. I have some very simple scripts that launch the browser and open up a URL. I am just trying to verify that my install and configuration is good. Firefox and Edge are fine, work as expected. However, I cannot get chrome to work. </p>

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

<pre><code>package firstPackage;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class FirstScript {
    public static void main(String[] args) {        
        ChromeOptions options = new ChromeOptions();
        options.addArguments(""disable-infobars"");
        options.addArguments(""--start-maximized"");

        WebDriver driver = new ChromeDriver(options);
        driver.get(""http://www.google.com"");
    }
}
</code></pre>

<p>When I run it, Chrome launches. The title of the tab is ""data;"" and the URL in the address bar is also ""data;"". However, the browser does not navigate to the URL that I specified. After approx 60 seconds I get the following error in the eclipse window:</p>

<pre><code>Exception in thread ""main"" org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist
  (Driver info: chromedriver=2.39.562718 (9a2698cba08cf5a471a29d30c8b3e12becabb0e9),platform=Windows NT 10.0.16299 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.15 seconds
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z'
System info: host: 'XXXXXXX', ip: 'XXXXXXXXXX', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171'
Driver info: driver.version: ChromeDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
    at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
    at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
    at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
    at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
    at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
    at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
    at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
    at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207)
    at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:130)
    at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:181)
    at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:168)
    at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:157)
    at firstPackage.FirstScript.main(FirstScript.java:14)
</code></pre>

<p>A Google search brought me to a few posts that suggested some option settings might do the trick. These are the ones that I tried:</p>

<pre><code>options.addArguments(""--disable-extensions""); // disabling extensions
options.addArguments(""--disable-gpu""); // applicable to windows os only
options.addArguments(""--disable-dev-shm-usage""); // overcome limited resource problems
options.addArguments(""--no-sandbox""); // Bypass OS security model
</code></pre>

<p>None of these fixed the problem for me, the behavior stayed the same.</p>

<p>I am running:
Windows 10 (OS build  16299)
Selenium 3.12.0
ChromeDriver 2.39
Chrome 67.0.3396.79 </p>

<p>Anyone have any suggestions as to what I might be doing wrong?</p>
",https://stackoverflow.com/questions/50749488/webdriver-and-chrome-devtoolsactiveport-file-doesnt-exist,"['java', 'selenium-webdriver', 'selenium-chromedriver']",13820,TRUE,7,1
How can I get CucumberJS to recognizing my Scenario Outline parameters in a step definition?,"<p>Using CucumberJS I'm trying to implement a Scenario Outline for UI testing.  Cucumber isn't recognizing or passing my arguments correctly.  Here's what I have.</p>

<p>test.feature</p>

<pre><code>Scenario Outline: User with permissions can Import Payment files with any file format
    Given a &lt;username&gt; has logged into site
        Examples:
            |username      |fileName    |
            |administrator |test1.csv   |
            |userA         |step2.csv   |
</code></pre>

<p>test_step.js</p>

<pre><code>Given('a {string} has logged into site', async function (username) {
    console.log('username = ' + username);
    return this.userLogin(username);
});
</code></pre>

<p>world.js</p>

<pre><code>'use strict';
const { setWorldConstructor } = require('cucumber');

class testApp {
    // Write metrics data object to JSON file
    async userLogin(username) {
        await this.navigateLoginPage();
    }
}

setWorldConstructor(testApp);
</code></pre>

<p>Now when I run this, I get the following:</p>

<pre><code> Warnings:

1) Scenario: User with permissions can Import Payment files with any file format # features/importPaymentFile.feature:28
   ? Given a administrator has logged into site
       Undefined. Implement with the following snippet:

         Given('a administrator has logged into site', function () {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });


2) Scenario: User with permissions can Import Payment files with any file format # features/importPaymentFile.feature:29
   ? Given a administrator has logged into site
       Undefined. Implement with the following snippet:

         Given('a userA has logged into site', function () {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
             });
</code></pre>

<p>So now I'm confused.  It looks like my parameters are getting correctly read but not recognizing them in the step definitions.</p>

<p>Can anyone please give me some insight on how I should be implementing the Scenario Outline's parameters?</p>

<p><strong>UPATE #3 - FINAL UPDATE</strong>
So it worked for me like this:</p>

<p>test.feature</p>

<pre><code>Scenario Outline: User with permissions can Import Payment files with any file format
    Given a ""&lt;username&gt;"" has logged into site and uploads ""&lt;fileName&gt;""
        Examples:
            |username      |fileName    |
            |administrator |test1.csv   |
            |userA         |step2.csv   |
</code></pre>

<p>test_step.js</p>

<pre><code>Given('a {string} has logged into site and uploads {string}', async function (username, fileName) {
    console.log('username = ' + username);
    console.log('fileName = ' + fileName);
    return this.userLogin(username);
});
</code></pre>

<p>world.js</p>

<pre><code>'use strict';
const { setWorldConstructor } = require('cucumber');

class testApp {
    // Write metrics data object to JSON file
    async userLogin(username) {
        await this.navigateLoginPage();
    }
}

setWorldConstructor(testApp);
</code></pre>

<p>Results:</p>

<pre><code>&gt; . ./.env; node app.js ""--feature"" ""importPaymentFile""

username = administrator
filename = oneStepApproval_MediaOcean.csv
.username = operations
filename = twoStepApproval_MediaOceanDan.csv
</code></pre>

<p>Sorry if I was to verbose.  I'll pair this down if told to do so :)</p>

<hr>

<p><strong>UPDATE #1</strong> </p>

<p>I tried quotes, it this didn't work.  Putting quotes around the parameter in the feature file seemed to cause the parameter to not be passed.</p>

<p>test.feature</p>

<pre><code>Scenario Outline: User with permissions can Import Payment files with any file format
    Given a ""&lt;username&gt;"" has logged into site
        Examples:
            |username      |fileName    |
            |administrator |test1.csv   |
            |userA         |step2.csv   |
</code></pre>

<p>resulting error:</p>

<pre><code>username = 
.username = 
.

2 scenarios (2 passed)
2 steps (2 passed)
0m00.015s
(node:16642) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 7): Error: Protocol error(Emulation.setDeviceMetricsOverride): Session closed. Most likely the page has been closed.
(node:16642) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:16642) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): Error: Protocol error (Emulation.setDeviceMetricsOverride): Session closed. Most likely the page has been closed.
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: Timed out while authenticating with server
at Timeout._onTimeout (/Users/huckcarignan/Desktop/sprint26/epay-test-automation/node_modules/imap/lib/Connection.js:139:17)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
</code></pre>

<p><strong>Update #2</strong></p>

<p>Combo 1:  &amp; {string}</p>

<p>Feature File: </p>

<pre><code>Given a &lt;username&gt; has logged into Site
</code></pre>

<p>Step Definition:</p>

<pre><code>Given('a {string} has logged into Site', async function (username) {
    console.log('username = ' + username);
    return this.userLogin(username);
});
</code></pre>

<p>Results:</p>

<pre><code>? Given a administrator has logged into Site
    Undefined. Implement with the following snippet:

      Given('a administrator has logged into Site', function () {
        // Write code here that turns the phrase above into concrete actions
        return 'pending';
      });
</code></pre>

<p>Combo 2:  &amp; ([^""]*)</p>

<p>Feature File: </p>

<pre><code>Given a &lt;username&gt; has logged into Site
</code></pre>

<p>Step Definition:</p>

<pre><code>Given('a ([^""]*) has logged into Site', async function (username) {
    console.log('username = ' + username);
    return this.userLogin(username);
});
</code></pre>

<p>Results:</p>

<pre><code>? Given a administrator has logged into Site
    Undefined. Implement with the following snippet:

      Given('a administrator has logged into Site', function () {
        // Write code here that turns the phrase above into concrete actions
        return 'pending';
      });
</code></pre>

<p>Combo 3: """" &amp; ""([^""]*)""</p>

<p>Feature File: </p>

<pre><code>Given a ""&lt;username&gt;"" has logged into Site
</code></pre>

<p>Step Definition:</p>

<pre><code>       Given('a ""([^""]*)"" has logged into Site', async function (username) {
         console.log('username = ' + username);
         return this.userLogin(username);
        });
</code></pre>

<p>Results:</p>

<pre><code>? Given a {string} has logged into Site
    Undefined. Implement with the following snippet:

      Given('a administrator has logged into Site', function () {
        // Write code here that turns the phrase above into concrete actions
        return 'pending';
      });                 
</code></pre>

<p>Combo 4: """" &amp; ([^""]*)</p>

<p>Feature File: </p>

<pre><code>Given a &lt;username&gt; has logged into Site
</code></pre>

<p>Step Definition:</p>

<pre><code>Given('a ""([^""]*)"" has logged into Site', async function (username) {
    console.log('username = ' + username);
       return this.userLogin(username);
    });
</code></pre>

<p>Results:</p>

<pre><code>? Given a {string} has logged into Site
    Undefined. Implement with the following snippet:

      Given('a administrator has logged into Site', function () {
        // Write code here that turns the phrase above into concrete actions
        return 'pending';
      });
</code></pre>

<p>Combo 5: """" &amp; {string}  <strong>THE WINNER - sort of</strong></p>

<p>Feature File: </p>

<pre><code>Given a &lt;username&gt; has logged into Site
</code></pre>

<p>Step Definition:</p>

<pre><code>Given('a ""([^""]*)"" has logged into Site', async function (string) {
    console.log('username = ' + string);
    return this.userLogin(string);
});
</code></pre>

<p>Results:</p>

<pre><code>username = administrator
.

1 scenarios (1 passed)
1 steps (1 passed)
0m01.637s;
</code></pre>

<p>Sooooo...this works, multiple parameters are handled by order - I'll put my results at the very top</p>
",https://stackoverflow.com/questions/53857918/how-can-i-get-cucumberjs-to-recognizing-my-scenario-outline-parameters-in-a-step,"['node.js', 'cucumberjs']",3332,TRUE,1,2
Proguard is ruining my cleanliness. Gson and generics,"<p>I have a function that loads information from persistence, and I just tell the type it is in a really simple way. The class is called <code>SharedPreferencesHelper.kt</code> so it is a really life problem solver:</p>

<pre><code>    fun &lt;T&gt; loadList(context: Context, fileName: String, key: String, defValue: ArrayList&lt;T&gt;) : ArrayList&lt;T&gt; {
        val gson = MyGsonDependency.getInstance()
        val json = getWithFileName(context, fileName).getString(key, gson.toJson(defValue))

        return gson.fromJson(json, object : TypeToken&lt;ArrayList&lt;T&gt;&gt;() {}.type)
    }
</code></pre>

<p>to load, for example, an <code>ArrayList&lt;String&gt;</code> I just do:</p>

<pre><code>   SharedPreferencesHelper.loadList&lt;String&gt;(
            context,
            FILE_NAME,
            KEY,
            ArrayList())
</code></pre>

<p>The problem that I found is that when I run Proguard and obfuscate my code, whenever I call <code>object : TypeToken&lt;ArrayList&lt;T&gt;&gt;() {}.type</code> I get an exception:</p>

<pre><code>Caused by: java.lang.AssertionError: illegal type variable reference
   at libcore.reflect.TypeVariableImpl.resolve(TypeVariableImpl.java:111)
   at libcore.reflect.TypeVariableImpl.getGenericDeclaration(TypeVariableImpl.java:125)
   at libcore.reflect.TypeVariableImpl.hashCode(TypeVariableImpl.java:47)
   at java.util.Arrays.hashCode(Arrays.java:4074)
   at com.google.gson.internal.$Gson$Types$ParameterizedTypeImpl.hashCode(Unknown Source:2)
   at com.google.gson.reflect.TypeToken.&lt;init&gt;(Unknown Source:23)
</code></pre>

<p>The only solution that I found <a href=""https://stackoverflow.com/questions/41554706/gson-illegal-type-variable-reference"">was here</a> but it would imply to provide the <code>type</code> as param.</p>

<p>I see this as a potential problem for two reasons:</p>

<ul>
<li>It's not a warning, it's not a bad practice (is it?), and it's a really good function that saves much boilerplate code when loading a JSONArray that is Serialized afterwards. Developers of the same project might not be aware that this is a problem when Proguard is on the top.</li>
<li>The only way to test if a piece of code works is running Proguard, in other words, waiting for an average of 3 minutes for a build. Having a big test coverage in Unit and UI testing helps a lot too, but there are teams that don't have that possibility.</li>
</ul>

<p>My question is, is there any other way to approach the problem?</p>
",https://stackoverflow.com/questions/48198040/proguard-is-ruining-my-cleanliness-gson-and-generics,"['java', 'android', 'generics', 'gson', 'proguard']",766,FALSE,6,0
Perform a full swipe left action in UI Tests?,"<p>I have implemented leading and trailing swipe actions in a table view. Now, I'm trying to test them in XCTest UI tests.</p>

<p>To test a regular swipe in either direction is easy:</p>

<pre><code>tableCell.swipeRight()
tableCell.swipeLeft()
</code></pre>

<p>Using one of these causes the 1st action button to be displayed, and I can then <code>.tap()</code> on the button.</p>

<p>However, testing a full swipe is proving a little more challenging. I have played with <a href=""https://stackoverflow.com/a/46708494/1107226"">this extension</a> from <a href=""https://stackoverflow.com/questions/39280821/xctest-swift-how-do-i-swipe-faster-or-more-precisely"">How do I swipe faster or more precisely?</a></p>

<p>I have also played with <a href=""https://stackoverflow.com/a/37159933/1107226"">this answer</a> from the question <a href=""https://stackoverflow.com/questions/37158631/xcode7-ui-testing-statictextsxx-swiperight-swipes-not-far-enough"">Xcode7 ui testing: staticTexts[“XX”].swipeRight() swipes not far enough</a>.</p>

<p>Both of these essentially use <a href=""https://developer.apple.com/documentation/xctest/xcuielement/1500960-coordinatewithnormalizedoffset"" rel=""nofollow noreferrer"">XCUIElement's coordinate(withNormalizedOffset:)</a> method to swipe from one point to another, similar to the following:</p>

<pre><code>let startPoint = tableCell.coordinate(withNormalizedOffset: CGVector.zero)
let finishPoint = startPoint.withOffset(CGVector(dx:xOffsetValue, dy:yOffsetValue))
startPoint.press(forDuration: 0, thenDragTo: finishPoint)
</code></pre>

<p>I ended up with an extension that <em>successfully performs a full swipe right</em> - but I can't seem to get the numbers right for a <em>full</em> swipe <strong>left</strong>.</p>

<p>My code does perform a swipe left, but just doesn't go far enough. I've tried hardcoded numbers for <code>dx:</code> from -300 to 300. The element width is 414. I believe that 0 is the far left, and 414 would be the far right, so I started using that size as a reference. Still, no joy.</p>

<p>How can I get this to perform a full swipe left?</p>

<pre><code>extension XCUIElement
{
    enum SwipeDirection {
        case left, right
    }

    func longSwipe(_ direction : SwipeDirection) {
        let elementLength = self.frame.size.width
        let centerPoint: CGFloat = elementLength / 2.0
        let halfCenterValue: CGFloat = centerPoint / 2.0

        let startOffset: CGVector
        let endOffset: CGVector
        switch direction {
        case .right:  // this one works perfectly!
            startOffset = CGVector.zero
            endOffset = CGVector(dx: centerPoint + halfCenterValue, dy: 0)
        }
        case .left:  // ""There's the rub"" as Hamlet might say...
            startOffset = CGVector(dx: centerPoint + halfCenterValue, dy: 0)
            endOffset = CGVector.zero

        let startPoint = self.coordinate(withNormalizedOffset: startOffset)
        let finishPoint = startPoint.withOffset(endOffset)
        startPoint.press(forDuration: 0, thenDragTo: finishPoint)
    }
}
</code></pre>
",https://stackoverflow.com/questions/51621445/perform-a-full-swipe-left-action-in-ui-tests,"['ios', 'swift', 'xctest', 'xcode-ui-testing']",1954,TRUE,3,1
Cannot run Protractor Cucumber Tests in headless chrome,"<p>I am using the protractor-cucumber framework for UI Testing. This runs fine in chrome, however when running in headless chrome my tests fail with an error message.</p>

<p>Is it possible to run protractor-cucumber in headless chrome? If so, how can i stop the below error message and get my tests to run successfully. I don't understand why it runs fine when chrome is not headless. </p>

<p>Versions I am using:
Protractor:5.2.2
selenium:3.8.1
WebDriver: 12.0.6
ChromeDriver:2.35
Chrome Browser:62.0</p>

<p>I have included my conf.js file below</p>

<p><strong>Error Message when running in headless chrome:</strong> </p>

<blockquote>
  <p>Scenario: :: navigate to BMK page and select a date for the previous month
      [15:47:41] E/protractor - Could not find Angular on page <a href=""http://localhost/"" rel=""nofollow noreferrer"">http://localhost/</a> : retri                                              es looking for angular exceeded
      [15:47:41] E/launcher - Angular could not be found on the page <a href=""http://localhost/.I"" rel=""nofollow noreferrer"">http://localhost/.I</a>                                                    f this is not an Angular application, you may need to turn off waiting for Angul                                                              ar.
                                Please see
                                <a href=""https://github.com/angular/protractor/blob/master/docs"" rel=""nofollow noreferrer"">https://github.com/angular/protractor/blob/master/docs</a>                 /timeouts.md#waiting-for-angular-on-page-load
      [15:47:41] E/launcher - Error: Angular could not be found on the page <a href=""http://ah-"" rel=""nofollow noreferrer"">http://ah-</a>                                                        test/.If this is not an Angular application, you may need to turn off waiting fo                                                             r Angular.
      [15:47:41] E/launcher - Process exited with error code 199</p>
</blockquote>

<p><strong>Conf.js</strong></p>

<pre><code>//protractor.conf.js
exports.config = {
    //seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
    seleniumAddress: 'http://localhost:4444/wd/hub',
    getPageTimeout: 80000,
    allScriptsTimeout:  5000000,
    framework: 'custom',
    // path relative to the current config file
    frameworkPath: './index.js',
    //frameworkPath: require.resolve('protractor-cucumber-framework'),
    capabilities: {
        'browserName': 'chrome',
        'chromeOptions': {
            useAutomationExtension: false,
            args: [ ""--headless"",""--disable-gpu"",""--window-size=800x600""],

        }

    },
    //directConnect: true,

useAllAngular2AppRoots: true,
// Spec patterns are relative to this directory.
specs: ['Features/*.feature'],

baseURL: 'http://ah-test/',

 //  onPrepare: function () {
   // browser.manage().window().maximize();
//},

cucumberOpts: {
    format: ['json:reports/reports.json', 'pretty'],
    require: 'Features/step_definitions/*.js',
    //require: 'Features/step_definitions/hooks/hooks.js',
    tags: false,
   // format: 'pretty',
    profile: false,
    'no-source': true,
},
</code></pre>
",https://stackoverflow.com/questions/48505690/cannot-run-protractor-cucumber-tests-in-headless-chrome,"['google-chrome', 'protractor', 'cucumber', 'selenium-chromedriver', 'google-chrome-headless']",1691,TRUE,0,1
RuntimeException: Unable to create output dir: /storage/emulated/0/app_spoon-screenshots,"<p>I am setting up Spoon for Android UI Testing using the <a href=""https://github.com/jaredsburrows/gradle-spoon-plugin"" rel=""noreferrer"">gradle-spoon-plugin</a> using the Spoon 2.0.0 snapshot. My project is set up using Android Gradle plug-in 3.0.1.</p>

<p>When taking screenshots via <code>spoonRule.screenshot(activity, ""hello"")</code>, I get this RuntimeException:</p>

<pre><code>java.lang.RuntimeException: Unable to create output dir: /storage/emulated/0/app_spoon-screenshots
at com.squareup.spoon.SpoonRule.createDir(SpoonRule.java:167)
at com.squareup.spoon.SpoonRule.createDir(SpoonRule.java:164)
at com.squareup.spoon.SpoonRule.createDir(SpoonRule.java:164)
at com.squareup.spoon.SpoonRule.obtainDirectory(SpoonRule.java:108)
at com.squareup.spoon.SpoonRule.screenshot(SpoonRule.java:66)
</code></pre>

<p>Things work fine if I run it on a Nexus 4 API 19 emulator but it does not work on a Pixel 2 API 27 emulator. Permissions have changed a bunch from 19 to 27 so this is not totally unexpected. </p>

<p>I've tried most of the advice currently available including adding a manifest in my <code>androidTest</code> directory that grants the read and write external storage (with and without the <code>maxSdkVersion</code>):</p>

<pre><code>&lt;?xml version=""1.0"" encoding=""utf-8""?&gt;
&lt;manifest
    xmlns:android=""http://schemas.android.com/apk/res/android""
    xmlns:tools=""http://schemas.android.com/tools""
    package=""tv.twitch.android.test""&gt;

    &lt;uses-permission android:name=""android.permission.READ_EXTERNAL_STORAGE"" android:maxSdkVersion=""18""/&gt;
    &lt;uses-permission android:name=""android.permission.WRITE_EXTERNAL_STORAGE"" android:maxSdkVersion=""18""/&gt;

    &lt;uses-sdk tools:overrideLibrary=""android.support.test.uiautomator.v18""/&gt;

&lt;/manifest&gt;
</code></pre>

<p>I see these permissions being merged into my final manifest of my app's AndroidManifest (unsure how to check the test app's manifest) in both cases.</p>

<p>I've tried granting permissions via UIAutomator to both the app and test package:</p>

<pre><code>val device = UiDevice.getInstance(getInstrumentation())
device.executeShellCommand(""pm grant tv.twitch.android.test android.permission.READ_EXTERNAL_STORAGE"")
device.executeShellCommand(""pm grant tv.twitch.android.debug android.permission.READ_EXTERNAL_STORAGE"")
device.executeShellCommand(""pm grant tv.twitch.android.test android.permission.WRITE_EXTERNAL_STORAGE"")
device.executeShellCommand(""pm grant tv.twitch.android.debug android.permission.WRITE_EXTERNAL_STORAGE"")
</code></pre>

<p>This outputs a <code>Permission denied</code> to Logcat and results in the same exception above.</p>

<p>If I try leveraging <code>GrantPermissionRule</code> like:</p>

<pre><code>@get:Rule var runtimePermissionRule = GrantPermissionRule.grant(Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE)
</code></pre>

<p>I get a different exception:</p>

<pre><code>junit.framework.AssertionFailedError: Failed to grant permissions, see logcat for details
at junit.framework.Assert.fail(Assert.java:50)
at android.support.test.runner.permission.PermissionRequester.requestPermissions(PermissionRequester.java:110)
at android.support.test.rule.GrantPermissionRule$RequestPermissionStatement.evaluate(GrantPermissionRule.java:108)

GrantPermissionCallable: Permission: android.permission.WRITE_EXTERNAL_STORAGE cannot be granted!
</code></pre>

<p>Removing <code>Manifest.permission.WRITE_EXTERNAL_STORAGE</code> and leaving just the read one gets us back to the original exception: <code>java.lang.RuntimeException: Unable to create output dir: /storage/emulated/0/app_spoon-screenshots</code></p>

<p>Running from within Android Studio or on the command-line using <code>gradle-spoon-plugin</code> doesn't affect any of the above.</p>

<p>Looking at the permissions my app and test app are granted in Settings, I see my app has Storage permission but my test app (tv.twitch.android.test) does not have any permissions requested.</p>

<p>I also tried using the <a href=""https://github.com/SchibstedSpain/Barista#runtime-permissions"" rel=""noreferrer"">Barista</a> library:</p>

<pre><code>PermissionGranter.allowPermissionsIfNeeded(Manifest.permission.WRITE_EXTERNAL_STORAGE)
</code></pre>

<p>With no luck their either. </p>

<p>Updates:</p>

<p>I tried making my test app target SDK version 22 in hopes it would get write permissions.</p>

<pre><code>&lt;?xml version=""1.0"" encoding=""utf-8""?&gt;
&lt;manifest
    xmlns:android=""http://schemas.android.com/apk/res/android""
    xmlns:tools=""http://schemas.android.com/tools""
    package=""tv.twitch.android.test""&gt;

    &lt;uses-sdk
        android:minSdkVersion=""16""
        android:targetSdkVersion=""22""
        tools:overrideLibrary=""android.support.test.uiautomator.v18""/&gt;

    &lt;uses-permission android:name=""android.permission.READ_EXTERNAL_STORAGE""/&gt;
    &lt;uses-permission android:name=""android.permission.WRITE_EXTERNAL_STORAGE""/&gt;

&lt;/manifest&gt;
</code></pre>

<p>Via Gradle (<code>./gradlew spoon</code>) I tried configuring the gradle-spoon-plugin to request all permissions:</p>

<pre><code>spoon {
    // Grant all runtime permissions during installation on Marshmallow and above devices.
    grantAll = true
}
</code></pre>

<p>With no luck. And I even tried using Spoon library version 1.3.1 to no avail as well.</p>
",https://stackoverflow.com/questions/49040071/runtimeexception-unable-to-create-output-dir-storage-emulated-0-app-spoon-scr,"['android', 'ui-testing', 'spoon', 'barista']",4098,TRUE,16,2
Dependency Injection for Static Functions for Unit Test in Swift,"<p>I know this looks like a common question but after reading 10-15 tutorial and looking how can I write test for my service class. I can't solve moving static functions to protocol or etc.. for dependency injection</p>

<p>I have a network layer like below image. All my function classes (like fetch users, news, media etc..) calls ""Service Caller"" class and after that If response is error; calls ""Service Error"" class to handle error and If not error, decode the JSON. </p>

<p>My problem is that I'm calling service class as a static function like ""ServiceCaller.performRequest"" and If It gets error I'm also calling error class as static like ""ServiceError.handle"". Also It calls URLCache class to get path of request url. I'm not sure <strong>how can I make them dependency inject and mock in test class.</strong> As I find in tutorials, I should write it like;</p>

<pre><code>protocol MyProtocol{
    func myfunction() -&gt; Void
}
class A{
    let testProtocol = MyProtocol!
    init(pro: MyProtocol){
        testProtocol = pro
    }
}
</code></pre>

<p>and in setup function in test class it probably;</p>

<pre><code>myMockProtocol = ...
myTestclass = A.init(pro: myMockProtocol)
</code></pre>

<p><a href=""https://i.stack.imgur.com/HFymQ.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/HFymQ.png"" alt=""How My Network layer works""></a></p>

<p>but I can't find how can I get ride of static calls like ServiceCaller.performRequest or ServiceError.handle..; (Simplified version in the bottom part of question)</p>

<pre><code>class AppInitService{

static func initAppRequest(_ completion: @escaping (_ appInitRecevingModel: Result&lt;AppInitRecevingModel&gt;) -&gt; Void) {

    let sendingModel = AppInitSendingModel(cmsVersion: AppDefaults.instance.getCMSVersion())
    let route = ServiceRouter(method: .post, path: URLCache.instance.getServiceURL(key: URLKeys.initApp), parameters: (sendingModel.getJSONData()), timeoutSec: 1)
    ServiceCaller.performRequest(route: route) { (result) in
        if let error = result.error{
            if let statusCode = result.response?.statusCode{
                completion(.error(ServiceError.handle(error: error, statusCode: statusCode)))
            }else{
                completion(.error(ServiceError.handle(error: error, statusCode: error._code)))
            }
        }else{
            if let data = result.data{
                do{
                    var responseJson = JSON(data)
                    responseJson[""idleTimeoutInMinutes""] = 10
                    let input = try AppInitRecevingModel(data: responseJson.rawData())
                    completion(.success(input))
                }catch let error{
                    completion(.error(ServiceError.handle(error: error, statusCode: -1002)))
                }
            }
        }}
}
 }
</code></pre>

<p>My Test class:</p>

<pre><code>class MyProjectAppInitTests: XCTestCase {

var appInitTest: AppInitService!

override func setUp() {
    super.setUp()
    // Put setup code here. This method is called before the invocation of each test method in the class.
    appInitTest = AppInitService.init()
}

override func tearDown() {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    appInitTest = nil
    super.tearDown()
}

func testExample() {
    // This is an example of a functional test case.
    // Use XCTAssert and related functions to verify your tests produce the correct results.
    let testParamater = [""string"":""test""]
    let route = ServiceRouter(method: .post, path: ""/testPath"", parameters: testParamater.getJSONData(), timeoutSec: 10)
    appInitTest. //cant call anything in here
}
</code></pre>

<p>Tutorials I looked for Unit Test;</p>

<p><a href=""https://www.raywenderlich.com/150073/ios-unit-testing-and-ui-testing-tutorial"" rel=""nofollow noreferrer"">https://www.raywenderlich.com/150073/ios-unit-testing-and-ui-testing-tutorial</a></p>

<p><a href=""https://www.swiftbysundell.com/posts/time-traveling-in-swift-unit-tests"" rel=""nofollow noreferrer"">https://www.swiftbysundell.com/posts/time-traveling-in-swift-unit-tests</a></p>

<p><a href=""https://marcosantadev.com/test-doubles-swift"" rel=""nofollow noreferrer"">https://marcosantadev.com/test-doubles-swift</a></p>

<p><a href=""http://merowing.info/2017/04/using-protocol-compositon-for-dependency-injection/"" rel=""nofollow noreferrer"">http://merowing.info/2017/04/using-protocol-compositon-for-dependency-injection/</a></p>

<p>EDIT: One solution maybe writing init class for whole network layer and service classes then get rid of static functions? But I'm not sure If It will be a good approach.</p>

<p>EDIT 2: Simplified Code;</p>

<pre><code>class A{

static func b(completion:...){
    let paramater = ObjectModel(somevariable: SomeClass.Singleton.getVariable()) //Data that I sent on network request
    let router = ServiceRouter(somevariable: SomeClassAgain.Singleton.getsomething()) //Router class which gets parameters, http method etc..

    NetworkClass.performNetworkRequest(sender: object2){ (result) in
        //Result - What I want to test (Write UnitTest about)
    }
}
}
</code></pre>
",https://stackoverflow.com/questions/50251997/dependency-injection-for-static-functions-for-unit-test-in-swift,"['ios', 'swift', 'unit-testing', 'dependency-injection']",2017,TRUE,2,1
Test ionic app with real http requests - Integration Test,"<p>I want to test my app and I am not sure which kind of test to use for which purpose.</p>

<p>I have an app that loads a page with the given data, then starts a http request (with a provider) to load and update the data in the view. If you click on some piece of data, the next page gets the data already there and then loads the rest and updates and so on. I want to test the update functions and the http requests.</p>

<p>I want to test my app from end to end, so I tried using e2e testing (with pretractor). But I found no way to check the data in the background, e.g. the data comming back from the server or the data held in my data model. Besides, my information is that the e2e test should be used for UI testing rather than function testing.</p>

<p>So I tried unit-testing (with Jasmine and Karma). I can access the right functions and variables, but I found no way to use the real http requests (not mockups) for my tests. Furthermore I need the result from the last page to send the right http request for the current page and I understand that this is not what unit testing is supposed to do.</p>

<p>I think I need some kind of integration test, but I have no idea how to implement this with ionic 3. 
So: Which test should I use and how to use it to to what I need?</p>
",https://stackoverflow.com/questions/49193878/test-ionic-app-with-real-http-requests-integration-test,"['angular', 'testing', 'ionic-framework', 'jasmine', 'protractor']",458,TRUE,0,1
Espresso with mock location : avoid Google&#39;s experience popup,"<p>I'm working on some UI testing with Espresso on a map based application that use the user location. </p>

<h2>Setup</h2>

<ul>
<li>MapBox is used for the map component, no Google Map component used here.</li>
<li>Google Play services libraries are used for localization purposes</li>
<li>Tests using Espresso</li>
<li>Mock used to fake the location (can be found here: <a href=""https://stackoverflow.com/q/52440243/10472007"">How to write Espresso Tests which are mocking GPS locations and use them in Google Testlab?</a>)</li>
<li>Tests run remotely on Firebase test Lab on a virtual device.</li>
</ul>

<h2>Actual results / Problem</h2>

<p>It works: the user location is then faked to the lat long I coded. But after a while I get some trouble. After few tests I get a system popup that seems to be triggered by <code>com.google.android.gms:play-services</code> that is embbeded in our application.</p>

<p>The message is ""For a better experience, turn on device location, which uses Google's location service."" as you can see on the picture below :</p>

<p><a href=""https://i.stack.imgur.com/Wn0Ub.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/Wn0Ub.png"" alt=""Google location service popup""></a></p>

<p>So it seems that the mocking code trigger somehow this popup and then ruins all the remaining tests since the popup does not dismiss until clicked on one of the buttons.</p>

<h2>UI Automator: not a proper solution</h2>

<p>I know I could add a bit of code with UI Automator in order to validate the popup but I would like to avoid this workaround since:</p>

<ul>
<li>I don't know what trigger this popup (seems random)</li>
<li>I don't want to run some crappy/duplicated code before running each test just for that popup.</li>
<li>Actually I am not using UI Atomator for my tests and I don't want to import another library to my project.</li>
</ul>

<p>Please note that I cannot reproduce this problem on my device or my emulator but only when I run my tests on gcloud (Firebase Test Lab)...</p>

<h2>Question</h2>

<p>Have you ever faced this problem ? Do you have any idea how I can avoid this popup or any workaround that is not involving UI Automator? </p>

<h2>One More Thing</h2>

<p>Please remember that i'm running tests remotely, on a virtual device that is not logged into any Google Account. Also, I don't have access to the device system/settings but eventually I should be able to use ADB command to get some rights or apply some settings to the system.</p>

<hr>

<h2>Bad news</h2>

<p>Actually the mock location is partially supported on Firebase Test Lab on virtual devices. See my comment below for more information. </p>

<p>So depending the use case, switching to a real device can solve your problem like the problem mentionned in this topic.</p>
",https://stackoverflow.com/questions/52806685/espresso-with-mock-location-avoid-googles-experience-popup,"['mocking', 'google-play-services', 'android-espresso', 'gcloud', 'firebase-test-lab']",1971,TRUE,4,1
