From ee8db0545095dd4d4f3d5e67ee00746469c9e616 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Wed, 5 Jul 2023 15:20:57 -0700 Subject: [PATCH] Branching Taskbar visible/hidden assertion from testQuickSwitchToPreviousAppForTablet - There seems to be test corruption that is coming from the TwoPanelWorkspaceTest as they are getting marked ignored from assumption exception. - We are branching the logic of asseting taskbar depending on taskbar variant until we figure out how we can run test with TaskbarSwitchMode test annotation and pass it on first attempt. This is cunrrently not working for above reason. Test: Presubmit Bug: 286084688 Flag: not needed Change-Id: I77a141455eceffd11fa8f74a7e204de9b36384fd --- .../android/quickstep/TaplTestsQuickstep.java | 19 +++++++++++++++---- .../testing/shared/TestProtocol.java | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index 735021412c..bb246c2c38 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -16,6 +16,7 @@ package com.android.quickstep; +import static com.android.launcher3.testing.shared.TestProtocol.FLAKY_QUICK_SWITCH_TO_PREVIOUS_APP; import static com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName; import static com.android.quickstep.TaskbarModeSwitchRule.Mode.PERSISTENT; @@ -27,6 +28,7 @@ import static org.junit.Assume.assumeTrue; import android.content.Intent; import android.platform.test.annotations.PlatinumTest; +import android.util.Log; import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; @@ -44,6 +46,7 @@ import com.android.launcher3.tapl.OverviewActions; import com.android.launcher3.tapl.OverviewTask; import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.ui.TaplTestsLauncher3; +import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.Wait; import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch; @@ -144,7 +147,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { assertNotNull("overview.getCurrentTask() returned null (1)", task); assertNotNull("OverviewTask.open returned null", task.open()); assertTrue("Test activity didn't open from Overview", mDevice.wait(Until.hasObject( - By.pkg(getAppPackageName()).text("TestActivity2")), + By.pkg(getAppPackageName()).text("TestActivity2")), DEFAULT_UI_TIMEOUT)); executeOnLauncher(launcher -> assertTrue( "Launcher activity is the top activity; expecting another activity to be the top " @@ -313,7 +316,6 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @Test @ScreenRecord // b/242163205 @PlatinumTest(focusArea = "launcher") - @TaskbarModeSwitch(mode = PERSISTENT) public void testQuickSwitchToPreviousAppForTablet() throws Exception { assumeTrue(mLauncher.isTablet()); startTestActivity(2); @@ -331,9 +333,18 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { assertTrue("The first app we should have quick switched to is not running", isTestActivityRunning(2)); - // Expect task bar visible when the launched app was the test activity. + launchedAppState = getAndAssertLaunchedApp(); - launchedAppState.assertTaskbarVisible(); + + Log.e(FLAKY_QUICK_SWITCH_TO_PREVIOUS_APP, + "is Taskbar Transient : " + DisplayController.isTransientTaskbar(mTargetContext)); + // TODO(b/286084688): Remove this branching check after test corruption is resolved. + // Branching this check because of test corruption. + if (DisplayController.isTransientTaskbar(mTargetContext)) { + launchedAppState.assertTaskbarHidden(); + } else { + launchedAppState.assertTaskbarVisible(); + } } private boolean isTestActivityRunning(int activityNumber) { diff --git a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java index 4073517b5e..188608d38b 100644 --- a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java +++ b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java @@ -156,6 +156,7 @@ public final class TestProtocol { public static final String PERMANENT_DIAG_TAG = "TaplTarget"; public static final String TWO_TASKBAR_LONG_CLICKS = "b/262282528"; public static final String FLAKY_ACTIVITY_COUNT = "b/260260325"; + public static final String FLAKY_QUICK_SWITCH_TO_PREVIOUS_APP = "b/286084688"; public static final String ICON_MISSING = "b/282963545"; public static final String REQUEST_EMULATE_DISPLAY = "emulate-display";