Bug 1673689 - Follow up: Prevent intermittent failures by waiting for the subdialog to disappear before running following tests. r=mkmelin

This commit is contained in:
Alessandro Castellani 2020-11-14 11:28:09 +02:00
Родитель 0703db16f9
Коммит a9053876c6
1 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -141,10 +141,22 @@ add_task(async function generate_new_key() {
"Timeout waiting for the #wizardOverlay to appear" "Timeout waiting for the #wizardOverlay to appear"
); );
// Store the wait event here before the SubDialog is destroyed and we can't
// access it anymore.
let frameWinUnload = BrowserTestUtils.waitForEvent(
gTab.browser.contentWindow.gSubDialog._topDialog._frame.contentWindow,
"unload",
true
);
// Confirm the generation of the new key. // Confirm the generation of the new key.
let confirmButton = doc.getElementById("openPgpKeygenConfirmButton"); let confirmButton = doc.getElementById("openPgpKeygenConfirmButton");
EventUtils.synthesizeMouseAtCenter(confirmButton, {}, dialog.ownerGlobal); EventUtils.synthesizeMouseAtCenter(confirmButton, {}, dialog.ownerGlobal);
// Wait for the subdialog to close.
info("Waiting for subdialog unload");
await frameWinUnload;
// The key wizard should automatically assign the newly generated key to the // The key wizard should automatically assign the newly generated key to the
// selected identity and close the dialog. Let's wait for that change. // selected identity and close the dialog. Let's wait for that change.
await TestUtils.waitForCondition( await TestUtils.waitForCondition(