question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TestButler should close system dialogs that are shown at the moment it is starting

See original GitHub issue

We 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:open
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
vovamcommented, Apr 13, 2017

There is yet another fix sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); after TestButler setUp that solves the issue.

1reaction
drewhannaycommented, Mar 17, 2017

We typically solve this by making sure we send a back button key event via adb before starting tests.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found