Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SKART1 opened this issue Mar 17, 2017 · 5 comments

Comments

@SKART1
Copy link
Contributor

SKART1 commented Mar 17, 2017

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);
            }
        }
@bootstraponline
Copy link
Contributor

you might be interested in UiWatchers.java

@SKART1
Copy link
Contributor Author

SKART1 commented Mar 17, 2017

@bootstraponline We are facing ErrorDialog which was fired before our app was started

@Kisty
Copy link
Contributor

Kisty commented Mar 17, 2017

Have you updated Google Play services? And which devices, API was it crashing on?

@drewhannay
Copy link
Contributor

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

@vovam
Copy link

vovam commented Apr 13, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants