From d410a2c168535339272214453683b5cd2eb9b569 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 16 Jun 2021 16:23:33 -0700 Subject: [PATCH] Ensure widgets header is out of the gesture region before clicking This way, NexusLauncher won't appear during the Launcher3 test. Test: AddConfigWidgetTest#testConfigCancelled Bug: 188450580 Change-Id: Iedf0e0e17eab2473ecd2d17a4391cf9db3e80599 --- tests/tapl/com/android/launcher3/tapl/Widgets.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/Widgets.java b/tests/tapl/com/android/launcher3/tapl/Widgets.java index 51e331de42..99d988926a 100644 --- a/tests/tapl/com/android/launcher3/tapl/Widgets.java +++ b/tests/tapl/com/android/launcher3/tapl/Widgets.java @@ -185,8 +185,12 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { targetAppSelector); if (headerTitle != null) { // If we find the header and it has not been expanded, let's click it to see the - // widgets list. - if (!hasHeaderExpanded) { + // widgets list. Note that we wait until the header is out of the gesture region at + // the bottom of the screen, because tapping there in Launcher3 causes NexusLauncher + // to briefly appear to handle the gesture, which can break our test. + boolean isHeaderOutOfGestureRegion = headerTitle.getVisibleCenter().y + < mLauncher.getBottomGestureStartOnScreen(); + if (!hasHeaderExpanded && isHeaderOutOfGestureRegion) { log("Header has not been expanded. Click to expand."); hasHeaderExpanded = true; mLauncher.clickLauncherObject(headerTitle);