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

Commit e5d2ad8e authored by Samuel Fufa's avatar Samuel Fufa
Browse files

Even more logs for flaky work test

Bug: 159671700
Change-Id: I009f243b5e3076d15bc89a4755d5ddb9a5b3119e
parent b43d8fa9
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -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(
        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)));
                    l.getResources().getString(R.string.work_profile_edu_work_apps));
        });
    }

    @Test