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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java

Issue 2093363002: Autofill address editor in PaymentRequest UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contact-editor
Patch Set: Fix try-bot Created 4 years, 6 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: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java
index 28dadc6278f077ffb642dd54532b7973bf47a598..a7bd52ead86ef4b52f3be13a40680fa9148ed934 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java
@@ -31,7 +31,7 @@ public class PaymentRequestFreeShippingTest extends PaymentRequestTestBase {
// 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));
@@ -48,4 +48,52 @@ public class PaymentRequestFreeShippingTest extends PaymentRequestTestBase {
"123", "Google", "340 Main St", "CA", "Los Angeles", "90291", "US", "en",
"freeShippingOption"});
}
+
+ /** Attempt to add an invalid address and cancel the transaction. */
+ @MediumTest
+ public void testAddInvalidAddressAndCancel()
+ throws InterruptedException, ExecutionException, TimeoutException {
+ triggerUIAndWait(mReadyToPay);
+ 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, mEditorDismissed);
+ 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(mReadyToPay);
+ 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, mEditorDismissed);
+ 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"});
+ }
+
+ /** Change the country in the spinner, add a valid address, and complete the transaction. */
+ @MediumTest
+ public void testChangeCountryAddAddressAndPay()
+ throws InterruptedException, ExecutionException, TimeoutException {
+ triggerUIAndWait(mReadyToPay);
+ clickInShippingSummaryAndWait(R.id.payments_section, mReadyForInput);
+ clickInShippingAddressAndWait(R.id.payments_add_option_button, mReadyToEdit);
+ setSpinnerSelectionInEditor(0 /* Afghanistan */, mReadyToEdit);
+ setTextInEditorAndWait(new String[] {"Alice", "Supreme Court", "Airport Road", "Kabul",
+ "999-999-9999"}, mEditorTextUpdate);
+ clickInEditorAndWait(R.id.payments_edit_done_button, mEditorDismissed);
+ clickAndWait(R.id.button_primary, mReadyForUnmaskInput);
+ setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyToUnmask);
+ clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed);
+ expectResultContains(new String[] {"Alice", "Supreme Court", "Airport Road", "Kabul",
+ "999-999-9999"});
+ }
}

Powered by Google App Engine
This is Rietveld 408576698