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

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

Issue 2081533002: Edit contacts UI for PaymentRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contactDetails
Patch Set: Addressed comments 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/PaymentRequestContactDetailsTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestContactDetailsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestContactDetailsTest.java
index 2820aae6166e1bd1776374b474bc6e872466197b..529276fbf58132eff575b8ffe1fe5f152a48dbe8 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestContactDetailsTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestContactDetailsTest.java
@@ -20,6 +20,7 @@ import java.util.concurrent.TimeoutException;
*/
public class PaymentRequestContactDetailsTest extends PaymentRequestTestBase {
public PaymentRequestContactDetailsTest() {
+ // The merchant requests both a phone number and an email address.
super("payment_request_contact_details_test.html");
}
@@ -27,6 +28,7 @@ public class PaymentRequestContactDetailsTest extends PaymentRequestTestBase {
public void onMainActivityStarted()
throws InterruptedException, ExecutionException, TimeoutException {
AutofillTestHelper helper = new AutofillTestHelper();
+ // The user has valid phone number and email address on disk.
helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google",
"340 Main St", "CA", "Los Angeles", "", "90291", "", "US", "555-555-5555",
"jon.doe@google.com", "en-US"));
@@ -34,14 +36,44 @@ public class PaymentRequestContactDetailsTest extends PaymentRequestTestBase {
"4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_visa));
}
+ /** Provide the existing valid phone number and email address to the merchant. */
@MediumTest
public void testPay() throws InterruptedException, ExecutionException, TimeoutException {
triggerUIAndWait(mReadyToPay);
clickAndWait(R.id.button_primary, mReadyForUnmaskInput);
- typeInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123",
- mReadyForUnmaskInput.getTarget(), mReadyToUnmask);
- clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE,
- mReadyToUnmask.getTarget(), mDismissed);
+ setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyToUnmask);
+ clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed);
expectResultContains(new String[] {"555-555-5555", "jon.doe@google.com"});
}
+
+ /** Attempt to add invalid phone number and email address and cancel the transaction. */
+ @MediumTest
+ public void testAddInvalidContactAndCancel()
+ throws InterruptedException, ExecutionException, TimeoutException {
+ triggerUIAndWait(mReadyToPay);
+ clickInContactInfoAndWait(R.id.payments_section, mReadyForInput);
+ clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit);
+ setTextInEditor(R.id.payments_edit_phone_input, "+++");
+ setTextInEditor(R.id.payments_edit_email_input, "jane.jones");
+ 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 new phone number and email address and provide that to the merchant. */
+ @MediumTest
+ public void testAddContactAndPay()
+ throws InterruptedException, ExecutionException, TimeoutException {
+ triggerUIAndWait(mReadyToPay);
+ clickInContactInfoAndWait(R.id.payments_section, mReadyForInput);
+ clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit);
+ setTextInEditor(R.id.payments_edit_phone_input, "999-999-9999");
+ setTextInEditor(R.id.payments_edit_email_input, "jane.jones@google.com");
+ 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[] {"999-999-9999", "jane.jones@google.com"});
+ }
}

Powered by Google App Engine
This is Rietveld 408576698