Bug 1530603 - Wait for #filter in browser_autocomplete_footer.js. r=intermittent

--HG--
extra : rebase_source : 33abd24dbbb7525b1ff5900fc9de77909707fdbd
This commit is contained in:
Matthew Noorenberghe 2019-03-27 23:03:57 -07:00
parent f91e122289
commit ad469ee09b
3 changed files with 14 additions and 16 deletions

View File

@ -71,12 +71,9 @@ add_task(async function test_autocomplete_footer_onclick() {
}, "Waiting for footer to become visible");
EventUtils.synthesizeMouseAtCenter(footer, {});
await TestUtils.waitForCondition(() => {
return Services.wm.getMostRecentWindow("Toolkit:PasswordManager") !== null;
}, "Waiting for the password manager dialog to open");
let window = await waitForPasswordManagerDialog();
info("Login dialog was opened");
let window = Services.wm.getMostRecentWindow("Toolkit:PasswordManager");
await TestUtils.waitForCondition(() => {
return window.document.getElementById("filter").value == "example.com";
}, "Waiting for the search string to filter logins");
@ -109,12 +106,9 @@ add_task(async function test_autocomplete_footer_keydown() {
await EventUtils.synthesizeKey("KEY_ArrowDown");
await EventUtils.synthesizeKey("KEY_Enter");
await TestUtils.waitForCondition(() => {
return Services.wm.getMostRecentWindow("Toolkit:PasswordManager") !== null;
}, "Waiting for the password manager dialog to open");
let window = await waitForPasswordManagerDialog();
info("Login dialog was opened");
let window = Services.wm.getMostRecentWindow("Toolkit:PasswordManager");
await TestUtils.waitForCondition(() => {
return window.document.getElementById("filter").value == "example.com";
}, "Waiting for the search string to filter logins");

View File

@ -8,10 +8,7 @@ registerCleanupFunction(resetPrefs);
add_task(async function test_noFilter() {
LoginHelper.openPasswordManager(window);
await TestUtils.waitForCondition(() => {
return Services.wm.getMostRecentWindow("Toolkit:PasswordManager") !== null;
}, "Waiting for the password manager dialog to open");
let win = Services.wm.getMostRecentWindow("Toolkit:PasswordManager");
let win = await waitForPasswordManagerDialog();
ok(win, "Login dialog was opened");
await BrowserTestUtils.closeWindow(win);
await TestUtils.waitForCondition(() => {
@ -23,10 +20,7 @@ add_task(async function test_filter() {
// Greek IDN for example.test
let domain = "παράδειγμα.δοκιμή";
LoginHelper.openPasswordManager(window, domain);
await TestUtils.waitForCondition(() => {
return Services.wm.getMostRecentWindow("Toolkit:PasswordManager") !== null;
}, "Waiting for the password manager dialog to open");
let win = Services.wm.getMostRecentWindow("Toolkit:PasswordManager");
let win = await waitForPasswordManagerDialog();
await TestUtils.waitForCondition(() => {
return win.document.getElementById("filter").value == domain;
}, "Waiting for the search string to filter logins");

View File

@ -154,3 +154,13 @@ async function checkDoorhangerUsernamePassword(username, password) {
}
// End popup notification (doorhanger) functions //
async function waitForPasswordManagerDialog() {
let win;
await TestUtils.waitForCondition(() => {
win = Services.wm.getMostRecentWindow("Toolkit:PasswordManager");
return win && win.document.getElementById("filter");
}, "Waiting for the password manager dialog to open");
return win;
}