OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
6 | 6 |
7 import android.test.suitebuilder.annotation.MediumTest; | 7 import android.test.suitebuilder.annotation.MediumTest; |
8 | 8 |
9 import org.chromium.chrome.browser.autofill.AutofillTestHelper; | 9 import org.chromium.chrome.browser.autofill.AutofillTestHelper; |
10 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; | 10 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
11 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; | 11 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
12 | 12 |
13 import java.util.concurrent.ExecutionException; | 13 import java.util.concurrent.ExecutionException; |
14 import java.util.concurrent.TimeoutException; | 14 import java.util.concurrent.TimeoutException; |
15 | 15 |
16 /** | 16 /** |
17 * A payment integration test with a single card and a single shipping address. | 17 * A payment integration test with a single card and no shipping address. |
18 */ | 18 */ |
19 public class PaymentRequestFreeShippingTest extends PaymentRequestTestBase { | 19 public class PaymentRequestNeedAddressTest extends PaymentRequestTestBase { |
20 public PaymentRequestFreeShippingTest() { | 20 public PaymentRequestNeedAddressTest() { |
21 super("payment_request_free_shipping_test.html"); | 21 super("payment_request_need_address_test.html"); |
22 } | 22 } |
23 | 23 |
24 @Override | 24 @Override |
25 public void onMainActivityStarted() | 25 public void onMainActivityStarted() |
26 throws InterruptedException, ExecutionException, TimeoutException { | 26 throws InterruptedException, ExecutionException, TimeoutException { |
27 AutofillTestHelper helper = new AutofillTestHelper(); | 27 AutofillTestHelper helper = new AutofillTestHelper(); |
28 helper.setProfile(new AutofillProfile("", "https://www.example.com", tru
e, "Jon Doe", | 28 helper.setProfile(new AutofillProfile("", "https://www.example.com", tru
e, "Jon Doe", |
29 "Acme", "123 Main St", "CA", "Los Angeles", "", "12345", "", "US
", "", "", | 29 "Acme", "123 Main St", "CA", "Los Angeles", "", "12345", "", "US
", "", "", |
30 "en-US")); | 30 "en-US")); |
31 helper.setCreditCard(new CreditCard("", "https://www.example.com", true,
true, "Jon Smith", | 31 helper.setCreditCard(new CreditCard("", "https://www.example.com", true,
true, "Jon Smith", |
32 "4111111111111111", "Visa ***1111", "12", "2050", "visa", 0)); | 32 "4111111111111111", "Visa ***1111", "12", "2050", "visa", 0)); |
33 } | 33 } |
34 | 34 |
35 @MediumTest | 35 @MediumTest |
36 public void testPay() throws InterruptedException, ExecutionException, Timeo
utException { | 36 public void testPay() throws InterruptedException, ExecutionException, Timeo
utException { |
37 triggerPaymentUI(); | 37 triggerPaymentUI(); |
| 38 expandShippingAddressSection(); |
| 39 selectOptionInExpandedSection(); |
38 clickPrimaryPaymentUIButton(); | 40 clickPrimaryPaymentUIButton(); |
39 typeInCvc("123"); | 41 typeInCvc("123"); |
40 clickPrimaryCVCPromptButton(); | 42 clickPrimaryCVCPromptButton(); |
41 waitForPaymentUIHidden(); | 43 waitForPaymentUIHidden(); |
42 expectResultContains(new String[] {"visa", "4111111111111111", "12", "20
50", "123", | 44 expectResultContains(new String[] {"visa", "4111111111111111", "12", "20
50", "123", |
43 "Jon Smith", "123 Main St", "Acme", "CA", "Los Angeles", "12345"
, "US", "en", | 45 "Jon Smith", "123 Main St", "Acme", "CA", "Los Angeles", "12345"
, "US", "en", |
44 "freeShippingOption"}); | 46 "calculatedShippingOption"}); |
45 } | 47 } |
46 } | 48 } |
OLD | NEW |