Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef252d85 authored by zakcohen's avatar zakcohen
Browse files

Make OverviewActions tests more robust, wait for enabled

Wait for buttons to be enabled before trying to click on them.

Bug: 192006530
Test: TaplTestQuickstep
Change-Id: I80e050dcd93b8aae195677f2cd1fed3b53682581
parent 6604eb54
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -926,6 +926,16 @@ public final class LauncherInstrumentation {
        }
    }

    void waitForObjectEnabled(UiObject2 object, String waitReason) {
        try {
            assertTrue("Timed out waiting for object to be enabled for " + waitReason + " "
                    + object.getResourceName(),
                    object.wait(Until.enabled(true), WAIT_TIME_MS));
        } catch (StaleObjectException e) {
            fail("The object disappeared from screen");
        }
    }

    @NonNull
    UiObject2 waitForObjectInContainer(UiObject2 container, BySelector selector) {
        try {
@@ -1072,6 +1082,7 @@ public final class LauncherInstrumentation {
    }

    void clickLauncherObject(UiObject2 object) {
        waitForObjectEnabled(object, "clickLauncherObject");
        expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_DOWN);
        expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_UP);
        if (!isLauncher3() && getNavigationModel() != NavigationModel.THREE_BUTTON) {
+1 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ public class OverviewActions {
                     "want to click screenshot button and exit screenshot ui")) {
            UiObject2 screenshot = mLauncher.waitForObjectInContainer(mOverviewActions,
                    "action_screenshot");

            mLauncher.clickLauncherObject(screenshot);
            try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
                    "clicked screenshot button")) {