Commit d6dcda1f authored by Robbie Gibson's avatar Robbie Gibson Committed by Chromium LUCI CQ

[iOS][Thumb Strip] Add EGTest: Thumb strip remains open on tab switch

When the thumb strip is open in peeked state, switching tabs should not
close the thumb strip. This added EGTest checks that is the case.

Bug: 1155211
Change-Id: Ifc530731b69e3572e0d3f6837cd68b857b1c08cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2636393Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#844714}
parent a37aff57
......@@ -257,4 +257,58 @@ id<GREYMatcher> GetAccessibilityValue(__strong NSString** value) {
assertWithMatcher:grey_nil()];
}
// Tests that switching tabs in the peeked state doesn't close the thumb strip.
- (void)testSwitchTabInPeekedState {
// The feature only works on iPad.
if (![ChromeEarlGrey isIPadIdiom]) {
EARL_GREY_TEST_SKIPPED(@"Thumb strip is not enabled on iPhone");
}
// See crbug.com/1143299.
if (!base::ios::IsRunningOnIOS13OrLater()) {
EARL_GREY_TEST_DISABLED(@"Fails on iOS 12 devices.");
}
[self setUpTestServer];
const GURL URL1 = self.testServer->GetURL("/querytitle?Page1");
[ChromeEarlGrey loadURL:URL1];
[ChromeEarlGrey waitForWebStateContainingText:"Page1"];
// Open and load second tab.
[ChromeEarlGrey openNewTab];
const GURL URL2 = self.testServer->GetURL("/querytitle?Page2");
[ChromeEarlGrey loadURL:URL2];
[ChromeEarlGrey waitForWebStateContainingText:"Page2"];
// Swipe down to reveal the thumb strip.
[[EarlGrey selectElementWithMatcher:PrimaryToolbar()]
performAction:grey_swipeSlowInDirection(kGREYDirectionDown)];
// Make sure that the entire tab thumbnail is fully visible and not covered.
// This acts as a good proxy to the entire thumbstrip being visible.
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(@"Page2"),
grey_kindOfClassName(@"GridCell"),
grey_minimumVisiblePercent(1), nil)]
assertWithMatcher:grey_notNil()];
// Switch back to tab one by pressing its thumbnail.
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(@"Page1"),
grey_kindOfClassName(@"GridCell"),
nil)] performAction:grey_tap()];
[ChromeEarlGrey waitForWebStateContainingText:"Page1"];
// The thumbstrip should still be visible
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(@"Page2"),
grey_kindOfClassName(@"GridCell"),
grey_minimumVisiblePercent(1), nil)]
assertWithMatcher:grey_notNil()];
}
@end
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