TestButler should close system dialogs that are shown at the moment it is starting
See original GitHub issueWe in our team have faced some problem: before our test have started(and testButler was initialised) google play services have have crashed - so System Dialog appeared and test did not pass
Is there any instrument which allows testButler to close already opened dialogs? Should it be used when testButler is starting?
P.S. We have made a solution based on uiautomator
- but I am not sure it is the best one:
UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
UiObject crashMessageView = uiDevice.findObject(new UiSelector().resourceId(("android:id/message")));
if (crashMessageView != null) {
try {
TestLog.w("Crash alert is found = " + crashMessageView.getText());
uiDevice.findObject(new UiSelector().resourceId(("android:id/button1"))).click();
} catch (UiObjectNotFoundException e) {
TestLog.w("Could not click on crash dialog\n " + e);
}
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
XCUITest interact with system dialogs - Apple Developer
I have a test I want to be able to run, but need to be able to handle different states, might be logged...
Read more >How to close System dialogs that appears on app crash?
Create a method, which will wait for some regular app's button. ... You should be able to revent it from appearing in the...
Read more >How to execute Android UI tests on CI and stay alive - Medium
Suppressing ANR Dialogs with Test Butler. The achilles heel of automated Android UI testing are the system-induced ANR dialogs (Application Not Responding):.
Read more >Close system dialog when opening the screen - CommonsWare
I tried to use: //close any system dialogs when this is displayed sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));. in the ...
Read more >Geoprobe® Slug Test Analysis (STA) Software - V2.0 User's ...
and display the selected data segment. Editing Data Point(s): Before selecting the start time in the. Capture Interval dialog box you have the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is yet another fix
sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
after TestButler setUp that solves the issue.We typically solve this by making sure we send a back button key event via adb before starting tests.