OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
6 | 6 |
7 import android.support.test.filters.MediumTest; | 7 import android.support.test.filters.MediumTest; |
8 | 8 |
9 import org.chromium.base.test.util.Feature; | 9 import org.chromium.base.test.util.Feature; |
10 import org.chromium.chrome.R; | 10 import org.chromium.chrome.R; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 triggerUIAndWait(mReadyForInput); | 47 triggerUIAndWait(mReadyForInput); |
48 // Check that there is a selected payment method (makes sure we are not
ready to pay because | 48 // Check that there is a selected payment method (makes sure we are not
ready to pay because |
49 // of the Contact Details). | 49 // of the Contact Details). |
50 expectPaymentMethodRowIsSelected(0); | 50 expectPaymentMethodRowIsSelected(0); |
51 // Updating contact with an invalid value and cancelling means we're sti
ll not | 51 // Updating contact with an invalid value and cancelling means we're sti
ll not |
52 // ready to pay (the value is still the original value). | 52 // ready to pay (the value is still the original value). |
53 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 53 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
54 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); | 54 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); |
55 setTextInEditorAndWait(new String[] {"", "---", "jane.jones"}, mEditorTe
xtUpdate); | 55 setTextInEditorAndWait(new String[] {"", "---", "jane.jones"}, mEditorTe
xtUpdate); |
56 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); | 56 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); |
57 // The section collapses and the [SELECT] button is active. | 57 // The section collapses and the [CHOOSE] button is active. |
58 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); | 58 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); |
59 assertEquals(PaymentRequestSection.EDIT_BUTTON_SELECT, getContactDetails
ButtonState()); | 59 assertEquals(PaymentRequestSection.EDIT_BUTTON_CHOOSE, getContactDetails
ButtonState()); |
60 | 60 |
61 clickAndWait(R.id.close_button, mDismissed); | 61 clickAndWait(R.id.close_button, mDismissed); |
62 expectResultContains(new String[] {"Request cancelled"}); | 62 expectResultContains(new String[] {"Request cancelled"}); |
63 } | 63 } |
64 | 64 |
65 /** Attempt to add invalid contact info alongside the already invalid info,
and cancel. */ | 65 /** Attempt to add invalid contact info alongside the already invalid info,
and cancel. */ |
66 @MediumTest | 66 @MediumTest |
67 @Feature({"Payments"}) | 67 @Feature({"Payments"}) |
68 public void testAddIncompleteContactAndCancel() | 68 public void testAddIncompleteContactAndCancel() |
69 throws InterruptedException, ExecutionException, TimeoutException { | 69 throws InterruptedException, ExecutionException, TimeoutException { |
70 // Not ready to pay since Contact email is invalid. | 70 // Not ready to pay since Contact email is invalid. |
71 triggerUIAndWait(mReadyForInput); | 71 triggerUIAndWait(mReadyForInput); |
72 // Check that there is a selected payment method (makes sure we are not
ready to pay because | 72 // Check that there is a selected payment method (makes sure we are not
ready to pay because |
73 // of the Contact Details). | 73 // of the Contact Details). |
74 expectPaymentMethodRowIsSelected(0); | 74 expectPaymentMethodRowIsSelected(0); |
75 // Adding contact with an invalid value and cancelling means we're still
not | 75 // Adding contact with an invalid value and cancelling means we're still
not |
76 // ready to pay (the value is still the original value). | 76 // ready to pay (the value is still the original value). |
77 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 77 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
78 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; | 78 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; |
79 setTextInEditorAndWait(new String[] {"", "---", "jane.jones"}, mEditorTe
xtUpdate); | 79 setTextInEditorAndWait(new String[] {"", "---", "jane.jones"}, mEditorTe
xtUpdate); |
80 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); | 80 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); |
81 // The section collapses and the [SELECT] button is active. | 81 // The section collapses and the [CHOOSE] button is active. |
82 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); | 82 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); |
83 assertEquals(PaymentRequestSection.EDIT_BUTTON_SELECT, getContactDetails
ButtonState()); | 83 assertEquals(PaymentRequestSection.EDIT_BUTTON_CHOOSE, getContactDetails
ButtonState()); |
84 | 84 |
85 clickAndWait(R.id.close_button, mDismissed); | 85 clickAndWait(R.id.close_button, mDismissed); |
86 expectResultContains(new String[] {"Request cancelled"}); | 86 expectResultContains(new String[] {"Request cancelled"}); |
87 } | 87 } |
88 | 88 |
89 /** Update the contact information with valid data and provide that to the m
erchant. */ | 89 /** Update the contact information with valid data and provide that to the m
erchant. */ |
90 @MediumTest | 90 @MediumTest |
91 @Feature({"Payments"}) | 91 @Feature({"Payments"}) |
92 public void testEditIncompleteContactAndPay() | 92 public void testEditIncompleteContactAndPay() |
93 throws InterruptedException, ExecutionException, TimeoutException { | 93 throws InterruptedException, ExecutionException, TimeoutException { |
94 triggerUIAndWait(mReadyForInput); | 94 triggerUIAndWait(mReadyForInput); |
95 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 95 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
96 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); | 96 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); |
97 setTextInEditorAndWait(new String[] {"Jon Doe", "555-555-5555", "jon.doe
@google.com"}, | 97 setTextInEditorAndWait(new String[] {"Jon Doe", "555-555-5555", "jon.doe
@google.com"}, |
98 mEditorTextUpdate); | 98 mEditorTextUpdate); |
99 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); | 99 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); |
100 clickAndWait(R.id.button_primary, mDismissed); | 100 clickAndWait(R.id.button_primary, mDismissed); |
101 expectResultContains(new String[] {"Jon Doe", "555-555-5555", "jon.doe@g
oogle.com"}); | 101 expectResultContains(new String[] {"Jon Doe", "555-555-5555", "jon.doe@g
oogle.com"}); |
102 } | 102 } |
103 } | 103 } |
OLD | NEW |