Chromium Code Reviews| Index: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java |
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java |
| index 62f42c3f7a13a169605a42e557d14a212bd1ffbb..7d44efe42cb88ce5738de29861bd1a2617293aca 100644 |
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java |
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java |
| @@ -36,6 +36,7 @@ public class PaymentRequestNoShippingTest extends PaymentRequestTestBase { |
| billingAddressId)); |
| } |
| + /** Click [X] to cancel payment. */ |
| @MediumTest |
| public void testCloseDialog() throws InterruptedException, ExecutionException, |
| TimeoutException { |
| @@ -44,6 +45,7 @@ public class PaymentRequestNoShippingTest extends PaymentRequestTestBase { |
| expectResultContains(new String[] {"Request cancelled"}); |
| } |
| + /** Click [EDIT] to expand the dialog, then click [X] to cancel payment. */ |
| @MediumTest |
| public void testEditAndCloseDialog() throws InterruptedException, ExecutionException, |
| TimeoutException { |
| @@ -53,6 +55,7 @@ public class PaymentRequestNoShippingTest extends PaymentRequestTestBase { |
| expectResultContains(new String[] {"Request cancelled"}); |
| } |
| + /** Click [EDIT] to expand the dialog, then click [CANCEL] to cancel payment. */ |
| @MediumTest |
| public void testEditAndCancelDialog() throws InterruptedException, ExecutionException, |
| TimeoutException { |
| @@ -62,6 +65,7 @@ public class PaymentRequestNoShippingTest extends PaymentRequestTestBase { |
| expectResultContains(new String[] {"Request cancelled"}); |
| } |
| + /** Click [PAY] and dismiss the card unmask dialog. */ |
| @MediumTest |
| public void testPay() throws InterruptedException, ExecutionException, TimeoutException { |
| triggerUIAndWait(mReadyToPay); |
| @@ -72,6 +76,7 @@ public class PaymentRequestNoShippingTest extends PaymentRequestTestBase { |
| "123"}); |
| } |
| + /** Click [PAY], type in "123" into the CVC dialog, then submit the payment. */ |
| @FlakyTest(message = "crbug.com/628143") |
| @MediumTest |
| public void testCancelUnmaskAndRetry() |
| @@ -85,4 +90,130 @@ public class PaymentRequestNoShippingTest extends PaymentRequestTestBase { |
| expectResultContains(new String[] {"Jon Doe", "4111111111111111", "12", "2050", "visa", |
| "123"}); |
| } |
| + |
| + /** Attempt to add an invalid credit card number and cancel payment. */ |
| + @MediumTest |
| + public void testAddInvalidCardNumberAndCancel() |
| + throws InterruptedException, ExecutionException, TimeoutException { |
| + triggerUIAndWait(mReadyToPay); |
|
gone
2016/07/14 22:36:36
Given that these lines are repeated over and over
please use gerrit instead
2016/07/15 00:24:37
Done.
|
| + clickInPaymentMethodAndWait(R.id.payments_section, mReadyForInput); |
| + clickInPaymentMethodAndWait(R.id.payments_add_option_button, mReadyToEdit); |
| + setTextInCardEditorAndWait(new String[] {"123", "Bob"}, mEditorTextUpdate); |
| + |
| + // Select December of next year for expiration and a complete billing address. |
| + int december = 11; |
| + int nextYear = 1; |
| + int firstCompleteBillingAddress = 1; |
| + setSpinnerSelectionsInCardEditorAndWait( |
| + new int[] {december, nextYear, firstCompleteBillingAddress}, |
| + mBillingAddressChangeProcessed); |
| + |
| + clickInCardEditorAndWait(R.id.payments_edit_done_button, mEditorValidationError); |
| + clickInCardEditorAndWait(R.id.payments_edit_cancel_button, mEditorDismissed); |
| + clickAndWait(R.id.close_button, mDismissed); |
| + expectResultContains(new String[] {"Request cancelled"}); |
| + } |
| + |
| + /** Attempt to add a credit card with an empty name on card and cancel payment. */ |
| + @MediumTest |
| + public void testAddEmptyNameOnCardAndCancel() |
| + throws InterruptedException, ExecutionException, TimeoutException { |
| + triggerUIAndWait(mReadyToPay); |
| + clickInPaymentMethodAndWait(R.id.payments_section, mReadyForInput); |
| + clickInPaymentMethodAndWait(R.id.payments_add_option_button, mReadyToEdit); |
| + setTextInCardEditorAndWait(new String[] {"5454-5454-5454-5454", ""}, mEditorTextUpdate); |
| + |
| + // Select December of next year for expiration and a complete billing address. |
| + int december = 11; |
| + int nextYear = 1; |
| + int firstCompleteBillingAddress = 1; |
| + setSpinnerSelectionsInCardEditorAndWait( |
| + new int[] {december, nextYear, firstCompleteBillingAddress}, |
| + mBillingAddressChangeProcessed); |
| + |
| + clickInCardEditorAndWait(R.id.payments_edit_done_button, mEditorValidationError); |
| + clickInCardEditorAndWait(R.id.payments_edit_cancel_button, mEditorDismissed); |
| + clickAndWait(R.id.close_button, mDismissed); |
| + expectResultContains(new String[] {"Request cancelled"}); |
| + } |
| + |
| + /** Use a temporary credit card to complete payment. */ |
| + @MediumTest |
| + public void testAddTemporaryCardAndPay() |
| + throws InterruptedException, ExecutionException, TimeoutException { |
| + triggerUIAndWait(mReadyToPay); |
| + clickInPaymentMethodAndWait(R.id.payments_section, mReadyForInput); |
| + clickInPaymentMethodAndWait(R.id.payments_add_option_button, mReadyToEdit); |
| + setTextInCardEditorAndWait(new String[] {"5454-5454-5454-5454", "Bob"}, mEditorTextUpdate); |
| + |
| + // Select December of next year for expiration and a complete billing address. |
| + int december = 11; |
| + int nextYear = 1; |
| + int firstCompleteBillingAddress = 1; |
| + setSpinnerSelectionsInCardEditorAndWait( |
| + new int[] {december, nextYear, firstCompleteBillingAddress}, |
| + mBillingAddressChangeProcessed); |
| + |
| + // Uncheck the "Save this card on this device" checkbox, so the card is temporary. |
| + selectCheckboxAndWait(R.id.payments_edit_checkbox, false, mReadyToEdit); |
| + |
| + clickInCardEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); |
| + clickAndWait(R.id.button_primary, mReadyForUnmaskInput); |
| + setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyToUnmask); |
| + clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed); |
| + expectResultContains(new String[] {"5454545454545454", "12", "Bob"}); |
| + } |
| + |
| + /** Save a new card on disk and pay. */ |
| + @MediumTest |
| + public void testSaveNewCardAndPay() |
| + throws InterruptedException, ExecutionException, TimeoutException { |
| + triggerUIAndWait(mReadyToPay); |
| + clickInPaymentMethodAndWait(R.id.payments_section, mReadyForInput); |
| + clickInPaymentMethodAndWait(R.id.payments_add_option_button, mReadyToEdit); |
| + setTextInCardEditorAndWait(new String[] {"5454 5454 5454 5454", "Bob"}, mEditorTextUpdate); |
| + |
| + // Select December of next year for expiration and a complete billing address. |
| + int december = 11; |
| + int nextYear = 1; |
| + int firstCompleteBillingAddress = 1; |
| + setSpinnerSelectionsInCardEditorAndWait( |
| + new int[] {december, nextYear, firstCompleteBillingAddress}, |
| + mBillingAddressChangeProcessed); |
| + |
| + clickInCardEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); |
| + clickAndWait(R.id.button_primary, mReadyForUnmaskInput); |
| + setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyToUnmask); |
| + clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed); |
| + expectResultContains(new String[] {"5454545454545454", "12", "Bob"}); |
| + } |
| + |
| + /** Add a new card together with a new billing address and pay. */ |
| + @MediumTest |
| + public void testSaveNewCardAndNewBillingAddressAndPay() |
| + throws InterruptedException, ExecutionException, TimeoutException { |
| + triggerUIAndWait(mReadyToPay); |
| + clickInPaymentMethodAndWait(R.id.payments_section, mReadyForInput); |
| + clickInPaymentMethodAndWait(R.id.payments_add_option_button, mReadyToEdit); |
| + setTextInCardEditorAndWait(new String[] {"5454 5454 5454 5454", "Bob"}, mEditorTextUpdate); |
| + |
| + // Select December of next year for expiration and [Add address] in the billing address |
| + // dropdown. |
| + int december = 11; |
| + int nextYear = 1; |
| + int addBillingAddress = 2; |
| + setSpinnerSelectionsInCardEditorAndWait(new int[] {december, nextYear, addBillingAddress}, |
| + mReadyToEdit); |
| + |
| + setTextInEditorAndWait(new String[] {"Bob", "Google", "1600 Amphitheatre Pkwy", |
| + "Mountain View", "CA", "94043", "999-999-9999"}, mEditorTextUpdate); |
| + clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToEdit); |
| + |
| + clickInCardEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); |
| + clickAndWait(R.id.button_primary, mReadyForUnmaskInput); |
| + setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyToUnmask); |
| + clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed); |
| + expectResultContains(new String[] {"5454545454545454", "12", "Bob", "Google", |
| + "1600 Amphitheatre Pkwy", "Mountain View", "CA", "94043", "999-999-9999"}); |
| + } |
| } |