Home > Enterprise >  Android Mobile App UI Test with Espresso - Chrome stop running
Android Mobile App UI Test with Espresso - Chrome stop running

Time:09-29

We have more than 400 UI tests written using espresso running locally in Android Studio and remotely on continuous integration system.

Some of these tests check if the mobile application opens an http url with Chrome. In our test suite we verify if chrome is running using the following method:

fun waitChrome(device: UiDevice): UiObject2? {
    return device.wait(Until.findObject(By.pkg("com.android.chrome")), 2500)
}

Last week,maybe an update of gradle depencencies causes test failures. Chrome is not opened anymore during the execution of these tests. In order to fix these failures I changed the implementation of the above method:

fun waitChrome(device: UiDevice): UiObject2? {
    return device.wait(Until.findObject(By.pkg("org.chromium.webview_shell")), 2500)
}

A System WebView Shell is launched instead of Chrome App on Continuous Integration System.

I would like to know it there is a way to restore the usage of Chrome during the execution of these tests. Maybe some parameter can be passed when the emulator starts.

CodePudding user response:

Maybe System WebView Shell is launched instead of Chrome App on Continuous Integration System because when the emulator is created, it is not used google_apis_playstore in abi and package. You can try to use this configuration instead of google_apis.

CodePudding user response:

You can control whether the related activity is fired instead of the package name.

sample activity

"com.android.chrome/com.google.android.apps.chrome.Main"

Sample code

Espresso - How can I check if an activity is launched after performing a certain action?

  • Related