Commit 6104a73c authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Android][Test] Improve AccountPickerBottomSheetRenderTest

This CL improves AccountPickerBottomSheetRenderTest's account list
expanding action to reduce the flakiness.

Bug: 1127676
Change-Id: Id0849d4c388151b2752a3678a722cac05eb7e9cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2407255Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806691}
parent d1ebc9f8
...@@ -142,7 +142,7 @@ public class AccountPickerBottomSheetRenderTest { ...@@ -142,7 +142,7 @@ public class AccountPickerBottomSheetRenderTest {
mAccountManagerTestRule.addAccount(PROFILE_DATA1); mAccountManagerTestRule.addAccount(PROFILE_DATA1);
mAccountManagerTestRule.addAccount(PROFILE_DATA2); mAccountManagerTestRule.addAccount(PROFILE_DATA2);
buildAndShowCollapsedBottomSheet(); buildAndShowCollapsedBottomSheet();
onView(withText(PROFILE_DATA1.getFullName())).perform(click()); expandBottomSheet();
mRenderTestRule.render(mCoordinator.getBottomSheetViewForTesting(), "expanded_sheet"); mRenderTestRule.render(mCoordinator.getBottomSheetViewForTesting(), "expanded_sheet");
} }
...@@ -155,7 +155,7 @@ public class AccountPickerBottomSheetRenderTest { ...@@ -155,7 +155,7 @@ public class AccountPickerBottomSheetRenderTest {
mAccountManagerTestRule.addAccount(PROFILE_DATA1); mAccountManagerTestRule.addAccount(PROFILE_DATA1);
mAccountManagerTestRule.addAccount(PROFILE_DATA2); mAccountManagerTestRule.addAccount(PROFILE_DATA2);
buildAndShowCollapsedBottomSheet(); buildAndShowCollapsedBottomSheet();
onView(withText(PROFILE_DATA1.getFullName())).perform(click()); expandBottomSheet();
onView(withText(R.string.signin_incognito_mode_primary)).perform(click()); onView(withText(R.string.signin_incognito_mode_primary)).perform(click());
onView(isRoot()).perform(pressBack()); onView(isRoot()).perform(pressBack());
mRenderTestRule.render(mCoordinator.getBottomSheetViewForTesting(), "expanded_sheet"); mRenderTestRule.render(mCoordinator.getBottomSheetViewForTesting(), "expanded_sheet");
...@@ -271,6 +271,13 @@ public class AccountPickerBottomSheetRenderTest { ...@@ -271,6 +271,13 @@ public class AccountPickerBottomSheetRenderTest {
mCoordinator.getBottomSheetViewForTesting(), "signin_in_progress_sheet"); mCoordinator.getBottomSheetViewForTesting(), "signin_in_progress_sheet");
} }
private void expandBottomSheet() {
View view = mCoordinator.getBottomSheetViewForTesting();
TestThreadUtils.runOnUiThreadBlocking(
() -> { view.findViewById(R.id.account_picker_selected_account).performClick(); });
CriteriaHelper.pollUiThread(view.findViewById(R.id.account_picker_account_list)::isShown);
}
private void buildAndShowCollapsedBottomSheet() { private void buildAndShowCollapsedBottomSheet() {
TestThreadUtils.runOnUiThreadBlocking(() -> { TestThreadUtils.runOnUiThreadBlocking(() -> {
mCoordinator = new AccountPickerBottomSheetCoordinator(mActivityTestRule.getActivity(), mCoordinator = new AccountPickerBottomSheetCoordinator(mActivityTestRule.getActivity(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment