fix(webdriver): prefer globalThis over window to make it work in Firefox (#12438)

This commit is contained in:
Alex Rudenko 2024-05-14 14:37:38 +02:00 committed by GitHub
parent 0ef192097a
commit 33c6069227
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 9 deletions

View File

@ -21,11 +21,16 @@ export const ariaQuerySelector = (
root: Node,
selector: string
): Promise<Node | null> => {
return window.__ariaQuerySelector(root, selector);
// In Firefox sandboxes globalThis !== window and we expose bindings on globalThis.
return (globalThis as unknown as Window).__ariaQuerySelector(root, selector);
};
export const ariaQuerySelectorAll = async function* (
root: Node,
selector: string
): AsyncIterable<Node> {
yield* await window.__ariaQuerySelectorAll(root, selector);
// In Firefox sandboxes globalThis !== window and we expose bindings on globalThis.
yield* await (globalThis as unknown as Window).__ariaQuerySelectorAll(
root,
selector
);
};

View File

@ -209,13 +209,6 @@
"expectations": ["FAIL"],
"comment": "WebDriver BiDi locateNodes does not support shadow roots so far"
},
{
"testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler waitForSelector *",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["SKIP"],
"comment": "TODO: Needs investigation"
},
{
"testIdPattern": "[autofill.spec] *",
"platforms": ["darwin", "linux", "win32"],