Bug 1552714 - Fix two tests which were caught not waiting for l10n but checking for l10n values. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D33741

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Zibi Braniecki 2019-06-06 16:33:18 +00:00
parent a49f5263f1
commit 70e5a4ee3a
2 changed files with 14 additions and 0 deletions

View File

@ -69,6 +69,15 @@ var waitForLoad = async function(uri) {
gBrowser.selectedBrowser.webNavigation.loadURI(uri, loadURIOptions);
await BrowserTestUtils.browserStopped(gBrowser);
// Some of the documents we're using in this test use Fluent,
// and they may finish localization later.
// To prevent this test from being intermittent, we'll
// wait for the `document.l10n.ready` promise to resolve.
if (gBrowser.selectedBrowser.contentWindow &&
gBrowser.selectedBrowser.contentWindow.document.l10n) {
await gBrowser.selectedBrowser.contentWindow.document.l10n.ready;
}
gExpectedHistory.index++;
gExpectedHistory.entries.push({
uri: gBrowser.currentURI.spec,

View File

@ -79,6 +79,11 @@ function testOnWindow(aTestData) {
await BrowserTestUtils.waitForContentEvent(browser, "DOMContentLoaded");
let doc = win.gBrowser.contentDocument;
// This test works on a document which uses Fluent.
// Fluent localization may finish later than DOMContentLoaded,
// so let's wait for `document.l10n.ready` promise to resolve.
await doc.l10n.ready;
let advisoryEl = doc.getElementById("advisory_provider");
if (aTestData.provider != "google" && aTestData.provider != "google4") {
ok(!advisoryEl, "Advisory should not be shown");