forked from mirrors/gecko-dev
Bug 1681302 - Poll for identity-popup-geo-container to be populated to fix intermittent failures. r=nhnt11
Differential Revision: https://phabricator.services.mozilla.com/D99231
This commit is contained in:
parent
fe922a75e5
commit
1534629245
1 changed files with 29 additions and 19 deletions
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
requestLongerTimeout(2);
|
||||||
|
|
||||||
ChromeUtils.import("resource:///modules/PermissionUI.jsm", this);
|
ChromeUtils.import("resource:///modules/PermissionUI.jsm", this);
|
||||||
ChromeUtils.import("resource:///modules/SitePermissions.jsm", this);
|
ChromeUtils.import("resource:///modules/SitePermissions.jsm", this);
|
||||||
const { PermissionTestUtils } = ChromeUtils.import(
|
const { PermissionTestUtils } = ChromeUtils.import(
|
||||||
|
|
@ -66,6 +68,12 @@ async function testIdentityPopupGeoContainer(
|
||||||
containerVisible,
|
containerVisible,
|
||||||
timestampVisible
|
timestampVisible
|
||||||
) {
|
) {
|
||||||
|
// The container holds the timestamp element, therefore we can't have a
|
||||||
|
// visible timestamp without the container.
|
||||||
|
if (timestampVisible && !containerVisible) {
|
||||||
|
ok(false, "Can't have timestamp without container");
|
||||||
|
}
|
||||||
|
|
||||||
// Only call openIdentityPopup if popup is closed, otherwise it does not resolve
|
// Only call openIdentityPopup if popup is closed, otherwise it does not resolve
|
||||||
if (!gIdentityHandler._identityBox.hasAttribute("open")) {
|
if (!gIdentityHandler._identityBox.hasAttribute("open")) {
|
||||||
await openIdentityPopup();
|
await openIdentityPopup();
|
||||||
|
|
@ -74,25 +82,27 @@ async function testIdentityPopupGeoContainer(
|
||||||
let checkContainer = checkForDOMElement(
|
let checkContainer = checkForDOMElement(
|
||||||
containerVisible,
|
containerVisible,
|
||||||
"identity-popup-geo-container"
|
"identity-popup-geo-container"
|
||||||
).then(container => {
|
);
|
||||||
if (containerVisible && timestampVisible) {
|
|
||||||
is(
|
if (containerVisible && timestampVisible) {
|
||||||
container.childElementCount,
|
// Wait for the geo container to be fully populated.
|
||||||
2,
|
// The time label is computed async.
|
||||||
"identity-popup-geo-container should have two elements."
|
let container = await checkContainer;
|
||||||
);
|
await BrowserTestUtils.waitForCondition(
|
||||||
is(
|
() => container.childElementCount == 2,
|
||||||
container.childNodes[0].classList[0],
|
"identity-popup-geo-container should have two elements."
|
||||||
"identity-popup-permission-item",
|
);
|
||||||
"Geo container should have permission item."
|
is(
|
||||||
);
|
container.childNodes[0].classList[0],
|
||||||
is(
|
"identity-popup-permission-item",
|
||||||
container.childNodes[1].id,
|
"Geo container should have permission item."
|
||||||
"geo-access-indicator-item",
|
);
|
||||||
"Geo container should have indicator item."
|
is(
|
||||||
);
|
container.childNodes[1].id,
|
||||||
}
|
"geo-access-indicator-item",
|
||||||
});
|
"Geo container should have indicator item."
|
||||||
|
);
|
||||||
|
}
|
||||||
let checkAccessIndicator = checkForDOMElement(
|
let checkAccessIndicator = checkForDOMElement(
|
||||||
timestampVisible,
|
timestampVisible,
|
||||||
"geo-access-indicator-item"
|
"geo-access-indicator-item"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue