Skip to content

Commit

Permalink
Fix #dismissButtonNotShownOnResetForChildAccount on automotive
Browse files Browse the repository at this point in the history
Fix
FirstRunActivitySigninAndSyncTest#dismissButtonNotShownOnResetForChildAccount on automotive devices by:
 - Scroll to signin_fre_continue_button before clicking it
 - Compete device lock screen on auto
 - Replace Espress back press with directly invoking
   FirstRunActivity#handleBackPress since AAOS doesn't have a back
   button

Bug: 1453805
Change-Id: I680988ac84a4cebff92e7427d7e5f846bcaa5c06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4609144
Reviewed-by: Charles Hager <clhager@google.com>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Auto-Submit: Theresa Sullivan <twellington@chromium.org>
Commit-Queue: Theresa Sullivan <twellington@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1156607}
  • Loading branch information
Theresa Sullivan authored and Chromium LUCI CQ committed Jun 13, 2023
1 parent 61bca6a commit 98e2e47
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.scrollTo;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.isEnabled;
Expand All @@ -28,7 +29,6 @@
import android.widget.TextView;

import androidx.annotation.IdRes;
import androidx.test.espresso.Espresso;
import androidx.test.espresso.UiController;
import androidx.test.espresso.ViewAction;
import androidx.test.espresso.matcher.ViewMatchers.Visibility;
Expand Down Expand Up @@ -76,6 +76,8 @@
import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.ui.test.util.DeviceRestriction;

import java.util.concurrent.ExecutionException;

/**
* Integration tests for the first run experience with sign-in and sync decoupled.
*/
Expand Down Expand Up @@ -198,14 +200,15 @@ public void continueButtonClickShowsSyncConsentPageWithChildAccount() {
// ChildAccountStatusSupplier uses AppRestrictions to quickly detect non-supervised cases,
// adding at least one policy via AppRestrictions prevents that.
@Policies.Add(@Policies.Item(key = "ForceSafeSearch", string = "true"))
public void dismissButtonNotShownOnResetForChildAccount() {
public void dismissButtonNotShownOnResetForChildAccount() throws ExecutionException {
mAccountManagerTestRule.addAccount(CHILD_EMAIL);
launchFirstRunActivityAndWaitForNativeInitialization();
waitUntilCurrentPageIs(SigninFirstRunFragment.class);
onView((withId(R.id.signin_fre_dismiss_button))).check(matches(not(isDisplayed())));

onView((withId(R.id.signin_fre_continue_button))).perform(click());
Espresso.pressBack();
onView((withId(R.id.signin_fre_continue_button))).perform(scrollTo(), click());
completeAutoDeviceLockIfNeeded();
TestThreadUtils.runOnUiThreadBlocking(() -> mFirstRunActivity.handleBackPress());

onView((withId(R.id.signin_fre_dismiss_button))).check(matches(not(isDisplayed())));
}
Expand Down

0 comments on commit 98e2e47

Please sign in to comment.