forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1395028 - Part 3: Hide the sync checkbox if credit card sync is u…
…navailable. r=lchang MozReview-Commit-ID: KOdNkwdzWDN --HG-- extra : rebase_source : 1aaade752f7cadebd2ff1d720b3c46a777aba17e
- Loading branch information
1 parent
5e0a5c9
commit 6926e37
Showing
3 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,10 +163,47 @@ add_task(async function test_submit_creditCard_saved_with_mp_enabled_but_cancele | |
LoginTestUtils.masterPassword.disable(); | ||
}); | ||
|
||
add_task(async function test_submit_creditCard_unavailable_with_sync_account() { | ||
await SpecialPowers.pushPrefEnv({ | ||
"set": [ | ||
[SYNC_USERNAME_PREF, "[email protected]"], | ||
], | ||
}); | ||
|
||
await BrowserTestUtils.withNewTab({gBrowser, url: CREDITCARD_FORM_URL}, | ||
async function(browser) { | ||
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel, | ||
"popupshown"); | ||
is(SpecialPowers.getBoolPref(SYNC_CREDITCARDS_AVAILABLE_PREF), false, | ||
"creditCards sync should be unavailable by default"); | ||
await ContentTask.spawn(browser, null, async function() { | ||
let form = content.document.getElementById("form"); | ||
let name = form.querySelector("#cc-name"); | ||
name.focus(); | ||
name.setUserInput("User 2"); | ||
|
||
let number = form.querySelector("#cc-number"); | ||
number.setUserInput("1234123412341234"); | ||
|
||
// Wait 500ms before submission to make sure the input value applied | ||
await new Promise(resolve => setTimeout(resolve, 500)); | ||
form.querySelector("input[type=submit]").click(); | ||
}); | ||
|
||
await promiseShown; | ||
let cb = getDoorhangerCheckbox(); | ||
ok(cb.hidden, "Sync checkbox should be hidden"); | ||
|
||
await clickDoorhangerButton(SECONDARY_BUTTON); | ||
} | ||
); | ||
}); | ||
|
||
add_task(async function test_submit_creditCard_with_sync_account() { | ||
await SpecialPowers.pushPrefEnv({ | ||
"set": [ | ||
[SYNC_USERNAME_PREF, "[email protected]"], | ||
[SYNC_CREDITCARDS_AVAILABLE_PREF, true], | ||
], | ||
}); | ||
|
||
|
@@ -222,6 +259,7 @@ add_task(async function test_submit_creditCard_with_synced_already() { | |
"set": [ | ||
[SYNC_CREDITCARDS_PREF, true], | ||
[SYNC_USERNAME_PREF, "[email protected]"], | ||
[SYNC_CREDITCARDS_AVAILABLE_PREF, true], | ||
], | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters