commit 877fd2e1cbc05facbd0950757494eb3c6f8d904c
parent 9e5cdc617864972cfbb0f8d62f3dd0be435c5fae
Author: Erik Nordin <enordin@mozilla.com>
Date: Wed, 1 Oct 2025 16:07:08 +0000
Bug 1991224 - Misc. Translations test infrastructue fixes r=translations-reviewers,gregtatum
This patch contains a few small ergonomic changes
to the Translations test infrastructure.
Differential Revision: https://phabricator.services.mozilla.com/D266487
Diffstat:
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/toolkit/components/translations/tests/browser/shared-head.js b/toolkit/components/translations/tests/browser/shared-head.js
@@ -1360,7 +1360,10 @@ class MockedA11yUtils {
* @returns {Promise<void>}
*/
async function ensureWindowSize(win, width, height) {
- if (win.outerWidth < width + 50 && win.outerHeight < height + 50) {
+ if (
+ Math.abs(win.outerWidth - width) < 1 &&
+ Math.abs(win.outerHeight - height) < 1
+ ) {
return;
}
@@ -3155,9 +3158,14 @@ class AboutTranslationsTestUtils {
const unexpectedEventMap = {};
for (const eventName of unexpected) {
unexpectedEventMap[eventName] = false;
- this.waitForEvent(eventName).then(() => {
- unexpectedEventMap[eventName] = true;
- });
+ this.waitForEvent(eventName)
+ .then(() => {
+ unexpectedEventMap[eventName] = true;
+ })
+ .catch(() => {
+ // The waitForEvent() timeout race triggered, which is okay
+ // since we didn't expect this event to fire anyway.
+ });
}
await callback();