Open robpridham-bbc opened 3 years ago
UiAutomatorInstrumentationTestRunner should probably be deprecated, I don't think it is necessary.
Do either of the following solutions work? a. (preferred) switch to use androidx.test.runner.AndroidJUnitRunner as instrumentationRunner b. add "uses-library android:name="android.test.runner" to your test app manifest
I need to investigate this a bit further to be certain but I think this is going to turn out to be a fault with the emulator images and their bundled Chrome. I signed into one and upgraded Chrome via the Play Store, and UiAutomator apparently worked again. Perhaps the Logcat output is not relevant.
If anyone has influence over these images, it would be great if a fix was forthcoming. Obviously locally we can resolve it but not in the remote case of Test Lab. I will raise it with Test Lab directly as well.
Description
We have an issue whereby UiAutomator does not find any view elements within a WebView whilst running on an Nexus 5X API 26 emulator image, both freshly created and on Firebase Test Lab's set of virtual devices.
This could do with more narrowing down but so far I believe I see it on any API 26 or 27 devices. It's certainly not universal - it works on other emulators and real devices.
UiAutomator does work to some extent on this emulator, as it did find native view elements on the first fragment shown.
It may or may not be relevant, but we see this in Logcat:
07-17 06:26:04.062: W/dex2oat(9241): Rejecting class androidx.test.uiautomator.UiAutomatorInstrumentationTestRunner that attempts to sub-type erroneous class android.test.InstrumentationTestRunner in base.apk
UiAutomatorInstrumentationTestRunner
is AndroidX but it extends the deprecatedInstrumentationTestRunner
, which is not, and would be present incom.google.android:android-test
.Tested So Far
Fail
Pass
Steps to Reproduce
ExampleInstrumentedTest
on a: a. Nexus 5X API 26 emulator b. (for example) Pixel 3a API 29 emulatorExpected Results
The app under test should load the page into the WebView, and the test should locate the heading text. It should pass.
Additionally, UiAutomator should not depend on legacy Android test libraries from before AndroidX, so the given Logcat snippet should not appear.
Actual Results
The test fails on the API 26 emulator because UiAutomator cannot locate the view.
It passes on the API 29 emulator.
AndroidX Test and Android OS Versions
Android 8.0 (API 26) UiAutomator 2.2.0
Link to a public git repo demonstrating the problem:
See above.