Commit 1de28b82 authored by Gregory Chatzinoff's avatar Gregory Chatzinoff Committed by Commit Bot

Add more Badged Reading List EG tests.

Bug: 780984
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I4004bd0ed43330dfca8a73133db4a5aec8a423f9
Reviewed-on: https://chromium-review.googlesource.com/802957Reviewed-by: default avataredchin <edchin@chromium.org>
Commit-Queue: Gregory Chatzinoff <gchatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523820}
parent 0f7e3c65
...@@ -85,7 +85,8 @@ void EnableBadgedReadingListTriggering( ...@@ -85,7 +85,8 @@ void EnableBadgedReadingListTriggering(
@implementation FeatureEngagementTestCase @implementation FeatureEngagementTestCase
// Verifies that the Badged Reading List feature shows when triggering // Verifies that the Badged Reading List feature shows when triggering
// conditions are met. // conditions are met. Also verifies that the Badged Reading List does not
// appear again after being shown.
- (void)testBadgedReadingListFeatureShouldShow { - (void)testBadgedReadingListFeatureShouldShow {
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
...@@ -105,6 +106,15 @@ void EnableBadgedReadingListTriggering( ...@@ -105,6 +106,15 @@ void EnableBadgedReadingListTriggering(
[[EarlGrey selectElementWithMatcher:ReadingListTextBadge()] [[EarlGrey selectElementWithMatcher:ReadingListTextBadge()]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
// Close tools menu by tapping reload.
[[EarlGrey selectElementWithMatcher:chrome_test_util::ReloadButton()]
performAction:grey_tap()];
// Reopen tools menu to verify that the badge does not appear again.
[ChromeEarlGreyUI openToolsMenu];
[[EarlGrey selectElementWithMatcher:ReadingListTextBadge()]
assertWithMatcher:grey_notVisible()];
} }
// Verifies that the Badged Reading List feature does not show if Chrome has // Verifies that the Badged Reading List feature does not show if Chrome has
...@@ -126,4 +136,32 @@ void EnableBadgedReadingListTriggering( ...@@ -126,4 +136,32 @@ void EnableBadgedReadingListTriggering(
[[EarlGrey selectElementWithMatcher:ReadingListTextBadge()] [[EarlGrey selectElementWithMatcher:ReadingListTextBadge()]
assertWithMatcher:grey_notVisible()]; assertWithMatcher:grey_notVisible()];
} }
// Verifies that the Badged Reading List feature does not show if the reading
// list has already been used.
- (void)testBadgedReadingListFeatureReadingListAlreadyUsed {
base::test::ScopedFeatureList scoped_feature_list;
EnableBadgedReadingListTriggering(scoped_feature_list);
// Ensure that the FeatureEngagementTracker picks up the new feature
// configuration provided by |scoped_feature_list|.
LoadFeatureEngagementTracker();
// Ensure that Chrome has been launched enough times to mee the trigger
// condition
for (int index = 0; index < kMinChromeOpensRequired; index++) {
SimulateChromeOpenedEvent();
}
[chrome_test_util::BrowserCommandDispatcherForMainBVC() showReadingList];
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Done")]
performAction:grey_tap()];
[ChromeEarlGreyUI openToolsMenu];
[[EarlGrey selectElementWithMatcher:ReadingListTextBadge()]
assertWithMatcher:grey_notVisible()];
}
@end @end
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