Simplifying and removing unnecessary checks from app-drag tests

Change-Id: Iab6603f62b8e3c95b2c3351bfe41f35f15f59246
(cherry picked from commit 8dc1dbe814)
This commit is contained in:
vadimt 2019-04-11 13:50:14 -07:00 committed by Vadim Tryshev
parent 6938276da1
commit ab472e8c06
2 changed files with 6 additions and 13 deletions

View File

@ -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() {

View File

@ -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);