Update TAPL tests to dismiss all tasks safely

Flag: EXEMPT test refactor
Bug: 377678992
Test: pre/post-submit tests
Change-Id: I6a2225bea4f004bdc598e2c67ce26da9fd42f7a6
This commit is contained in:
Schneider Victor-Tulias
2025-05-01 16:04:32 -04:00
parent b4692a9ea4
commit a56aa0d539
4 changed files with 8 additions and 7 deletions
@@ -152,7 +152,7 @@ public class TaplTestsKeyboardQuickSwitch extends AbstractQuickStepTest {
@Test
public void testLaunchSingleRecentTask() {
mLauncher.getLaunchedAppState().switchToOverview().dismissAllTasks();
clearAllRecentTasks();
startAppFast(CALCULATOR_APP_PACKAGE);
mLauncher.goHome().showQuickSwitchView().launchFocusedAppTask(CALCULATOR_APP_PACKAGE);
}
@@ -35,10 +35,7 @@ import org.junit.Test
class TaplTestsOverviewDesktop : AbstractQuickStepTest() {
@Before
fun setup() {
val overview = mLauncher.goHome().switchToOverview()
if (overview.hasTasks()) {
overview.dismissAllTasks()
}
clearAllRecentTasks()
startTestAppsWithCheck()
mLauncher.goHome()
}
@@ -548,7 +548,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
@EnableFlags(value = Flags.FLAG_ENABLE_GRID_ONLY_OVERVIEW)
public void testDismissBottomRow() throws Exception {
assumeTrue(mLauncher.isTablet());
mLauncher.goHome().switchToOverview().dismissAllTasks();
clearAllRecentTasks();
startTestAppsWithCheck();
Overview overview = mLauncher.goHome().switchToOverview();
@@ -570,7 +570,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
@EnableFlags(value = Flags.FLAG_ENABLE_GRID_ONLY_OVERVIEW)
public void testDismissLastGridRow() throws Exception {
assumeTrue(mLauncher.isTablet());
mLauncher.goHome().switchToOverview().dismissAllTasks();
clearAllRecentTasks();
startTestAppsWithCheck();
startTestActivity(3);
startTestActivity(4);
@@ -151,6 +151,10 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
/**
* Dismissed all tasks by scrolling to Clear-all button and pressing it.
* <p>
* NOTE: Fails if there are already no recent tasks. If a test needs to start with an empty task
* list, check {@link #hasTasks} before calling this since the previous test may have already
* cleared the task list.
*/
public void dismissAllTasks() {
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();