Commit 98c38952 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Makes HistoryUITest EG2 compatible.

- Makes history_ui_egtest comply with eg2. Uses
- Adds HistoryEntry to ChromeMatchers.
- Creates ios/chrome/browser/ui/history:eg2_tests and moves history_ui_egtest
to it.
- Adds ios/chrome/browser/ui/history:eg2_tests to test/earl_grey BUILD.gn

Change-Id: I315da4b84a99d27d281f0378771b3f7b3fd3f660
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1980553Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727213}
parent 7824c51b
...@@ -140,6 +140,7 @@ source_set("unit_tests") { ...@@ -140,6 +140,7 @@ source_set("unit_tests") {
} }
source_set("eg_tests") { source_set("eg_tests") {
defines = [ "CHROME_EARL_GREY_1" ]
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
testonly = true testonly = true
sources = [ sources = [
...@@ -150,14 +151,12 @@ source_set("eg_tests") { ...@@ -150,14 +151,12 @@ source_set("eg_tests") {
"//base", "//base",
"//ios/chrome/app/strings", "//ios/chrome/app/strings",
"//ios/chrome/browser/ui/popup_menu:constants", "//ios/chrome/browser/ui/popup_menu:constants",
"//ios/chrome/browser/ui/settings/cells", "//ios/chrome/browser/ui/settings/cells:clear_browsing_data_constants",
"//ios/chrome/browser/ui/table_view:feature_flags", "//ios/chrome/browser/ui/table_view:feature_flags",
"//ios/chrome/browser/ui/table_view/cells",
"//ios/chrome/common", "//ios/chrome/common",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support", "//ios/chrome/test/earl_grey:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//ios/third_party/earl_grey:earl_grey+link", "//ios/third_party/earl_grey:earl_grey+link",
"//ios/web/public/test",
"//ios/web/public/test/http_server", "//ios/web/public/test/http_server",
"//net:test_support", "//net:test_support",
] ]
...@@ -166,3 +165,30 @@ source_set("eg_tests") { ...@@ -166,3 +165,30 @@ source_set("eg_tests") {
"XCTest.framework", "XCTest.framework",
] ]
} }
source_set("eg2_tests") {
defines = [ "CHROME_EARL_GREY_2" ]
configs += [
"//build/config/compiler:enable_arc",
"//build/config/ios:xctest_config",
]
testonly = true
sources = [
"history_ui_egtest.mm",
]
deps = [
":constants",
"//base",
"//ios/chrome/app/strings",
"//ios/chrome/browser/ui/popup_menu:constants",
"//ios/chrome/browser/ui/settings/cells:clear_browsing_data_constants",
"//ios/chrome/browser/ui/table_view:feature_flags",
"//ios/chrome/common",
"//ios/chrome/test/earl_grey:eg_test_support+eg2",
"//ios/testing/earl_grey:eg_test_support+eg2",
"//ios/third_party/earl_grey2:test_lib",
"//ios/web/public/test/http_server",
"//net:test_support",
]
libs = [ "UIKit.framework" ]
}
...@@ -424,6 +424,7 @@ source_set("eg_app_support+eg2") { ...@@ -424,6 +424,7 @@ source_set("eg_app_support+eg2") {
"//ios/chrome/browser/ui/tab_grid:tab_grid_ui_constants", "//ios/chrome/browser/ui/tab_grid:tab_grid_ui_constants",
"//ios/chrome/browser/ui/tab_grid/grid:grid_ui_constants", "//ios/chrome/browser/ui/tab_grid/grid:grid_ui_constants",
"//ios/chrome/browser/ui/table_view:feature_flags", "//ios/chrome/browser/ui/table_view:feature_flags",
"//ios/chrome/browser/ui/table_view/cells",
"//ios/chrome/browser/ui/toolbar:eg_app_support+eg2", "//ios/chrome/browser/ui/toolbar:eg_app_support+eg2",
"//ios/chrome/browser/ui/toolbar:toolbar_ui", "//ios/chrome/browser/ui/toolbar:toolbar_ui",
"//ios/chrome/browser/ui/toolbar/keyboard_assist", "//ios/chrome/browser/ui/toolbar/keyboard_assist",
......
...@@ -407,6 +407,9 @@ id<GREYMatcher> AutofillSaveCardLocallyInfobar(); ...@@ -407,6 +407,9 @@ id<GREYMatcher> AutofillSaveCardLocallyInfobar();
// Returns a matcher for the infobar asking to upload a credit card. // Returns a matcher for the infobar asking to upload a credit card.
id<GREYMatcher> AutofillUploadCardInfobar(); id<GREYMatcher> AutofillUploadCardInfobar();
// Returns a matcher for a history entry with |url| and |title|.
id<GREYMatcher> HistoryEntry(const std::string& url, const std::string& title);
#pragma mark - Manual Fallback #pragma mark - Manual Fallback
// Returns a matcher for the scroll view in keyboard accessory bar. // Returns a matcher for the scroll view in keyboard accessory bar.
......
...@@ -507,6 +507,12 @@ id<GREYMatcher> AutofillUploadCardInfobar() { ...@@ -507,6 +507,12 @@ id<GREYMatcher> AutofillUploadCardInfobar() {
return [ChromeMatchersAppInterface autofillUploadCardInfobar]; return [ChromeMatchersAppInterface autofillUploadCardInfobar];
} }
id<GREYMatcher> HistoryEntry(const std::string& url, const std::string& title) {
return [ChromeMatchersAppInterface
historyEntryForURL:base::SysUTF8ToNSString(url)
title:base::SysUTF8ToNSString(title)];
}
#pragma mark - Manual Fallback #pragma mark - Manual Fallback
id<GREYMatcher> ManualFallbackFormSuggestionViewMatcher() { id<GREYMatcher> ManualFallbackFormSuggestionViewMatcher() {
......
...@@ -412,6 +412,9 @@ ...@@ -412,6 +412,9 @@
// Returns a matcher for the infobar asking to upload a credit card. // Returns a matcher for the infobar asking to upload a credit card.
+ (id<GREYMatcher>)autofillUploadCardInfobar; + (id<GREYMatcher>)autofillUploadCardInfobar;
// Returns a matcher for a history entry with |url| and |title|.
+ (id<GREYMatcher>)historyEntryForURL:(NSString*)URL title:(NSString*)title;
#pragma mark - Manual Fallback #pragma mark - Manual Fallback
// Returns a matcher for the scroll view in keyboard accessory bar. // Returns a matcher for the scroll view in keyboard accessory bar.
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#import "ios/chrome/browser/ui/settings/settings_table_view_controller_constants.h" #import "ios/chrome/browser/ui/settings/settings_table_view_controller_constants.h"
#import "ios/chrome/browser/ui/tab_grid/grid/grid_constants.h" #import "ios/chrome/browser/ui/tab_grid/grid/grid_constants.h"
#import "ios/chrome/browser/ui/tab_grid/tab_grid_constants.h" #import "ios/chrome/browser/ui/tab_grid/tab_grid_constants.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_url_item.h"
#import "ios/chrome/browser/ui/toolbar/keyboard_assist/toolbar_assistive_keyboard_views_utils.h" #import "ios/chrome/browser/ui/toolbar/keyboard_assist/toolbar_assistive_keyboard_views_utils.h"
#import "ios/chrome/browser/ui/toolbar/primary_toolbar_view.h" #import "ios/chrome/browser/ui/toolbar/primary_toolbar_view.h"
#import "ios/chrome/browser/ui/toolbar/public/toolbar_constants.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_constants.h"
...@@ -817,6 +818,25 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id, ...@@ -817,6 +818,25 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id,
return grey_accessibilityID(kSaveCardInfobarViewUploadAccessibilityID); return grey_accessibilityID(kSaveCardInfobarViewUploadAccessibilityID);
} }
+ (id<GREYMatcher>)historyEntryForURL:(NSString*)URL title:(NSString*)title {
GREYMatchesBlock matches = ^BOOL(TableViewURLCell* cell) {
return [cell.titleLabel.text isEqual:title] &&
[cell.URLLabel.text isEqual:URL];
};
GREYDescribeToBlock describe = ^(id<GREYDescription> description) {
[description appendText:@"view containing URL text: "];
[description appendText:URL];
[description appendText:@" title text: "];
[description appendText:title];
};
return grey_allOf(
grey_kindOfClass([TableViewURLCell class]),
[[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches
descriptionBlock:describe],
grey_sufficientlyVisible(), nil);
}
#pragma mark - Manual Fallback #pragma mark - Manual Fallback
+ (id<GREYMatcher>)manualFallbackFormSuggestionViewMatcher { + (id<GREYMatcher>)manualFallbackFormSuggestionViewMatcher {
......
...@@ -89,6 +89,7 @@ chrome_ios_eg2_test("ios_chrome_ui_eg2tests_module") { ...@@ -89,6 +89,7 @@ chrome_ios_eg2_test("ios_chrome_ui_eg2tests_module") {
"//ios/chrome/browser/ui/find_bar:eg2_tests", "//ios/chrome/browser/ui/find_bar:eg2_tests",
"//ios/chrome/browser/ui/first_run:eg2_tests", "//ios/chrome/browser/ui/first_run:eg2_tests",
"//ios/chrome/browser/ui/fullscreen:eg2_tests", "//ios/chrome/browser/ui/fullscreen:eg2_tests",
"//ios/chrome/browser/ui/history:eg2_tests",
"//ios/chrome/browser/ui/infobars:eg2_tests", "//ios/chrome/browser/ui/infobars:eg2_tests",
"//ios/chrome/browser/ui/keyboard:eg2_tests", "//ios/chrome/browser/ui/keyboard:eg2_tests",
"//ios/chrome/browser/ui/ntp:eg2_tests", "//ios/chrome/browser/ui/ntp:eg2_tests",
......
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