Commit 6751a051 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

Reenable NTPTestCase

The test were failing because the NTP was displaying the Bookmarks
panel. This CL fixes it by making sure we are on the Home panel.

Bug: 767095
Change-Id: Iec7d84172edc7879382410626f1fce1dbbc3079d
Reviewed-on: https://chromium-review.googlesource.com/676851Reviewed-by: default avatarJean-François Geyelin <jif@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503398}
parent 475f70e3
...@@ -134,6 +134,13 @@ GREYElementInteraction* CellWithMatcher(id<GREYMatcher> matcher) { ...@@ -134,6 +134,13 @@ GREYElementInteraction* CellWithMatcher(id<GREYMatcher> matcher) {
+ (void)setUp { + (void)setUp {
[super setUp]; [super setUp];
if (IsIPadIdiom()) {
// Make sure we are on the Home panel on iPad.
chrome_test_util::OpenNewTab();
[[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()]
performAction:grey_typeText(@"chrome://newtab/#most_visited\n")];
}
[self closeAllTabs]; [self closeAllTabs];
ios::ChromeBrowserState* browserState = ios::ChromeBrowserState* browserState =
chrome_test_util::GetOriginalBrowserState(); chrome_test_util::GetOriginalBrowserState();
......
...@@ -82,7 +82,14 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -82,7 +82,14 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
@implementation NTPHomeTestCase @implementation NTPHomeTestCase
+ (void)setUp { + (void)setUp {
[super setUp]; if (IsIPadIdiom()) {
[super setUp];
// Make sure we are on the Home panel on iPad.
chrome_test_util::OpenNewTab();
[[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()]
performAction:grey_typeText(@"chrome://newtab/#most_visited\n")];
}
[self closeAllTabs]; [self closeAllTabs];
ios::ChromeBrowserState* browserState = ios::ChromeBrowserState* browserState =
chrome_test_util::GetOriginalBrowserState(); chrome_test_util::GetOriginalBrowserState();
...@@ -268,9 +275,6 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -268,9 +275,6 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
// Tests that the promo is correctly displayed and removed once tapped. // Tests that the promo is correctly displayed and removed once tapped.
- (void)testPromoTap { - (void)testPromoTap {
// TODO(crbug.com/767095): Enable this test.
EARL_GREY_TEST_DISABLED(@"Test disabled.");
// Setup the promo. // Setup the promo.
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger:experimental_flags::WHATS_NEW_APP_RATING [defaults setInteger:experimental_flags::WHATS_NEW_APP_RATING
...@@ -302,9 +306,6 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -302,9 +306,6 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
// Tests that the position of the collection view is restored when navigating // Tests that the position of the collection view is restored when navigating
// back to the NTP. // back to the NTP.
- (void)testPositionRestored { - (void)testPositionRestored {
// TODO(crbug.com/767095): Enable this test.
EARL_GREY_TEST_DISABLED(@"Test disabled.");
[self addMostVisitedTile]; [self addMostVisitedTile];
// Add suggestions to be able to scroll on iPad. // Add suggestions to be able to scroll on iPad.
...@@ -342,9 +343,6 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -342,9 +343,6 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
// and moved up, the scroll position restored is the position before the omnibox // and moved up, the scroll position restored is the position before the omnibox
// is selected. // is selected.
- (void)testPositionRestoredWithOmniboxFocused { - (void)testPositionRestoredWithOmniboxFocused {
// TODO(crbug.com/767095): Enable this test.
EARL_GREY_TEST_DISABLED(@"Test disabled.");
[self addMostVisitedTile]; [self addMostVisitedTile];
// Add suggestions to be able to scroll on iPad. // Add suggestions to be able to scroll on iPad.
...@@ -385,9 +383,6 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -385,9 +383,6 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
// Tests that tapping the fake omnibox focuses the real omnibox. // Tests that tapping the fake omnibox focuses the real omnibox.
- (void)testTapFakeOmnibox { - (void)testTapFakeOmnibox {
// TODO(crbug.com/767095): Enable this test.
EARL_GREY_TEST_DISABLED(@"Test disabled.");
// Setup the server. // Setup the server.
self.testServer->RegisterRequestHandler(base::Bind(&StandardResponse)); self.testServer->RegisterRequestHandler(base::Bind(&StandardResponse));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start."); GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
...@@ -405,9 +400,6 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -405,9 +400,6 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
// Tests that tapping the fake omnibox moves the collection. // Tests that tapping the fake omnibox moves the collection.
- (void)testTapFakeOmniboxScroll { - (void)testTapFakeOmniboxScroll {
// TODO(crbug.com/767095): Enable this test.
EARL_GREY_TEST_DISABLED(@"Test disabled.");
// Get the collection and its layout. // Get the collection and its layout.
UIView* collection = ntp_home::CollectionView(); UIView* collection = ntp_home::CollectionView();
GREYAssertTrue([collection isKindOfClass:[UICollectionView class]], GREYAssertTrue([collection isKindOfClass:[UICollectionView class]],
...@@ -463,9 +455,6 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -463,9 +455,6 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
// Tests that tapping the fake omnibox then unfocusing it moves the collection // Tests that tapping the fake omnibox then unfocusing it moves the collection
// back to where it was. // back to where it was.
- (void)testTapFakeOmniboxScrollScrolled { - (void)testTapFakeOmniboxScrollScrolled {
// TODO(crbug.com/767095): Enable this test.
EARL_GREY_TEST_DISABLED(@"Test disabled.");
// Get the collection and its layout. // Get the collection and its layout.
UIView* collection = ntp_home::CollectionView(); UIView* collection = ntp_home::CollectionView();
GREYAssertTrue([collection isKindOfClass:[UICollectionView class]], GREYAssertTrue([collection isKindOfClass:[UICollectionView class]],
......
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