I am writing a UiAutomator test where I observe a strange behavior. My tests keeps failing without a debugger with a debugger it works fine. What is going on?
context.startActivity(new Intent(android.provider.Settings.ACTION_DATE_SETTINGS));
device.waitForIdle();
UiObject2 list = device.findObject(By.res("com.android.settings", "list"));
// list is now without debugger null
The only workaround I found is to turn the screen off:
SystemClock.sleep(500);
device.sleep();
SystemClock.sleep(500);
device.wakeUp();
But this does not work well on real devices (btw I was testing that is a API 25 emulator), however this behavior can be also found on real devices.
I'm using this dependencies:
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
Aucun commentaire:
Enregistrer un commentaire