Skip to content

Commit 50ce93f

Browse files
committed
Bug 1982318 - Fix some flakiness in the about:logging tests r=julienw
Previously, when we were saving the profile to disk, we getting the profile path from the localized string. But it appears that due to some rendering timing issues, the rendered text might not contain the path yet. But we will always have it inside the data-l10n-args attribute. That's why it's better to check that directly. Differential Revision: https://phabricator.services.mozilla.com/D261090
1 parent f8090c5 commit 50ce93f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

toolkit/content/tests/browser/browser_about_logging.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,10 +587,19 @@ add_task(async function testAndroidUI() {
587587
info("Click the save button");
588588
const saveButton = await getElementFromDocumentByText(document, "Save");
589589
EventUtils.synthesizeMouseAtCenter(saveButton, {}, window);
590+
590591
const savedText = await getElementFromDocumentByText(document, "Saved to");
591592
ok(savedText, "The text path is being displayed");
592-
info(`The text displayed is: ${savedText.textContent}`);
593-
const savedPath = savedText.textContent.slice("Saved to ".length);
593+
594+
// Extract the file path from the l10n arguments
595+
const savedPath = JSON.parse(savedText.getAttribute("data-l10n-args")).path;
596+
info(`Profile saved to: ${savedPath}`);
597+
598+
Assert.ok(
599+
savedPath && !!savedPath.length,
600+
"Saved path should not be empty"
601+
);
602+
594603
const fileinfo = await IOUtils.stat(savedPath);
595604
Assert.greater(
596605
fileinfo.size,

0 commit comments

Comments
 (0)