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

Unified 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, 2 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/test/data/webui/settings/settings_autofill_section_browsertest.js
diff --git a/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js b/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js
index 988b092d2923d69395b22fafec1cf3a83be5f7fc..308208095d89eaa96e84ad9394e19010e55d2d34 100644
--- a/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js
+++ b/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js
@@ -303,6 +303,33 @@ TEST_F('SettingsAutofillSectionBrowserTest', 'CreditCardTests', function() {
});
});
+ test('verifySaveExpiredCreditCardEdit', function(done) {
+ var creditCard = FakeDataMaker.emptyCreditCardEntry();
+
+ var now = new Date();
+ 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.
+ 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.
+
+ var creditCardDialog = self.createCreditCardDialog_(creditCard);
+
+ return test_util.whenAttributeIs(
+ creditCardDialog.$.dialog, 'open', true).then(function() {
+ creditCardDialog.addEventListener('save-credit-card', function() {
+ // Fail the test because the save event should not be called when
+ // the card is expired.
+ assertTrue(false);
+ 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.
+ });
+ creditCardDialog.addEventListener('tap', function() {
+ // Test is |done| in a timeout in order to ensure that
+ // 'save-credit-card' is NOT fired after this test.
+ 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.
+ });
+
+ MockInteractions.tap(creditCardDialog.$.saveButton);
+ });
+ });
+
// Test will timeout if event is not received.
test('verifySaveCreditCardEdit', function(done) {
var creditCard = FakeDataMaker.emptyCreditCardEntry();

Powered by Google App Engine
This is Rietveld 408576698