summaryrefslogtreecommitdiffstats
path: root/browser/components/screenshots/tests/browser/head.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/screenshots/tests/browser/head.js')
-rw-r--r--browser/components/screenshots/tests/browser/head.js39
1 files changed, 28 insertions, 11 deletions
diff --git a/browser/components/screenshots/tests/browser/head.js b/browser/components/screenshots/tests/browser/head.js
index 171e3b8c41..a36e955830 100644
--- a/browser/components/screenshots/tests/browser/head.js
+++ b/browser/components/screenshots/tests/browser/head.js
@@ -38,15 +38,21 @@ const MouseEvents = {
{},
{
get: (target, name) =>
- async function (x, y, options = {}) {
+ async function (x, y, options = {}, browser) {
if (name === "click") {
- this.down(x, y, options);
- this.up(x, y, options);
+ this.down(x, y, options, browser);
+ this.up(x, y, options, browser);
} else {
- await safeSynthesizeMouseEventInContentPage(":root", x, y, {
- type: "mouse" + name,
- ...options,
- });
+ await safeSynthesizeMouseEventInContentPage(
+ ":root",
+ x,
+ y,
+ {
+ type: "mouse" + name,
+ ...options,
+ },
+ browser
+ );
}
},
}
@@ -276,10 +282,15 @@ class ScreenshotsHelper {
this.waitForStateChange("resizing"),
]);
Assert.ok(true, "The overlay is in the dragging or resizing state");
-
+ // We intentionally turn off this a11y check, because the following mouse
+ // event is emitted at the end of the dragging event. Its keyboard
+ // accessible alternative is provided and tested elsewhere, therefore
+ // this rule check shall be ignored by a11y_checks suite.
+ AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false });
mouse.up(endX, endY);
await this.assertStateChange("selected");
+ AccessibilityUtils.resetEnv();
this.endX = endX;
this.endY = endY;
@@ -474,7 +485,7 @@ class ScreenshotsHelper {
);
info(`clicking cancel button at ${x}, ${y}`);
- mouse.click(x, y);
+ mouse.click(x, y, {}, this.browser);
}
async clickPreviewCancelButton() {
@@ -878,9 +889,15 @@ async function safeSynthesizeMouseEventInContentPage(
selector,
x,
y,
- options = {}
+ options = {},
+ browser
) {
- let context = gBrowser.selectedBrowser.browsingContext;
+ let context;
+ if (!browser) {
+ context = gBrowser.selectedBrowser.browsingContext;
+ } else {
+ context = browser.browsingContext;
+ }
BrowserTestUtils.synthesizeMouse(selector, x, y, options, context);
}