зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1596165 - add back timers for tests that permafail without the waitForCondition initial timer, r=Gijs.
Differential Revision: https://phabricator.services.mozilla.com/D109646
This commit is contained in:
Родитель
9d7bb1aa62
Коммит
c27883eea9
|
@ -9,6 +9,10 @@ add_task(async function test_searchbar_a11y_tree() {
|
|||
set: [["browser.search.widget.inNavBar", true]],
|
||||
});
|
||||
|
||||
// This used to rely on the implied 100ms initial timer of
|
||||
// TestUtils.waitForCondition. See bug 1700735.
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
let searchbar = await TestUtils.waitForCondition(
|
||||
() => document.getElementById("searchbar"),
|
||||
"wait for search bar to appear"
|
||||
|
|
|
@ -7,6 +7,26 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
|
||||
SearchTestUtils.init(this);
|
||||
|
||||
// A test in this folder used to rely on the initial timer of
|
||||
// TestUtils.waitForCondition. Removing these timers makes
|
||||
// browser_aboutNewTab_defaultBrowserNotification.js fail.
|
||||
// See bug 1660723.
|
||||
const originalWaitForCondition = TestUtils.waitForCondition;
|
||||
TestUtils.waitForCondition = async function(
|
||||
condition,
|
||||
msg,
|
||||
interval = 100,
|
||||
maxTries = 50
|
||||
) {
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
return originalWaitForCondition(condition, msg, interval, maxTries);
|
||||
};
|
||||
registerCleanupFunction(function() {
|
||||
TestUtils.waitForCondition = originalWaitForCondition;
|
||||
});
|
||||
|
||||
function getSecurityInfo(securityInfoAsString) {
|
||||
const serhelper = Cc[
|
||||
"@mozilla.org/network/serialization-helper;1"
|
||||
|
|
|
@ -16,6 +16,11 @@ add_task(async function() {
|
|||
CustomizableUI.AREA_FIXED_OVERFLOW_PANEL
|
||||
);
|
||||
|
||||
// This test used to rely on the implied 100ms initial timer of the
|
||||
// TestUtils.waitForCondition call made within waitForOverflowButtonShown.
|
||||
// See bug 1498063.
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
await waitForOverflowButtonShown();
|
||||
registerCleanupFunction(() => CustomizableUI.reset());
|
||||
|
||||
|
|
|
@ -50,6 +50,26 @@ async function clearWarnedHosts() {
|
|||
});
|
||||
}
|
||||
|
||||
add_task(function setup() {
|
||||
// This test used to rely on the initial timer of
|
||||
// TestUtils.waitForCondition. See bug 1700683.
|
||||
let originalWaitForCondition = TestUtils.waitForCondition;
|
||||
TestUtils.waitForCondition = async function(
|
||||
condition,
|
||||
msg,
|
||||
interval = 100,
|
||||
maxTries = 50
|
||||
) {
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
return originalWaitForCondition(condition, msg, interval, maxTries);
|
||||
};
|
||||
registerCleanupFunction(function() {
|
||||
TestUtils.waitForCondition = originalWaitForCondition;
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_main_flow() {
|
||||
info("Test that we show the first alert correctly for a recent breach.");
|
||||
|
||||
|
|
|
@ -128,6 +128,10 @@ async function assertSearchSourcesTelemetry(
|
|||
let histSnapshot = {};
|
||||
let scalars = {};
|
||||
|
||||
// This used to rely on the implied 100ms initial timer of
|
||||
// TestUtils.waitForCondition. See bug 1515466.
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
await TestUtils.waitForCondition(() => {
|
||||
histSnapshot = searchCounts.snapshot();
|
||||
return (
|
||||
|
|
|
@ -1405,12 +1405,28 @@ add_task(async function test() {
|
|||
},
|
||||
]);
|
||||
|
||||
// This test used to rely on the initial timer of
|
||||
// TestUtils.waitForCondition. See bug 1667216.
|
||||
let originalWaitForCondition = TestUtils.waitForCondition;
|
||||
TestUtils.waitForCondition = async function(
|
||||
condition,
|
||||
msg,
|
||||
interval = 100,
|
||||
maxTries = 50
|
||||
) {
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
return originalWaitForCondition(condition, msg, interval, maxTries);
|
||||
};
|
||||
|
||||
registerCleanupFunction(async function() {
|
||||
await Services.search.setDefault(oldDefaultEngine);
|
||||
await PlacesUtils.keywords.remove("kw");
|
||||
await PlacesUtils.bookmarks.remove(bm);
|
||||
await PlacesUtils.history.clear();
|
||||
await UrlbarTestUtils.formHistory.clear(window);
|
||||
TestUtils.waitForCondition = originalWaitForCondition;
|
||||
});
|
||||
|
||||
// This is not necessary after each loop, because assertEvents does it.
|
||||
|
|
|
@ -540,6 +540,11 @@ add_task(async function test_countryAndStateFieldLabels() {
|
|||
// Check that the labels were filled
|
||||
for (let labelEl of mutatableLabels) {
|
||||
if (!labelEl.textContent) {
|
||||
// This test used to rely on the implied initial timer of
|
||||
// TestUtils.waitForCondition. See bug 1700685.
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 10));
|
||||
|
||||
await TestUtils.waitForCondition(
|
||||
() => labelEl.textContent,
|
||||
"Wait for label to be populated by the mutation observer",
|
||||
|
|
Загрузка…
Ссылка в новой задаче