| Index: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteEmailTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteEmailTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteEmailTest.java
|
| index 80bd83aae41125e7828a27750d852374a0ecbd87..fd50ed3bffdbd250a642598431c52fc8f65259e9 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteEmailTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteEmailTest.java
|
| @@ -4,15 +4,13 @@
|
|
|
| package org.chromium.chrome.browser.payments;
|
|
|
| -import android.content.DialogInterface;
|
| import android.test.suitebuilder.annotation.MediumTest;
|
|
|
| import org.chromium.base.test.util.Feature;
|
| -import org.chromium.base.test.util.FlakyTest;
|
| import org.chromium.chrome.R;
|
| import org.chromium.chrome.browser.autofill.AutofillTestHelper;
|
| import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
|
| -import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
|
| +import org.chromium.chrome.browser.payments.ui.PaymentRequestSection;
|
|
|
| import java.util.concurrent.ExecutionException;
|
| import java.util.concurrent.TimeoutException;
|
| @@ -23,7 +21,8 @@ import java.util.concurrent.TimeoutException;
|
| */
|
| public class PaymentRequestIncompleteEmailTest extends PaymentRequestTestBase {
|
| public PaymentRequestIncompleteEmailTest() {
|
| - // This merchant requests an email address.
|
| + // This merchant requests an email address. We set the user's email as invalid, so all tests
|
| + // start in "ready for input" state.
|
| super("payment_request_email_test.html");
|
| }
|
|
|
| @@ -32,26 +31,56 @@ public class PaymentRequestIncompleteEmailTest extends PaymentRequestTestBase {
|
| throws InterruptedException, ExecutionException, TimeoutException {
|
| AutofillTestHelper helper = new AutofillTestHelper();
|
| // The user has an invalid email address on disk.
|
| - String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com",
|
| - true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "",
|
| - "US", "555-555-5555", "jon.doe" /* invalid email address */, "en-US"));
|
| - helper.setCreditCard(new CreditCard("", "https://example.com", true, true, "Jon Doe",
|
| - "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_visa,
|
| - billingAddressId, "" /* serverId */));
|
| + helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google",
|
| + "340 Main St", "CA", "Los Angeles", "", "90291", "", "US", "555-555-5555",
|
| + "jon.doe" /* invalid email address */, "en-US"));
|
| +
|
| + installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE);
|
| }
|
|
|
| /** Attempt to update the email with invalid data and cancel the transaction. */
|
| @MediumTest
|
| - @FlakyTest(message = "crbug.com/673371")
|
| @Feature({"Payments"})
|
| public void testEditIncompleteEmailAndCancel()
|
| throws InterruptedException, ExecutionException, TimeoutException {
|
| + // Not ready to pay since Contact email is invalid.
|
| triggerUIAndWait(mReadyForInput);
|
| + // Check that there is a selected payment method (makes sure we are not ready to pay because
|
| + // of the Contact Details).
|
| + expectPaymentMethodRowIsSelected(0);
|
| + // Updating contact with an invalid value and cancelling means we're still not
|
| + // ready to pay (the value is still the original value).
|
| clickInContactInfoAndWait(R.id.payments_section, mReadyForInput);
|
| clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit);
|
| setTextInEditorAndWait(new String[] {"gmail.com"}, mEditorTextUpdate);
|
| clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationError);
|
| - clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyToPay);
|
| + clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput);
|
| + assertEquals(PaymentRequestSection.EDIT_BUTTON_SELECT, getContactDetailsButtonState());
|
| +
|
| + clickAndWait(R.id.close_button, mDismissed);
|
| + expectResultContains(new String[] {"Request cancelled"});
|
| + }
|
| +
|
| + /** Attempt to add an invalid email alongside the already invalid data and cancel. */
|
| + @MediumTest
|
| + @Feature({"Payments"})
|
| + public void testAddIncompleteEmailAndCancel()
|
| + throws InterruptedException, ExecutionException, TimeoutException {
|
| + // Not ready to pay since Contact email is invalid.
|
| + triggerUIAndWait(mReadyForInput);
|
| + // Check that there is a selected payment method (makes sure we are not ready to pay because
|
| + // of the Contact Details).
|
| + expectPaymentMethodRowIsSelected(0);
|
| + // Updating contact with an invalid value and cancelling means we're still not
|
| + // ready to pay (the value is still the original value).
|
| + clickInContactInfoAndWait(R.id.payments_section, mReadyForInput);
|
| + clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit);
|
| + setTextInEditorAndWait(new String[] {"gmail.com"}, mEditorTextUpdate);
|
| + clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationError);
|
| + // The section collapses and the [SELECT] button is active.
|
| + clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput);
|
| + assertEquals(PaymentRequestSection.EDIT_BUTTON_SELECT, getContactDetailsButtonState());
|
| +
|
| clickAndWait(R.id.close_button, mDismissed);
|
| expectResultContains(new String[] {"Request cancelled"});
|
| }
|
| @@ -66,9 +95,7 @@ public class PaymentRequestIncompleteEmailTest extends PaymentRequestTestBase {
|
| clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit);
|
| setTextInEditorAndWait(new String[] {"jon.doe@google.com"}, 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);
|
| + clickAndWait(R.id.button_primary, mDismissed);
|
| expectResultContains(new String[] {"jon.doe@google.com"});
|
| }
|
| }
|
|
|