Commit a27be680 authored by Eugene But's avatar Eugene But Committed by Commit Bot

[ios][eg2] Convert translate_ui_egtest

Notable EG2 changes:
 - Use ensureAppLaunchedWithFeaturesEnabled to enable the feature
 - Do not tap back to dismiss settings (this does not fork in EG2 and
   tappoing back is irrrelevant for acessibility testing, which is the
   purpose of this test).

Bug: 987646
Change-Id: Ib3794661e09cd6a40d4e46999c31626f47d70124
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1972911
Auto-Submit: Eugene But <eugenebut@chromium.org>
Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726016}
parent ad976543
......@@ -481,12 +481,15 @@ source_set("eg2_tests") {
"block_popups_egtest.mm",
"settings_accessibility_egtest.mm",
"signin_settings_egtest.mm",
"translate_ui_egtest.mm",
]
deps = [
":eg_test_support+eg2",
"//base",
"//base/test:test_support",
"//components/strings",
"//ios/chrome/app/strings",
"//ios/chrome/browser/ui:feature_flags",
"//ios/chrome/browser/ui/authentication:eg_test_support+eg2",
"//ios/chrome/browser/ui/authentication/cells:constants",
"//ios/chrome/browser/ui/settings:constants",
......
......@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <EarlGrey/EarlGrey.h>
#import <XCTest/XCTest.h>
#include "base/test/scoped_feature_list.h"
......@@ -12,6 +11,8 @@
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/earl_grey/app_launch_manager.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......@@ -26,12 +27,21 @@ using chrome_test_util::SettingsMenuBackButton;
@implementation TranslateUITestCase
- (void)launchAppForTestMethod {
[[AppLaunchManager sharedManager]
ensureAppLaunchedWithFeaturesEnabled:{}
disabled:{kLanguageSettings}
relaunchPolicy:NoForceRelaunchAndResetState];
}
// Opens the translate settings page and verifies that accessibility is set up
// properly.
- (void)testAccessibilityOfTranslateSettings {
// Disable the Language Settings UI.
base::test::ScopedFeatureList feature_list;
feature_list.InitWithFeatures({}, {kLanguageSettings});
#if defined(CHROME_EARL_GREY_1)
// Disable the Language Settings UI for EG1. EG2 will relaunch the app.
base::test::ScopedFeatureList featureList;
featureList.InitWithFeatures({}, {kLanguageSettings});
#endif
// Open translate settings.
// TODO(crbug.com/606815): This and close settings is mostly shared with block
......@@ -52,10 +62,6 @@ using chrome_test_util::SettingsMenuBackButton;
[ChromeEarlGrey verifyAccessibilityForCurrentScreen];
// Close settings.
[[EarlGrey selectElementWithMatcher:SettingsMenuBackButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:SettingsMenuBackButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
}
......
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