Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Unified Diff: ios/showcase/payments/sc_payments_selector_egtest.mm

Issue 2827163002: [Payment Request] Improved matching for the UIAlertView in showcase egtests (Closed)
Patch Set: Initial Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/showcase/payments/sc_payments_selector_egtest.mm
diff --git a/ios/showcase/payments/sc_payments_selector_egtest.mm b/ios/showcase/payments/sc_payments_selector_egtest.mm
index c4f3e680f4defd671e167ee14b4142ec33d3bb9e..6dbccc0fadef73a0b06288df926a2f44ee8dcb6d 100644
--- a/ios/showcase/payments/sc_payments_selector_egtest.mm
+++ b/ios/showcase/payments/sc_payments_selector_egtest.mm
@@ -43,6 +43,29 @@ id<GREYMatcher> AddButton() {
grey_sufficientlyVisible(), nil);
}
+// Returns the GREYMatcher for the UIAlertView's message displayed for a call
+// that notifies the delegate of a selection.
+id<GREYMatcher> UIAlertViewMessageForDelegateCallForSelectionWithArgument(
+ NSString* argument) {
+ return grey_allOf(
+ grey_text(
+ [NSString stringWithFormat:
+ @"paymentRequestSelectorViewController:"
+ @"kPaymentRequestSelectorCollectionViewAccessibilityID "
+ @"didSelectItemAtIndex:%@",
+ argument]),
+ grey_sufficientlyVisible(), nil);
+}
+
+// Returns the GREYMatcher for the UIAlertView's message displayed for a call
+// that notifies the delegate of adding an item.
+id<GREYMatcher> UIAlertViewMessageForDelegateCallForAddingItem() {
+ return grey_allOf(
+ grey_text(@"paymentRequestSelectorViewControllerDidSelectAddItem:"
+ @"kPaymentRequestSelectorCollectionViewAccessibilityID"),
+ grey_sufficientlyVisible(), nil);
+}
+
} // namespace
// Tests for the payment request selector view controller.
@@ -91,6 +114,9 @@ id<GREYMatcher> AddButton() {
performAction:grey_tap()];
// Confirm the delegate is informed.
+ [[EarlGrey selectElementWithMatcher:
+ UIAlertViewMessageForDelegateCallForSelectionWithArgument(
+ @"0")] assertWithMatcher:grey_notNil()];
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(
@"protocol_alerter_done")]
performAction:grey_tap()];
@@ -101,6 +127,9 @@ id<GREYMatcher> AddButton() {
performAction:grey_tap()];
// Confirm the delegate is informed.
+ [[EarlGrey selectElementWithMatcher:
+ UIAlertViewMessageForDelegateCallForSelectionWithArgument(
+ @"0")] assertWithMatcher:grey_notNil()];
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(
@"protocol_alerter_done")]
performAction:grey_tap()];
@@ -116,6 +145,9 @@ id<GREYMatcher> AddButton() {
performAction:grey_tap()];
// Confirm the delegate is informed.
+ [[EarlGrey selectElementWithMatcher:
+ UIAlertViewMessageForDelegateCallForSelectionWithArgument(
+ @"1")] assertWithMatcher:grey_notNil()];
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(
@"protocol_alerter_done")]
performAction:grey_tap()];
@@ -132,6 +164,9 @@ id<GREYMatcher> AddButton() {
[[EarlGrey selectElementWithMatcher:AddButton()] performAction:grey_tap()];
// Confirm the delegate is informed.
+ [[EarlGrey
+ selectElementWithMatcher:UIAlertViewMessageForDelegateCallForAddingItem()]
+ assertWithMatcher:grey_notNil()];
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(
@"protocol_alerter_done")]
performAction:grey_tap()];

Powered by Google App Engine
This is Rietveld 408576698