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

Side by Side Diff: chrome/test/data/webui/settings/settings_autofill_section_browsertest.js

Issue 2453773003: Alerting the user when the provided date for credit card is passed, not save the card, and not clos… (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 /** @fileoverview Runs the Polymer Autofill Settings tests. */ 5 /** @fileoverview Runs the Polymer Autofill Settings tests. */
6 6
7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ 7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */
8 var ROOT_PATH = '../../../../../'; 8 var ROOT_PATH = '../../../../../';
9 9
10 // Polymer BrowserTest fixture. 10 // Polymer BrowserTest fixture.
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 now.getFullYear().toString(), 296 now.getFullYear().toString(),
297 yearOptions[0].textContent.trim()); 297 yearOptions[0].textContent.trim());
298 assertEquals( 298 assertEquals(
299 maxYear.toString(), 299 maxYear.toString(),
300 yearOptions[yearOptions.length -1].textContent.trim()); 300 yearOptions[yearOptions.length -1].textContent.trim());
301 assertEquals( 301 assertEquals(
302 creditCard.expirationYear, creditCardDialog.$.year.value); 302 creditCard.expirationYear, creditCardDialog.$.year.value);
303 }); 303 });
304 }); 304 });
305 305
306 test('verifySaveExpiredCreditCardEdit', function(done) {
307 var creditCard = FakeDataMaker.emptyCreditCardEntry();
308
309 var now = new Date();
310 creditCard.expirationYear = now.getFullYear();
Moe 2016/10/27 18:31:11 Can you refactor your test to have a test for year
Parastoo 2016/10/27 22:18:57 Done.
311 creditCard.expirationMonth = now.getMonth() - 1;
Mathieu 2016/10/27 15:49:56 If this test runs in January this will be -1?
Parastoo 2016/10/27 16:08:40 Yes, and it's safe. I tested it. Is it OK to leave
Parastoo 2016/10/27 22:18:57 Done.
312
313 var creditCardDialog = self.createCreditCardDialog_(creditCard);
314
315 return test_util.whenAttributeIs(
316 creditCardDialog.$.dialog, 'open', true).then(function() {
317 creditCardDialog.addEventListener('save-credit-card', function() {
318 // Fail the test because the save event should not be called when
319 // the card is expired.
320 assertTrue(false);
321 done();
Moe 2016/10/27 18:31:11 I don't think this last line will be even reached.
Parastoo 2016/10/27 22:18:57 Done.
322 });
323 creditCardDialog.addEventListener('tap', function() {
324 // Test is |done| in a timeout in order to ensure that
325 // 'save-credit-card' is NOT fired after this test.
326 window.setTimeout(done, 100);
Mathieu 2016/10/27 15:49:57 is it possible to assert that the error shows?
Parastoo 2016/10/27 16:08:40 I have to figure out how.
Moe 2016/10/27 18:31:11 assertTrue(!!creditCardDialog.$$(...)) if you're u
Moe 2016/10/27 18:35:08 correction: assertTrue(creditCardDialog.$$(...).cl
Parastoo 2016/10/27 22:18:57 Done.
327 });
328
329 MockInteractions.tap(creditCardDialog.$.saveButton);
330 });
331 });
332
306 // Test will timeout if event is not received. 333 // Test will timeout if event is not received.
307 test('verifySaveCreditCardEdit', function(done) { 334 test('verifySaveCreditCardEdit', function(done) {
308 var creditCard = FakeDataMaker.emptyCreditCardEntry(); 335 var creditCard = FakeDataMaker.emptyCreditCardEntry();
309 var creditCardDialog = self.createCreditCardDialog_(creditCard); 336 var creditCardDialog = self.createCreditCardDialog_(creditCard);
310 337
311 return test_util.whenAttributeIs( 338 return test_util.whenAttributeIs(
312 creditCardDialog.$.dialog, 'open', true).then(function() { 339 creditCardDialog.$.dialog, 'open', true).then(function() {
313 creditCardDialog.addEventListener('save-credit-card', function(event) { 340 creditCardDialog.addEventListener('save-credit-card', function(event) {
314 assertEquals(creditCard.guid, event.detail.guid); 341 assertEquals(creditCard.guid, event.detail.guid);
315 done(); 342 done();
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 assertEquals(city, cols[0].value); 842 assertEquals(city, cols[0].value);
816 assertEquals(state, cols[1].value); 843 assertEquals(state, cols[1].value);
817 assertEquals(zip, cols[2].value); 844 assertEquals(zip, cols[2].value);
818 }); 845 });
819 }); 846 });
820 }); 847 });
821 }); 848 });
822 849
823 mocha.run(); 850 mocha.run();
824 }); 851 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698