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

Side by Side Diff: ios/showcase/payments/sc_payments_picker_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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <EarlGrey/EarlGrey.h> 5 #import <EarlGrey/EarlGrey.h>
6 6
7 #import "ios/chrome/browser/payments/payment_request_picker_view_controller.h" 7 #import "ios/chrome/browser/payments/payment_request_picker_view_controller.h"
8 #import "ios/showcase/test/showcase_eg_utils.h" 8 #import "ios/showcase/test/showcase_eg_utils.h"
9 #import "ios/showcase/test/showcase_test_case.h" 9 #import "ios/showcase/test/showcase_test_case.h"
10 10
(...skipping 29 matching lines...) Expand all
40 return matcher; 40 return matcher;
41 } 41 }
42 42
43 // Returns the GREYMatcher for the search bar's cancel button. 43 // Returns the GREYMatcher for the search bar's cancel button.
44 id<GREYMatcher> CancelButton() { 44 id<GREYMatcher> CancelButton() {
45 return grey_allOf(grey_accessibilityLabel(@"Cancel"), 45 return grey_allOf(grey_accessibilityLabel(@"Cancel"),
46 grey_accessibilityTrait(UIAccessibilityTraitButton), 46 grey_accessibilityTrait(UIAccessibilityTraitButton),
47 grey_sufficientlyVisible(), nil); 47 grey_sufficientlyVisible(), nil);
48 } 48 }
49 49
50 // Returns the GREYMatcher for the UIAlertView's message displayed for a call
51 // that notifies the delegate of a selection.
52 id<GREYMatcher> UIAlertViewMessageForDelegateCallWithArgument(
53 NSString* argument) {
54 return grey_allOf(
55 grey_text(
56 [NSString stringWithFormat:
57 @"paymentRequestPickerViewController:"
58 @"kPaymentRequestPickerViewControllerAccessibilityID "
59 @"didSelectRow:%@",
60 argument]),
61 grey_sufficientlyVisible(), nil);
62 }
63
50 } // namespace 64 } // namespace
51 65
52 // Tests for the payment request picker view controller. 66 // Tests for the payment request picker view controller.
53 @interface SCPaymentsPickerTestCase : ShowcaseTestCase 67 @interface SCPaymentsPickerTestCase : ShowcaseTestCase
54 @end 68 @end
55 69
56 @implementation SCPaymentsPickerTestCase 70 @implementation SCPaymentsPickerTestCase
57 71
58 - (void)setUp { 72 - (void)setUp {
59 [super setUp]; 73 [super setUp];
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 - (void)testVerifySelection { 299 - (void)testVerifySelection {
286 // 'China' is selected. 300 // 'China' is selected.
287 [[EarlGrey selectElementWithMatcher:RowWithLabel(@"China", YES)] 301 [[EarlGrey selectElementWithMatcher:RowWithLabel(@"China", YES)]
288 assertWithMatcher:grey_notNil()]; 302 assertWithMatcher:grey_notNil()];
289 303
290 // 'Canada' is not selected. Tap it. 304 // 'Canada' is not selected. Tap it.
291 [[EarlGrey selectElementWithMatcher:RowWithLabel(@"Canada", NO)] 305 [[EarlGrey selectElementWithMatcher:RowWithLabel(@"Canada", NO)]
292 performAction:grey_tap()]; 306 performAction:grey_tap()];
293 307
294 // Confirm the delegate is informed. 308 // Confirm the delegate is informed.
309 [[EarlGrey
310 selectElementWithMatcher:UIAlertViewMessageForDelegateCallWithArgument(
311 @"Label: Canada, Value: CAN")]
312 assertWithMatcher:grey_notNil()];
295 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( 313 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(
296 @"protocol_alerter_done")] 314 @"protocol_alerter_done")]
297 performAction:grey_tap()]; 315 performAction:grey_tap()];
298 316
299 // 'China' is not selected anymore. 317 // 'China' is not selected anymore.
300 [[EarlGrey selectElementWithMatcher:RowWithLabel(@"China", NO)] 318 [[EarlGrey selectElementWithMatcher:RowWithLabel(@"China", NO)]
301 assertWithMatcher:grey_notNil()]; 319 assertWithMatcher:grey_notNil()];
302 320
303 // Now 'Canada' is selected. Tap it again. 321 // Now 'Canada' is selected. Tap it again.
304 [[EarlGrey selectElementWithMatcher:RowWithLabel(@"Canada", YES)] 322 [[EarlGrey selectElementWithMatcher:RowWithLabel(@"Canada", YES)]
305 performAction:grey_tap()]; 323 performAction:grey_tap()];
306 324
307 // Confirm the delegate is informed. 325 // Confirm the delegate is informed.
326 [[EarlGrey
327 selectElementWithMatcher:UIAlertViewMessageForDelegateCallWithArgument(
328 @"Label: Canada, Value: CAN")]
329 assertWithMatcher:grey_notNil()];
308 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( 330 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(
309 @"protocol_alerter_done")] 331 @"protocol_alerter_done")]
310 performAction:grey_tap()]; 332 performAction:grey_tap()];
311 333
312 // 'China' is still not selected. 334 // 'China' is still not selected.
313 [[EarlGrey selectElementWithMatcher:RowWithLabel(@"China", NO)] 335 [[EarlGrey selectElementWithMatcher:RowWithLabel(@"China", NO)]
314 assertWithMatcher:grey_notNil()]; 336 assertWithMatcher:grey_notNil()];
315 337
316 // 'Canada' is still selected. 338 // 'Canada' is still selected.
317 [[EarlGrey selectElementWithMatcher:RowWithLabel(@"Canada", YES)] 339 [[EarlGrey selectElementWithMatcher:RowWithLabel(@"Canada", YES)]
318 assertWithMatcher:grey_notNil()]; 340 assertWithMatcher:grey_notNil()];
319 } 341 }
320 342
321 @end 343 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698