From 63a0d8b6837b3cd41b38c9c0a07fba1970ac535f Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Thu, 16 Nov 2023 21:52:43 +0100 Subject: [PATCH] chore: fail fast waitForSelector BiDi (#11406) --- packages/puppeteer-core/src/bidi/Frame.ts | 17 ++++++++++++++++- test/TestExpectations.json | 8 ++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/puppeteer-core/src/bidi/Frame.ts b/packages/puppeteer-core/src/bidi/Frame.ts index 3a2c7c667fd..9e50931ff2c 100644 --- a/packages/puppeteer-core/src/bidi/Frame.ts +++ b/packages/puppeteer-core/src/bidi/Frame.ts @@ -28,15 +28,17 @@ import { raceWith, } from '../../third_party/rxjs/rxjs.js'; import type {CDPSession} from '../api/CDPSession.js'; +import type {ElementHandle} from '../api/ElementHandle.js'; import { Frame, type GoToOptions, type WaitForOptions, throwIfDetached, } from '../api/Frame.js'; +import type {WaitForSelectorOptions} from '../api/Page.js'; import {UnsupportedOperation} from '../common/Errors.js'; import type {TimeoutSettings} from '../common/TimeoutSettings.js'; -import type {Awaitable} from '../common/types.js'; +import type {Awaitable, NodeFor} from '../common/types.js'; import {UTILITY_WORLD_NAME, setPageContent, timeout} from '../common/util.js'; import {Deferred} from '../util/Deferred.js'; import {disposeSymbol} from '../util/disposable.js'; @@ -270,4 +272,17 @@ export class BidiFrame extends Frame { throw error; } } + + override waitForSelector( + selector: Selector, + options?: WaitForSelectorOptions + ): Promise> | null> { + if (selector.startsWith('aria')) { + throw new UnsupportedOperation( + 'ARIA selector is not supported for BiDi!' + ); + } + + return super.waitForSelector(selector, options); + } } diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 953ee308bad..fcde0bd80d7 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -357,25 +357,25 @@ "testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler waitForSelector (aria) should have an error message specifically for awaiting an element to be hidden", "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] + "expectations": ["FAIL"] }, { "testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler waitForSelector (aria) should have correct stack trace for timeout", "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] + "expectations": ["FAIL"] }, { "testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler waitForSelector (aria) should respect timeout", "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] + "expectations": ["FAIL"] }, { "testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler waitForSelector (aria) should throw when frame is detached", "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] + "expectations": ["FAIL"] }, { "testIdPattern": "[autofill.spec] *",