From e5d2ad8e34027476a6a2ded5c2733ec3b765ee2f Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Mon, 16 Nov 2020 11:14:55 -0600 Subject: [PATCH] Even more logs for flaky work test Bug: 159671700 Change-Id: I009f243b5e3076d15bc89a4755d5ddb9a5b3119e --- .../com/android/launcher3/ui/WorkTabTest.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/src/com/android/launcher3/ui/WorkTabTest.java b/tests/src/com/android/launcher3/ui/WorkTabTest.java index df0770d931..1e1cf04dfd 100644 --- a/tests/src/com/android/launcher3/ui/WorkTabTest.java +++ b/tests/src/com/android/launcher3/ui/WorkTabTest.java @@ -45,6 +45,7 @@ import org.junit.runner.RunWith; import java.util.List; import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; @LargeTest @RunWith(AndroidJUnit4.class) @@ -71,7 +72,8 @@ public class WorkTabTest extends AbstractLauncherUiTest { @After public void removeWorkProfile() throws Exception { - Log.d(TestProtocol.WORK_PROFILE_REMOVED, "(teardown) removing uid" + mProfileUserId); + Log.d(TestProtocol.WORK_PROFILE_REMOVED, "(teardown) removing uid" + mProfileUserId, + new Exception()); mDevice.executeShellCommand("pm remove-user " + mProfileUserId); } @@ -142,12 +144,16 @@ public class WorkTabTest extends AbstractLauncherUiTest { "work profile status (" + mProfileUserId + ") :" + launcher.getAppsView().isWorkTabVisible())); + AtomicInteger attempt = new AtomicInteger(0); // verify work edu is seen next - waitForLauncherCondition("Launcher did not show the next edu screen", l -> - ((AllAppsPagedView) l.getAppsView().getContentView()).getCurrentPage() == WORK_PAGE - && ((TextView) workEduView.findViewById( - R.id.content_text)).getText().equals( - l.getResources().getString(R.string.work_profile_edu_work_apps))); + waitForLauncherCondition("Launcher did not show the next edu screen", l -> { + Log.d(TestProtocol.WORK_PROFILE_REMOVED, + "running test attempt" + attempt.getAndIncrement()); + return ((AllAppsPagedView) l.getAppsView().getContentView()).getCurrentPage() + == WORK_PAGE && ((TextView) workEduView.findViewById( + R.id.content_text)).getText().equals( + l.getResources().getString(R.string.work_profile_edu_work_apps)); + }); } @Test