Bug 1676524 - fix intermittent failures in browser_experimental_features_filter.js due to fluent races r=emilio
The test overwrites a fluent-originating text content with its own, but doesn't clear the fluent data-l10n-id attribute. As a result, if it tries to write the textContent before the data-l10n-id pass from fluent has run, fluent overwrites the textContent before we do a search, and then the rest of the test gets bogus results because it matches against the wrong text content. This patch fixes this by removing the data-l10n-id attribute so the fluent pass doesn't try to put text in these elements anymore. Differential Revision: https://phabricator.services.mozilla.com/D122659
This commit is contained in:
@@ -62,9 +62,12 @@ add_task(async function testFilterFeatures() {
|
||||
// Manually modify the labels of the features that were just added, so that the test
|
||||
// can rely on consistent search terms.
|
||||
for (let definition of definitions) {
|
||||
doc.getElementById(definition.id).label = definition.title;
|
||||
doc.getElementById(definition.id + "-description").textContent =
|
||||
definition.description;
|
||||
let mainItem = doc.getElementById(definition.id);
|
||||
mainItem.label = definition.title;
|
||||
mainItem.removeAttribute("data-l10n-id");
|
||||
let descItem = doc.getElementById(definition.id + "-description");
|
||||
descItem.textContent = definition.description;
|
||||
descItem.removeAttribute("data-l10n-id");
|
||||
}
|
||||
|
||||
// First, check that all of the items are visible by default.
|
||||
@@ -72,7 +75,7 @@ add_task(async function testFilterFeatures() {
|
||||
checkVisibility(
|
||||
doc.getElementById(definition.id),
|
||||
true,
|
||||
"item " + definition.id + " not initially hidden"
|
||||
`${definition.id} should be initially visible`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -83,8 +86,11 @@ add_task(async function testFilterFeatures() {
|
||||
checkVisibility(
|
||||
doc.getElementById(definition.id),
|
||||
definition.result,
|
||||
"item " + definition.id + " after first search"
|
||||
`${definition.id} should be ${
|
||||
definition.result ? "visible" : "hidden"
|
||||
} after first search`
|
||||
);
|
||||
info("Text for item was: " + doc.getElementById(definition.id).textContent);
|
||||
}
|
||||
|
||||
// Further restrict the search to only a single item.
|
||||
@@ -95,7 +101,9 @@ add_task(async function testFilterFeatures() {
|
||||
checkVisibility(
|
||||
doc.getElementById(definition.id),
|
||||
shouldBeVisible,
|
||||
"item " + definition.id + " after further search"
|
||||
`${definition.id} should be ${
|
||||
shouldBeVisible ? "visible" : "hidden"
|
||||
} after further search`
|
||||
);
|
||||
shouldBeVisible = false;
|
||||
}
|
||||
@@ -116,7 +124,7 @@ add_task(async function testFilterFeatures() {
|
||||
checkVisibility(
|
||||
doc.getElementById(definition.id),
|
||||
true,
|
||||
"item " + definition.id + " not hidden after search cleared"
|
||||
`${definition.id} should be visible after search cleared`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -129,7 +137,9 @@ add_task(async function testFilterFeatures() {
|
||||
checkVisibility(
|
||||
doc.getElementById(definition.id),
|
||||
definition.result,
|
||||
"item " + definition.id + " after next search"
|
||||
`${definition.id} should be ${
|
||||
definition.result ? "visible" : "hidden"
|
||||
} after next search`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -143,10 +153,7 @@ add_task(async function testFilterFeatures() {
|
||||
checkVisibility(
|
||||
doc.getElementById(definition.id),
|
||||
true,
|
||||
"item " +
|
||||
definition.id +
|
||||
" not hidden after category change to " +
|
||||
category
|
||||
`${definition.id} should be visible after category change to ${category}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user