| Index: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingSingleAddressTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingSingleAddressTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingSingleAddressTest.java
|
| index 5f559852619f97694d39323f66e58ea93f693fbb..92a73c1529f7033f1530d3d3833b542c09984899 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingSingleAddressTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingSingleAddressTest.java
|
| @@ -4,6 +4,7 @@
|
|
|
| package org.chromium.chrome.browser.payments;
|
|
|
| +import android.content.DialogInterface;
|
| import android.test.suitebuilder.annotation.MediumTest;
|
|
|
| import org.chromium.chrome.R;
|
| @@ -31,7 +32,7 @@ public class PaymentRequestDynamicShippingSingleAddressTest extends PaymentReque
|
| // The user has a shipping address on disk.
|
| String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com",
|
| true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "",
|
| - "US", "", "", "en-US"));
|
| + "US", "555-555-5555", "", "en-US"));
|
| helper.setCreditCard(new CreditCard("", "https://example.com", true, true, "Jon Doe",
|
| "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_visa,
|
| billingAddressId));
|
| @@ -42,6 +43,51 @@ public class PaymentRequestDynamicShippingSingleAddressTest extends PaymentReque
|
| public void testAddressNotSelected()
|
| throws InterruptedException, ExecutionException, TimeoutException {
|
| triggerUIAndWait(mReadyForInput);
|
| - assertEquals("Select shipping address", getAddressSectionLabel());
|
| + assertEquals("Select shipping", getAddressSectionLabel());
|
| + }
|
| +
|
| + /** Expand the shipping address section, select an address, and click "Pay." */
|
| + @MediumTest
|
| + public void testSelectValidAddressAndPay()
|
| + throws InterruptedException, ExecutionException, TimeoutException {
|
| + triggerUIAndWait(mReadyForInput);
|
| + clickInShippingSummaryAndWait(R.id.payments_section, mReadyForInput);
|
| + clickInShippingAddressAndWait(R.id.payments_first_radio_button, mReadyToPay);
|
| + clickAndWait(R.id.button_primary, mReadyForUnmaskInput);
|
| + setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyToUnmask);
|
| + clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed);
|
| + expectResultContains(new String[] {"Jon Doe", "4111111111111111", "12", "2050", "visa",
|
| + "123", "Google", "340 Main St", "CA", "Los Angeles", "90291", "US", "en",
|
| + "californiaShippingOption"});
|
| + }
|
| +
|
| + /** Attempt to add an invalid address and cancel the transaction. */
|
| + @MediumTest
|
| + public void testAddInvalidAddressAndCancel()
|
| + throws InterruptedException, ExecutionException, TimeoutException {
|
| + triggerUIAndWait(mReadyForInput);
|
| + clickInShippingSummaryAndWait(R.id.payments_section, mReadyForInput);
|
| + clickInShippingAddressAndWait(R.id.payments_add_option_button, mReadyToEdit);
|
| + clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationError);
|
| + clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyToClose);
|
| + clickAndWait(R.id.close_button, mDismissed);
|
| + expectResultContains(new String[] {"Request cancelled"});
|
| + }
|
| +
|
| + /** Add a valid address and complete the transaction. */
|
| + @MediumTest
|
| + public void testAddAddressAndPay()
|
| + throws InterruptedException, ExecutionException, TimeoutException {
|
| + triggerUIAndWait(mReadyForInput);
|
| + clickInShippingSummaryAndWait(R.id.payments_section, mReadyForInput);
|
| + clickInShippingAddressAndWait(R.id.payments_add_option_button, mReadyToEdit);
|
| + setTextInEditorAndWait(new String[] {"Bob", "Google", "1600 Amphitheatre Pkwy",
|
| + "Mountain View", "CA", "94043", "999-999-9999"}, mEditorTextUpdate);
|
| + clickInEditorAndWait(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[] {"Bob", "Google", "1600 Amphitheatre Pkwy",
|
| + "Mountain View", "CA", "94043", "999-999-9999"});
|
| }
|
| }
|
|
|