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.support.test.filters.MediumTest; | 7 import android.support.test.filters.MediumTest; |
8 | 8 |
9 import org.chromium.base.test.util.Feature; | 9 import org.chromium.base.test.util.Feature; |
10 import org.chromium.chrome.R; | 10 import org.chromium.chrome.R; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 public void testBillingAddressSortedByFrecency_AddNewAddress() | 244 public void testBillingAddressSortedByFrecency_AddNewAddress() |
245 throws InterruptedException, ExecutionException, TimeoutException { | 245 throws InterruptedException, ExecutionException, TimeoutException { |
246 // Add a payment method. | 246 // Add a payment method. |
247 triggerUIAndWait(mReadyToPay); | 247 triggerUIAndWait(mReadyToPay); |
248 clickInPaymentMethodAndWait(R.id.payments_section, mReadyForInput); | 248 clickInPaymentMethodAndWait(R.id.payments_section, mReadyForInput); |
249 clickInPaymentMethodAndWait(R.id.payments_add_option_button, mReadyToEdi t); | 249 clickInPaymentMethodAndWait(R.id.payments_add_option_button, mReadyToEdi t); |
250 | 250 |
251 // Add a new billing address. | 251 // Add a new billing address. |
252 setSpinnerSelectionsInCardEditorAndWait( | 252 setSpinnerSelectionsInCardEditorAndWait( |
253 new int[] {DECEMBER, NEXT_YEAR, ADD_BILLING_ADDRESS}, mReadyToEd it); | 253 new int[] {DECEMBER, NEXT_YEAR, ADD_BILLING_ADDRESS}, mReadyToEd it); |
254 | |
sebsg
2017/02/28 16:13:59
Nit: remove new-line
Parastoo
2017/03/21 14:30:44
Done.
| |
254 setTextInEditorAndWait(new String[] {"Seb Doe", "Google", "340 Main St", "Los Angeles", | 255 setTextInEditorAndWait(new String[] {"Seb Doe", "Google", "340 Main St", "Los Angeles", |
255 "CA", "90291", "999-999-9999"}, mEditorTextUpdate); | 256 "90291", "999-999-9999"}, |
257 mEditorTextUpdate); | |
258 setSpinnerSelectionsInEditorAndWait(new int[] {US, CA}, mEditorTextUpdat e); | |
259 | |
256 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToEdit); | 260 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToEdit); |
257 | 261 |
258 // There should be 9 suggestions, the 7 initial addresses, the newly add ed address and the | 262 // There should be 9 suggestions, the 7 initial addresses, the newly add ed address and the |
259 // option to add a new address. | 263 // option to add a new address. |
260 assertEquals(9, getSpinnerItemCountInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX)); | 264 assertEquals(9, getSpinnerItemCountInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX)); |
261 | 265 |
262 // The fist suggestion should be the newly added address. | 266 // The fist suggestion should be the newly added address. |
263 assertTrue(getSpinnerTextAtPositionInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX, | 267 assertTrue(getSpinnerTextAtPositionInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX, |
264 0).equals("Seb Doe, 340 Main St, Los Angeles, CA 90291")); | 268 0).equals("Seb Doe, 340 Main St, Los Angeles, CA 90291")); |
265 | 269 |
(...skipping 15 matching lines...) Expand all Loading... | |
281 @MediumTest | 285 @MediumTest |
282 @Feature({"Payments"}) | 286 @Feature({"Payments"}) |
283 public void testNewShippingAddressSuggestedFirst() | 287 public void testNewShippingAddressSuggestedFirst() |
284 throws InterruptedException, ExecutionException, TimeoutException { | 288 throws InterruptedException, ExecutionException, TimeoutException { |
285 triggerUIAndWait(mReadyToPay); | 289 triggerUIAndWait(mReadyToPay); |
286 | 290 |
287 // Add a shipping address. | 291 // Add a shipping address. |
288 clickInShippingSummaryAndWait(R.id.payments_section, mReadyForInput); | 292 clickInShippingSummaryAndWait(R.id.payments_section, mReadyForInput); |
289 clickInShippingAddressAndWait(R.id.payments_add_option_button, mReadyToE dit); | 293 clickInShippingAddressAndWait(R.id.payments_add_option_button, mReadyToE dit); |
290 setTextInEditorAndWait(new String[] {"Seb Doe", "Google", "340 Main St", "Los Angeles", | 294 setTextInEditorAndWait(new String[] {"Seb Doe", "Google", "340 Main St", "Los Angeles", |
291 "CA", "90291", "999-999-9999"}, mEditorTextUpdate); | 295 "90291", "999-999-9999"}, |
296 mEditorTextUpdate); | |
297 setSpinnerSelectionsInEditorAndWait(new int[] {US, CA}, mEditorTextUpdat e); | |
298 | |
292 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); | 299 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); |
293 | 300 |
294 // Navigate to the card editor UI. | 301 // Navigate to the card editor UI. |
295 clickInPaymentMethodAndWait(R.id.payments_section, mReadyForInput); | 302 clickInPaymentMethodAndWait(R.id.payments_section, mReadyForInput); |
296 clickInPaymentMethodAndWait(R.id.payments_add_option_button, mReadyToEdi t); | 303 clickInPaymentMethodAndWait(R.id.payments_add_option_button, mReadyToEdi t); |
297 | 304 |
298 // There should be 9 suggestions, the 7 initial addresses, the newly add ed address and the | 305 // There should be 9 suggestions, the 7 initial addresses, the newly add ed address and the |
299 // option to add a new address. | 306 // option to add a new address. |
300 assertEquals(9, getSpinnerItemCountInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX)); | 307 assertEquals(9, getSpinnerItemCountInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX)); |
301 | 308 |
(...skipping 21 matching lines...) Expand all Loading... | |
323 assertTrue(getSpinnerTextAtPositionInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX, | 330 assertTrue(getSpinnerTextAtPositionInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX, |
324 4).endsWith("Recipient required")); | 331 4).endsWith("Recipient required")); |
325 assertTrue(getSpinnerTextAtPositionInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX, | 332 assertTrue(getSpinnerTextAtPositionInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX, |
326 5).endsWith("More information required")); | 333 5).endsWith("More information required")); |
327 assertTrue(getSpinnerTextAtPositionInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX, | 334 assertTrue(getSpinnerTextAtPositionInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX, |
328 6).endsWith("Invalid address")); | 335 6).endsWith("Invalid address")); |
329 | 336 |
330 // Selects the fourth billing addresss that misses phone number brings u p the address | 337 // Selects the fourth billing addresss that misses phone number brings u p the address |
331 // editor. | 338 // editor. |
332 setSpinnerSelectionsInCardEditorAndWait(new int[] {DECEMBER, NEXT_YEAR, 3}, mReadyToEdit); | 339 setSpinnerSelectionsInCardEditorAndWait(new int[] {DECEMBER, NEXT_YEAR, 3}, mReadyToEdit); |
340 | |
sebsg
2017/02/28 16:13:59
Nit: Remove new-line
Parastoo
2017/03/21 14:30:44
Done.
| |
333 setTextInEditorAndWait(new String[] {"Lisa Doe", "Google", "340 Main St" , "Los Angeles", | 341 setTextInEditorAndWait(new String[] {"Lisa Doe", "Google", "340 Main St" , "Los Angeles", |
334 "CA", "90291", "999-999-9999"}, mEditorTextUpdate); | 342 "90291", "999-999-9999"}, |
343 mEditorTextUpdate); | |
344 | |
335 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToEdit); | 345 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToEdit); |
336 | 346 |
337 // The newly completed address must be selected and put at the top of th e dropdown. | 347 // The newly completed address must be selected and put at the top of th e dropdown. |
338 assertTrue(getSpinnerSelectionTextInCardEditor(BILLING_ADDRESS_DROPDOWN_ INDEX) | 348 assertTrue(getSpinnerSelectionTextInCardEditor(BILLING_ADDRESS_DROPDOWN_ INDEX) |
339 .equals("Lisa Doe, 340 Main St, Los Angeles, CA 90291")); | 349 .equals("Lisa Doe, 340 Main St, Los Angeles, CA 90291")); |
340 assertTrue(getSpinnerTextAtPositionInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX, | 350 assertTrue(getSpinnerTextAtPositionInCardEditor(BILLING_ADDRESS_DROPDOWN _INDEX, |
341 0).equals("Lisa Doe, 340 Main St, Los Angeles, CA 90291")); | 351 0).equals("Lisa Doe, 340 Main St, Los Angeles, CA 90291")); |
342 } | 352 } |
343 | 353 |
344 @MediumTest | 354 @MediumTest |
(...skipping 22 matching lines...) Expand all Loading... | |
367 // Selects the fifth billing addresss that misses recipient name brings up the address | 377 // Selects the fifth billing addresss that misses recipient name brings up the address |
368 // editor. | 378 // editor. |
369 setSpinnerSelectionsInCardEditorAndWait(new int[] {DECEMBER, NEXT_YEAR, 4}, mReadyToEdit); | 379 setSpinnerSelectionsInCardEditorAndWait(new int[] {DECEMBER, NEXT_YEAR, 4}, mReadyToEdit); |
370 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyToEdit); | 380 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyToEdit); |
371 | 381 |
372 // The previous selected address should be selected after canceling out from edit. | 382 // The previous selected address should be selected after canceling out from edit. |
373 assertTrue(getSpinnerSelectionTextInCardEditor(BILLING_ADDRESS_DROPDOWN_ INDEX) | 383 assertTrue(getSpinnerSelectionTextInCardEditor(BILLING_ADDRESS_DROPDOWN_ INDEX) |
374 .equals("Jon Doe, 340 Main St, Los Angeles, CA 90291")); | 384 .equals("Jon Doe, 340 Main St, Los Angeles, CA 90291")); |
375 } | 385 } |
376 } | 386 } |
OLD | NEW |