Commit 9dd1930a authored by Rohit Rao's avatar Rohit Rao Committed by Commit Bot

[ios] Updates TabSwitcherTransitionTest to work with the tab grid.

Modifies the test to use the TabSwitcherMode enum instead of checking
IsIPadIdiom().  Adds some EG matchers for various elements of the tab grid.

BUG=825431
TEST=None

Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I29de41c895696627f37cc26b0c7853ab068f1834
Reviewed-on: https://chromium-review.googlesource.com/988273
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547435}
parent c88fd9da
...@@ -105,6 +105,27 @@ source_set("unit_tests") { ...@@ -105,6 +105,27 @@ source_set("unit_tests") {
] ]
} }
source_set("egtest_support") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"tab_grid_egtest_util.h",
"tab_grid_egtest_util.mm",
]
deps = [
":tab_grid_ui",
"//base",
"//ios/chrome/app/strings",
"//ios/chrome/browser/ui/tools_menu/public",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//ios/testing:ios_test_support",
"//ios/third_party/earl_grey:earl_grey+link",
"//ui/base",
]
}
source_set("eg_tests") { source_set("eg_tests") {
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
testonly = true testonly = true
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_TAB_GRID_TAB_GRID_EGTEST_UTIL_H_
#define IOS_CHROME_BROWSER_UI_TAB_GRID_TAB_GRID_EGTEST_UTIL_H_
@protocol GREYMatcher;
namespace chrome_test_util {
// Returns the GREYMatcher for the button that opens the tab grid.
id<GREYMatcher> TabGridOpenButton();
// Returns the GREYMatcher for the button that closes the tab grid.
id<GREYMatcher> TabGridDoneButton();
// Returns the GREYMatcher for the button that creates new non incognito tabs
// from within the tab grid.
id<GREYMatcher> TabGridNewTabButton();
// Returns the GREYMatcher for the button that creates new incognito tabs from
// within the tab grid.
id<GREYMatcher> TabGridNewIncognitoTabButton();
// Returns the GREYMatcher for the button to go to the non incognito panel in
// the tab grid.
id<GREYMatcher> TabGridOpenTabsPanelButton();
// Returns the GREYMatcher for the button to go to the incognito panel in
// the tab grid.
id<GREYMatcher> TabGridIncognitoTabsPanelButton();
// Returns the GREYMatcher for the button to go to the other devices panel in
// the tab grid.
id<GREYMatcher> TabGridOtherDevicesPanelButton();
} // namespace chrome_test_util
#endif // IOS_CHROME_BROWSER_UI_TAB_GRID_TAB_GRID_EGTEST_UTIL_H_
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/tab_grid/tab_grid_egtest_util.h"
#import <EarlGrey/EarlGrey.h>
#import "ios/chrome/browser/ui/tab_grid/tab_grid_constants.h"
#import "ios/chrome/browser/ui/tools_menu/public/tools_menu_constants.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#include "ui/base/l10n/l10n_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace chrome_test_util {
id<GREYMatcher> TabGridOpenButton() {
return ButtonWithAccessibilityLabelId(IDS_IOS_TAB_STRIP_ENTER_TAB_SWITCHER);
}
id<GREYMatcher> TabGridDoneButton() {
return grey_allOf(grey_accessibilityID(kTabGridDoneButtonIdentifier),
grey_sufficientlyVisible(), nil);
}
id<GREYMatcher> TabGridNewTabButton() {
return grey_allOf(
ButtonWithAccessibilityLabelId(IDS_IOS_TAB_GRID_CREATE_NEW_TAB),
grey_sufficientlyVisible(), nil);
}
id<GREYMatcher> TabGridNewIncognitoTabButton() {
return grey_allOf(
ButtonWithAccessibilityLabelId(IDS_IOS_TAB_GRID_CREATE_NEW_INCOGNITO_TAB),
grey_sufficientlyVisible(), nil);
}
id<GREYMatcher> TabGridOpenTabsPanelButton() {
return grey_accessibilityID(kTabGridRegularTabsPageButtonIdentifier);
}
id<GREYMatcher> TabGridIncognitoTabsPanelButton() {
return grey_accessibilityID(kTabGridIncognitoTabsPageButtonIdentifier);
}
id<GREYMatcher> TabGridOtherDevicesPanelButton() {
return grey_accessibilityID(kTabGridRemoteTabsPageButtonIdentifier);
}
} // namespace chrome_test_util
...@@ -205,6 +205,7 @@ source_set("eg_tests") { ...@@ -205,6 +205,7 @@ source_set("eg_tests") {
"//ios/chrome/browser/tabs", "//ios/chrome/browser/tabs",
"//ios/chrome/browser/ui", "//ios/chrome/browser/ui",
"//ios/chrome/browser/ui/authentication:eg_test_support", "//ios/chrome/browser/ui/authentication:eg_test_support",
"//ios/chrome/browser/ui/tab_grid:egtest_support",
"//ios/chrome/test/app:test_support", "//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support", "//ios/chrome/test/earl_grey:test_support",
"//ios/public/provider/chrome/browser/signin:test_support", "//ios/public/provider/chrome/browser/signin:test_support",
......
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