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

Commit b64e0674 authored by Vadim Tryshev's avatar Vadim Tryshev Committed by Automerger Merge Worker
Browse files

Merge "Improving TAPL diagnostics" into sc-dev am: c5c0e5e9

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15056761

Change-Id: Icda0324952530680318cee6892680b146615c927
parents d0394d3d c5c0e5e9
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -75,4 +75,9 @@ public final class AppIcon extends Launchable {
    protected void expectActivityStartEvents() {
    protected void expectActivityStartEvents() {
        mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START);
        mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START);
    }
    }

    @Override
    protected String launchableType() {
        return "app icon";
    }
}
}
+5 −2
Original line number Original line Diff line number Diff line
@@ -20,8 +20,6 @@ import androidx.test.uiautomator.UiObject2;


import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.testing.TestProtocol;


import java.util.regex.Pattern;

/**
/**
 * Menu item in an app icon menu.
 * Menu item in an app icon menu.
 */
 */
@@ -51,4 +49,9 @@ public class AppIconMenuItem extends Launchable {
    protected void expectActivityStartEvents() {
    protected void expectActivityStartEvents() {
        mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START);
        mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START);
    }
    }

    @Override
    protected String launchableType() {
        return "app icon menu item";
    }
}
}
+22 −16
Original line number Original line Diff line number Diff line
@@ -53,9 +53,13 @@ abstract class Launchable {


    protected abstract void expectActivityStartEvents();
    protected abstract void expectActivityStartEvents();


    protected abstract String launchableType();

    private Background launch(BySelector selector) {
    private Background launch(BySelector selector) {
        LauncherInstrumentation.log("Launchable.launch before click " +
        try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
                mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject));
                "clicking " + launchableType())) {
            LauncherInstrumentation.log("Launchable.launch before click "
                    + mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject));
            final String label = mObject.getText();
            final String label = mObject.getText();


            mLauncher.executeAndWaitForEvent(
            mLauncher.executeAndWaitForEvent(
@@ -68,9 +72,11 @@ abstract class Launchable {


            mLauncher.assertTrue(
            mLauncher.assertTrue(
                    "App didn't start: " + label + " (" + selector + ")",
                    "App didn't start: " + label + " (" + selector + ")",
                TestHelpers.wait(Until.hasObject(selector), LauncherInstrumentation.WAIT_TIME_MS));
                    TestHelpers.wait(Until.hasObject(selector),
                            LauncherInstrumentation.WAIT_TIME_MS));
            return new Background(mLauncher);
            return new Background(mLauncher);
        }
        }
    }


    /**
    /**
     * Drags an object to the center of homescreen.
     * Drags an object to the center of homescreen.
+1 −1
Original line number Original line Diff line number Diff line
@@ -504,7 +504,7 @@ public final class LauncherInstrumentation {
    void fail(String message) {
    void fail(String message) {
        checkForAnomaly();
        checkForAnomaly();
        Assert.fail(formatSystemHealthMessage(formatErrorWithEvents(
        Assert.fail(formatSystemHealthMessage(formatErrorWithEvents(
                "http://go/tapl test failure:\nSummary: " + getContextDescription()
                "http://go/tapl test failure:\nContext: " + getContextDescription()
                        + " - visible state is " + getVisibleStateMessage()
                        + " - visible state is " + getVisibleStateMessage()
                        + ";\nDetails: " + message, true)));
                        + ";\nDetails: " + message, true)));
    }
    }
+5 −0
Original line number Original line Diff line number Diff line
@@ -46,4 +46,9 @@ public final class Widget extends Launchable {
    protected void addExpectedEventsForLongClick() {
    protected void addExpectedEventsForLongClick() {
        mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LONG_CLICK_EVENT);
        mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LONG_CLICK_EVENT);
    }
    }

    @Override
    protected String launchableType() {
        return "widget";
    }
}
}