Commit eca7cfda authored by Sebastien Lalancette's avatar Sebastien Lalancette Committed by Commit Bot

[iOS] Adding EG Tests for Recent Tabs Open in New Window

Realized there were no tests for this action in that context. Also added
coverage for the fix for the associate bug.

Bug: 1140517
Change-Id: Ia16ff23d3dd4c95d35dcefe9d760305f058e5341
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2544048Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Sebastien Lalancette <seblalancette@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828357}
parent 9c63e6f8
...@@ -354,6 +354,48 @@ GURL TestPageURL() { ...@@ -354,6 +354,48 @@ GURL TestPageURL() {
assertWithMatcher:grey_notVisible()]; assertWithMatcher:grey_notVisible()];
} }
// Tests the Open in New Window action on a recent tab's context menu.
- (void)testContextMenuOpenInNewWindow {
if (![ChromeEarlGrey areMultipleWindowsSupported]) {
EARL_GREY_TEST_DISABLED(@"Multiple windows can't be opened.");
}
if (![ChromeEarlGrey isNativeContextMenusEnabled]) {
EARL_GREY_TEST_SKIPPED(
@"Test disabled when Native Context Menus feature flag is off.");
}
[self loadTestURL];
OpenRecentTabsPanel();
[ChromeEarlGrey waitForForegroundWindowCount:1];
[self longPressTestURLTab];
// Select "Open in New Window" and confirm that new tab is opened with
// selected URL in the new window.
[[EarlGrey
selectElementWithMatcher:chrome_test_util::OpenLinkInNewWindowButton()]
performAction:grey_tap()];
[ChromeEarlGrey waitForForegroundWindowCount:2];
// Validate that one window has the URL loaded.
[[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText(
TestPageURL().GetContent())]
assertWithMatcher:grey_notNil()];
// Validate that Recent tabs was not closed in the original window. The
// Accessibility Element matcher is added as there are other (non-accessible)
// recent tabs tables in each window's TabGrid (but hidden).
[[EarlGrey
selectElementWithMatcher:grey_allOf(RecentTabsTable(),
grey_accessibilityElement(), nil)]
assertWithMatcher:grey_notNil()];
[ChromeEarlGrey closeAllExtraWindowsAndForceRelaunchWithAppConfig:
[self appConfigurationForTestCase]];
}
// Tests the Share action on a recent tab's context menu. // Tests the Share action on a recent tab's context menu.
- (void)testContextMenuShare { - (void)testContextMenuShare {
if (![ChromeEarlGrey isNativeContextMenusEnabled]) { if (![ChromeEarlGrey isNativeContextMenusEnabled]) {
......
...@@ -214,6 +214,37 @@ id<GREYMatcher> CloseAllTabsConfirmationWithNumberOfTabs( ...@@ -214,6 +214,37 @@ id<GREYMatcher> CloseAllTabsConfirmationWithNumberOfTabs(
assertWithMatcher:grey_notVisible()]; assertWithMatcher:grey_notVisible()];
} }
// Tests the Open in New Window action on a recent tab's context menu.
- (void)testRecentTabsContextMenuOpenInNewWindow {
if (![ChromeEarlGrey areMultipleWindowsSupported]) {
EARL_GREY_TEST_DISABLED(@"Multiple windows can't be opened.");
}
if (![ChromeEarlGrey isNativeContextMenusEnabled]) {
EARL_GREY_TEST_SKIPPED(
@"Test disabled when Native Context Menus feature flag is off.");
}
[self prepareRecentTabWithURL:_URL1 response:kResponse1];
[ChromeEarlGrey waitForForegroundWindowCount:1];
[self longPressRecentTabWithTitle:[NSString stringWithUTF8String:kTitle1]];
// Select "Open in New Window" and confirm that new tab is opened with
// selected URL in the new window.
[[EarlGrey
selectElementWithMatcher:chrome_test_util::OpenLinkInNewWindowButton()]
performAction:grey_tap()];
[ChromeEarlGrey waitForForegroundWindowCount:2];
[[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText(
_URL1.GetContent())]
assertWithMatcher:grey_notNil()];
[ChromeEarlGrey closeAllExtraWindowsAndForceRelaunchWithAppConfig:
[self appConfigurationForTestCase]];
}
// Tests the Share action on a recent tab's context menu. // Tests the Share action on a recent tab's context menu.
- (void)testRecentTabsContextMenuShare { - (void)testRecentTabsContextMenuShare {
if (![ChromeEarlGrey isNativeContextMenusEnabled]) { if (![ChromeEarlGrey isNativeContextMenusEnabled]) {
......
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