зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1268163 - Fix intermittent browser_capture_doorhanger_window_open.js by waiting for <input> changes. r=dolske
nsLoginManagerPrompter.js' writeDataToUI() populates the doorhanger <input> on popupshown so we need to give it a chance to do so before clicking the doorhanger button in case the test listener happens first. MozReview-Commit-ID: GkhYNpFunkp --HG-- extra : rebase_source : 435f4c524b12b4c02026b3cf4dda34f5e1ea6ed6
This commit is contained in:
Родитель
c5ab44cfcb
Коммит
c379e0b738
|
@ -33,6 +33,16 @@ function withTestTabUntilStorageChange(aPageFile, aTaskFn) {
|
|||
});
|
||||
}
|
||||
|
||||
function* checkDoorhangerUsernamePassword(username, password) {
|
||||
yield BrowserTestUtils.waitForCondition(() => {
|
||||
return document.getElementById("password-notification-username").value == username;
|
||||
}, "Wait for nsLoginManagerPrompter writeDataToUI()");
|
||||
is(document.getElementById("password-notification-username").value, username,
|
||||
"Check doorhanger username");
|
||||
is(document.getElementById("password-notification-password").value, password,
|
||||
"Check doorhanger password");
|
||||
}
|
||||
|
||||
|
||||
add_task(function* setup() {
|
||||
yield SimpleTest.promiseFocus(window);
|
||||
|
@ -49,6 +59,7 @@ add_task(function* test_saveChromeHiddenAutoClose() {
|
|||
// the popup closes and the doorhanger should appear in the opener
|
||||
let popup = getCaptureDoorhanger("password-save");
|
||||
ok(popup, "got notification popup");
|
||||
yield* checkDoorhangerUsernamePassword("notifyu1", "notifyp1");
|
||||
// Sanity check, no logins should exist yet.
|
||||
let logins = Services.logins.getAllLogins();
|
||||
is(logins.length, 0, "Should not have any logins yet");
|
||||
|
@ -72,6 +83,7 @@ add_task(function* test_changeChromeHiddenAutoClose() {
|
|||
yield notifShownPromise;
|
||||
let popup = getCaptureDoorhanger("password-change");
|
||||
ok(popup, "got notification popup");
|
||||
yield* checkDoorhangerUsernamePassword("notifyu1", "pass2");
|
||||
clickDoorhangerButton(popup, CHANGE_BUTTON);
|
||||
});
|
||||
|
||||
|
@ -99,6 +111,7 @@ add_task(function* test_saveChromeVisibleSameWindow() {
|
|||
yield notifShownPromise;
|
||||
let popup = getCaptureDoorhanger("password-save");
|
||||
ok(popup, "got notification popup");
|
||||
yield* checkDoorhangerUsernamePassword("notifyu2", "notifyp2");
|
||||
clickDoorhangerButton(popup, REMEMBER_BUTTON);
|
||||
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
@ -119,6 +132,7 @@ add_task(function* test_changeChromeVisibleSameWindow() {
|
|||
yield notifShownPromise;
|
||||
let popup = getCaptureDoorhanger("password-change");
|
||||
ok(popup, "got notification popup");
|
||||
yield* checkDoorhangerUsernamePassword("notifyu2", "pass2");
|
||||
clickDoorhangerButton(popup, CHANGE_BUTTON);
|
||||
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче