Bug 1630192 - Wait for the page to load before attempting to retrieve element. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D72506
This commit is contained in:
Jean-Yves Avenard 2020-04-26 10:42:24 +00:00
Родитель 55ff537cae
Коммит 07d72f57f6
1 изменённых файлов: 8 добавлений и 5 удалений

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

@ -5,7 +5,6 @@
"use strict"; "use strict";
var initialLocation = gBrowser.currentURI.spec; var initialLocation = gBrowser.currentURI.spec;
var newTab = null;
add_task(async function() { add_task(async function() {
CustomizableUI.addWidgetToArea( CustomizableUI.addWidgetToArea(
@ -23,10 +22,14 @@ add_task(async function() {
ok(addonsButton, "Add-ons button exists in Panel Menu"); ok(addonsButton, "Add-ons button exists in Panel Menu");
addonsButton.click(); addonsButton.click();
newTab = gBrowser.selectedTab; await Promise.all([
await TestUtils.waitForCondition( TestUtils.waitForCondition(
() => gBrowser.currentURI && gBrowser.currentURI.spec == "about:addons" () => gBrowser.currentURI && gBrowser.currentURI.spec == "about:addons"
); ),
new Promise(r =>
gBrowser.selectedBrowser.addEventListener("load", r, true)
),
]);
let addonsPage = gBrowser.selectedBrowser.contentWindow.document.getElementById( let addonsPage = gBrowser.selectedBrowser.contentWindow.document.getElementById(
"addons-page" "addons-page"