From eda592426efc65e575c63bc7b78458dd8a7c9b21 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Fri, 16 Jun 2023 12:58:08 +0200 Subject: [PATCH] chore: enable waitForFunction tests (#10396) --- packages/puppeteer-core/src/api/Page.ts | 8 ++--- packages/puppeteer-core/src/common/Page.ts | 12 -------- test/TestExpectations.json | 36 ++++++++++++++++++++++ 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/packages/puppeteer-core/src/api/Page.ts b/packages/puppeteer-core/src/api/Page.ts index fa8b0c943b3..217af5039fc 100644 --- a/packages/puppeteer-core/src/api/Page.ts +++ b/packages/puppeteer-core/src/api/Page.ts @@ -2768,12 +2768,8 @@ export class Page extends EventEmitter { pageFunction: Func | string, options?: FrameWaitForFunctionOptions, ...args: Params - ): Promise>>>; - waitForFunction< - Params extends unknown[], - Func extends EvaluateFunc = EvaluateFunc - >(): Promise>>> { - throw new Error('Not implemented'); + ): Promise>>> { + return this.mainFrame().waitForFunction(pageFunction, options, ...args); } /** diff --git a/packages/puppeteer-core/src/common/Page.ts b/packages/puppeteer-core/src/common/Page.ts index 7ef40ca991c..6dbfebf1df7 100644 --- a/packages/puppeteer-core/src/common/Page.ts +++ b/packages/puppeteer-core/src/common/Page.ts @@ -25,7 +25,6 @@ import { Frame, FrameAddScriptTagOptions, FrameAddStyleTagOptions, - FrameWaitForFunctionOptions, } from '../api/Frame.js'; import {HTTPRequest} from '../api/HTTPRequest.js'; import {HTTPResponse} from '../api/HTTPResponse.js'; @@ -1438,17 +1437,6 @@ export class CDPPage extends Page { return this.mainFrame().waitForXPath(xpath, options); } - override waitForFunction< - Params extends unknown[], - Func extends EvaluateFunc = EvaluateFunc - >( - pageFunction: Func | string, - options: FrameWaitForFunctionOptions = {}, - ...args: Params - ): Promise>>> { - return this.mainFrame().waitForFunction(pageFunction, options, ...args); - } - /** * This method is typically coupled with an action that triggers a device * request from an api such as WebBluetooth. diff --git a/test/TestExpectations.json b/test/TestExpectations.json index a7ef1683715..1f79beff572 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -245,6 +245,42 @@ "parameters": ["webDriverBiDi"], "expectations": ["PASS"] }, + { + "testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction *", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, + { + "testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should work when resolved right before execution context disposal", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["SKIP"] + }, + { + "testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should work with strict CSP policy", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["SKIP"] + }, + { + "testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should disable timeout when its set to 0", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["SKIP"] + }, + { + "testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should survive cross-process navigation", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["SKIP"] + }, + { + "testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should survive navigations", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["SKIP"] + }, { "testIdPattern": "[accessibility.spec] *", "platforms": ["darwin", "linux", "win32"],