Commit 7631eb0a authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Android][Test] Fix AccountPickerBottomSheetRenderTest incognito click

This CL fixes the click to open incognito interstitial in
AccountPickerBottomSheetRenderTest.

Bug: 1127676
Change-Id: Ib6f8dcd60593240cf1e15b1ef2fe8d91698e1c03
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2411929Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806997}
parent 0e2fff92
......@@ -5,10 +5,8 @@
package org.chromium.chrome.browser.signin;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.pressBack;
import static androidx.test.espresso.matcher.ViewMatchers.isRoot;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
......@@ -18,6 +16,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import androidx.test.filters.MediumTest;
import org.junit.After;
......@@ -156,7 +155,7 @@ public class AccountPickerBottomSheetRenderTest {
mAccountManagerTestRule.addAccount(PROFILE_DATA2);
buildAndShowCollapsedBottomSheet();
expandBottomSheet();
onView(withText(R.string.signin_incognito_mode_primary)).perform(click());
openIncognitoInterstitialOnExpandedSheet();
onView(isRoot()).perform(pressBack());
mRenderTestRule.render(mCoordinator.getBottomSheetViewForTesting(), "expanded_sheet");
}
......@@ -239,6 +238,19 @@ public class AccountPickerBottomSheetRenderTest {
mCoordinator.getBottomSheetViewForTesting(), "signin_auth_error_sheet");
}
private void openIncognitoInterstitialOnExpandedSheet() {
// RecyclerView: PROFILE_DATA1, PROFILE_DATA2, |Add account to device|, |Sign in
// temporarily|
View bottomSheetView = mCoordinator.getBottomSheetViewForTesting();
RecyclerView accountListView =
bottomSheetView.findViewById(R.id.account_picker_account_list);
TestThreadUtils.runOnUiThreadBlocking(() -> {
accountListView.findViewHolderForAdapterPosition(3).itemView.performClick();
});
CriteriaHelper.pollUiThread(bottomSheetView.findViewById(
R.id.incognito_interstitial_bottom_sheet_view)::isShown);
}
private void clickContinueButtonAndWaitForErrorView() {
View bottomSheetView = mCoordinator.getBottomSheetViewForTesting();
TestThreadUtils.runOnUiThreadBlocking(() -> {
......
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