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

Commit 8dc1dbe8 authored by vadimt's avatar vadimt
Browse files

Simplifying and removing unnecessary checks from app-drag tests

Change-Id: Iab6603f62b8e3c95b2c3351bfe41f35f15f59246
parent 0a051183
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -321,7 +321,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
        final AppIconMenuItem menuItem = menu.getMenuItem(1);
        final String itemName = menuItem.getText();

        menuItem.launch(getAppPackageName(), APP_NAME);
        menuItem.launch(getAppPackageName());
    }

    @Test
@@ -337,7 +337,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
                    getAppIcon(APP_NAME).
                    dragToWorkspace().
                    getWorkspaceAppIcon(APP_NAME).
                    launch(getAppPackageName(), APP_NAME);
                    launch(getAppPackageName());
        } finally {
            TestProtocol.sDebugTracing = false;
        }
@@ -365,7 +365,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
        menuItem.
                dragToWorkspace().
                getWorkspaceAppIcon(shortcutName).
                launch(getAppPackageName(), APP_NAME);
                launch(getAppPackageName());
    }

    private static String getAppPackageName() {
+3 −10
Original line number Diff line number Diff line
@@ -45,24 +45,17 @@ abstract class Launchable {
     * Clicks the object to launch its app.
     */
    public Background launch(String expectedPackageName) {
        return launch(expectedPackageName, By.pkg(expectedPackageName).depth(0));
        return launch(By.pkg(expectedPackageName));
    }

    /**
     * Clicks the object to launch its app.
     */
    public Background launch(String expectedPackageName, String expectedAppText) {
        return launch(expectedPackageName, By.pkg(expectedPackageName).text(expectedAppText));
    }

    private Background launch(String errorMessage, BySelector selector) {
    private Background launch(BySelector selector) {
        LauncherInstrumentation.log("Launchable.launch before click " +
                mObject.getVisibleCenter());
        mLauncher.assertTrue(
                "Launching an app didn't open a new window: " + mObject.getText(),
                mObject.clickAndWait(Until.newWindow(), LauncherInstrumentation.WAIT_TIME_MS));
        mLauncher.assertTrue(
                "App didn't start: " + errorMessage,
                "App didn't start: " + selector,
                mLauncher.getDevice().wait(Until.hasObject(selector),
                        LauncherInstrumentation.WAIT_TIME_MS));
        return new Background(mLauncher);