diff --git a/docs/api/index.md b/docs/api/index.md index 21bb1ad2d6f..31d987e869b 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -178,6 +178,7 @@ sidebar_label: API | [EvaluateFunc](./puppeteer.evaluatefunc.md) | | | [EvaluateFuncWith](./puppeteer.evaluatefuncwith.md) | | | [EventsWithWildcard](./puppeteer.eventswithwildcard.md) | | +| [EventType](./puppeteer.eventtype.md) | | | [ExperimentsConfiguration](./puppeteer.experimentsconfiguration.md) |

Defines experiment options for Puppeteer.

See individual properties for more information.

| | [FlattenHandle](./puppeteer.flattenhandle.md) | | | [HandleFor](./puppeteer.handlefor.md) | | diff --git a/docs/api/puppeteer.browsercontextevents.md b/docs/api/puppeteer.browsercontextevents.md index 92dee37e6e9..4f2c6d8ce10 100644 --- a/docs/api/puppeteer.browsercontextevents.md +++ b/docs/api/puppeteer.browsercontextevents.md @@ -10,7 +10,7 @@ sidebar_label: BrowserContextEvents export interface BrowserContextEvents extends Record ``` -**Extends:** Record<EventType, unknown> +**Extends:** Record<[EventType](./puppeteer.eventtype.md), unknown> ## Properties diff --git a/docs/api/puppeteer.browserevents.md b/docs/api/puppeteer.browserevents.md index e1789dfed39..734340f78aa 100644 --- a/docs/api/puppeteer.browserevents.md +++ b/docs/api/puppeteer.browserevents.md @@ -10,7 +10,7 @@ sidebar_label: BrowserEvents export interface BrowserEvents extends Record ``` -**Extends:** Record<EventType, unknown> +**Extends:** Record<[EventType](./puppeteer.eventtype.md), unknown> ## Properties diff --git a/docs/api/puppeteer.cdpsessionevents.md b/docs/api/puppeteer.cdpsessionevents.md index 6804162cab2..87ae0f53491 100644 --- a/docs/api/puppeteer.cdpsessionevents.md +++ b/docs/api/puppeteer.cdpsessionevents.md @@ -10,7 +10,7 @@ sidebar_label: CDPSessionEvents export interface CDPSessionEvents extends CDPEvents, Record ``` -**Extends:** [CDPEvents](./puppeteer.cdpevents.md), Record<EventType, unknown> +**Extends:** [CDPEvents](./puppeteer.cdpevents.md), Record<[EventType](./puppeteer.eventtype.md), unknown> ## Properties diff --git a/docs/api/puppeteer.eventswithwildcard.md b/docs/api/puppeteer.eventswithwildcard.md index 5a285f4aecd..592cd4f2d01 100644 --- a/docs/api/puppeteer.eventswithwildcard.md +++ b/docs/api/puppeteer.eventswithwildcard.md @@ -12,3 +12,5 @@ export type EventsWithWildcard> = '*': Events[keyof Events]; }; ``` + +**References:** [EventType](./puppeteer.eventtype.md) diff --git a/docs/api/puppeteer.eventtype.md b/docs/api/puppeteer.eventtype.md new file mode 100644 index 00000000000..db529a6ae90 --- /dev/null +++ b/docs/api/puppeteer.eventtype.md @@ -0,0 +1,11 @@ +--- +sidebar_label: EventType +--- + +# EventType type + +#### Signature: + +```typescript +export type EventType = string | symbol; +``` diff --git a/docs/api/puppeteer.frameevents.md b/docs/api/puppeteer.frameevents.md index 6ee8d30a587..0628eb09952 100644 --- a/docs/api/puppeteer.frameevents.md +++ b/docs/api/puppeteer.frameevents.md @@ -10,4 +10,4 @@ sidebar_label: FrameEvents export interface FrameEvents extends Record ``` -**Extends:** Record<EventType, unknown> +**Extends:** Record<[EventType](./puppeteer.eventtype.md), unknown> diff --git a/docs/api/puppeteer.locatorevents.md b/docs/api/puppeteer.locatorevents.md index 585a5971b50..ec142d99909 100644 --- a/docs/api/puppeteer.locatorevents.md +++ b/docs/api/puppeteer.locatorevents.md @@ -10,7 +10,7 @@ sidebar_label: LocatorEvents export interface LocatorEvents extends Record ``` -**Extends:** Record<EventType, unknown> +**Extends:** Record<[EventType](./puppeteer.eventtype.md), unknown> ## Properties diff --git a/docs/api/puppeteer.pageevents.md b/docs/api/puppeteer.pageevents.md index d6ebc325a40..148357095be 100644 --- a/docs/api/puppeteer.pageevents.md +++ b/docs/api/puppeteer.pageevents.md @@ -14,7 +14,7 @@ See [PageEvent](./puppeteer.pageevent.md) for more detail on the events and when export interface PageEvents extends Record ``` -**Extends:** Record<EventType, unknown> +**Extends:** Record<[EventType](./puppeteer.eventtype.md), unknown> ## Properties diff --git a/docs/api/puppeteer.webworker.md b/docs/api/puppeteer.webworker.md index 84c1dfb55b8..8991a22304a 100644 --- a/docs/api/puppeteer.webworker.md +++ b/docs/api/puppeteer.webworker.md @@ -12,7 +12,7 @@ This class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web export declare class WebWorker extends EventEmitter> ``` -**Extends:** [EventEmitter](./puppeteer.eventemitter.md)<Record<EventType, unknown>> +**Extends:** [EventEmitter](./puppeteer.eventemitter.md)<Record<[EventType](./puppeteer.eventtype.md), unknown>> ## Remarks diff --git a/packages/puppeteer-core/src/api/locators/locators.ts b/packages/puppeteer-core/src/api/locators/locators.ts index a504f007fdd..2faae1189e3 100644 --- a/packages/puppeteer-core/src/api/locators/locators.ts +++ b/packages/puppeteer-core/src/api/locators/locators.ts @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import type {EventType} from '../../../third_party/mitt/mitt.js'; import type { Observable, OperatorFunction, @@ -41,6 +40,7 @@ import { raceWith, tap, } from '../../../third_party/rxjs/rxjs.js'; +import type {EventType} from '../../common/EventEmitter.js'; import {EventEmitter} from '../../common/EventEmitter.js'; import type {Awaitable, HandleFor, NodeFor} from '../../common/types.js'; import {debugError, timeout} from '../../common/util.js'; diff --git a/packages/puppeteer-core/src/common/EventEmitter.ts b/packages/puppeteer-core/src/common/EventEmitter.ts index fbf259ec01b..802e55e81dd 100644 --- a/packages/puppeteer-core/src/common/EventEmitter.ts +++ b/packages/puppeteer-core/src/common/EventEmitter.ts @@ -17,16 +17,13 @@ import mitt, { type Emitter, type EventHandlerMap, - type EventType, } from '../../third_party/mitt/mitt.js'; import {disposeSymbol} from '../util/disposable.js'; -export type { - /** - * @public - */ - EventType, -} from '../../third_party/mitt/mitt.js'; +/** + * @public + */ +export type EventType = string | symbol; /** * @public diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 31220939449..f9ffc0422e6 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -371,6 +371,12 @@ "parameters": ["webDriverBiDi"], "expectations": ["PASS"] }, + { + "testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler waitForSelector (aria) should throw when frame is detached", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, { "testIdPattern": "[autofill.spec] *", "platforms": ["darwin", "linux", "win32"], @@ -845,6 +851,54 @@ "parameters": ["cdp", "firefox"], "expectations": ["SKIP"] }, + { + "testIdPattern": "[oopif.spec] OOPIF clickablePoint, boundingBox, boxModel should work for elements inside OOPIFs", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, + { + "testIdPattern": "[oopif.spec] OOPIF should provide access to elements", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, + { + "testIdPattern": "[oopif.spec] OOPIF should support evaluating in oop iframes", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, + { + "testIdPattern": "[oopif.spec] OOPIF should support frames within OOP frames", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, + { + "testIdPattern": "[oopif.spec] OOPIF should support frames within OOP iframes", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, + { + "testIdPattern": "[oopif.spec] OOPIF should track navigations within OOP iframes", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, + { + "testIdPattern": "[oopif.spec] OOPIF should treat OOP iframes and normal iframes the same", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, + { + "testIdPattern": "[oopif.spec] OOPIF waitForFrame should resolve immediately if the frame already exists", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, { "testIdPattern": "[page.spec] Page BrowserContext.overridePermissions should be prompt by default", "platforms": ["darwin", "linux", "win32"], @@ -971,6 +1025,12 @@ "parameters": ["webDriverBiDi"], "expectations": ["PASS"] }, + { + "testIdPattern": "[page.spec] Page Page.setUserAgent *", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "webDriverBiDi"], + "expectations": ["PASS"] + }, { "testIdPattern": "[page.spec] Page Page.title should return the page title", "platforms": ["darwin", "linux", "win32"], @@ -1157,6 +1217,18 @@ "parameters": ["webDriverBiDi"], "expectations": ["PASS"] }, + { + "testIdPattern": "[target.spec] Target should report when a new page is created and closed", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, + { + "testIdPattern": "[target.spec] Target should report when a target url changes", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, { "testIdPattern": "[TargetManager.spec] *", "platforms": ["darwin", "linux", "win32"], @@ -1241,12 +1313,6 @@ "parameters": ["chrome", "webDriverBiDi"], "expectations": ["PASS"] }, - { - "testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler waitForSelector (aria) should throw when frame is detached", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] - }, { "testIdPattern": "[bfcache.spec] BFCache can navigate to a BFCached page containing an OOPIF and a worker", "platforms": ["darwin", "linux", "win32"], @@ -2682,34 +2748,9 @@ "expectations": ["FAIL"] }, { - "testIdPattern": "[oopif.spec] OOPIF clickablePoint, boundingBox, boxModel should work for elements inside OOPIFs", + "testIdPattern": "[oopif.spec] OOPIF should keep track of a frames OOP state", "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] - }, - - { - "testIdPattern": "[oopif.spec] OOPIF should provide access to elements", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] - }, - { - "testIdPattern": "[oopif.spec] OOPIF should support evaluating in oop iframes", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] - }, - { - "testIdPattern": "[oopif.spec] OOPIF should support frames within OOP frames", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] - }, - { - "testIdPattern": "[oopif.spec] OOPIF should support frames within OOP iframes", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], + "parameters": ["firefox", "webDriverBiDi"], "expectations": ["PASS"] }, { @@ -2724,24 +2765,6 @@ "parameters": ["cdp", "chrome"], "expectations": ["PASS", "TIMEOUT"] }, - { - "testIdPattern": "[oopif.spec] OOPIF should track navigations within OOP iframes", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] - }, - { - "testIdPattern": "[oopif.spec] OOPIF should treat OOP iframes and normal iframes the same", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] - }, - { - "testIdPattern": "[oopif.spec] OOPIF waitForFrame should resolve immediately if the frame already exists", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] - }, { "testIdPattern": "[page.spec] Page \"after all\" hook in \"Page\"", "platforms": ["darwin", "linux", "win32"], @@ -3432,12 +3455,6 @@ "parameters": ["cdp", "firefox"], "expectations": ["SKIP"] }, - { - "testIdPattern": "[target.spec] Target should report when a new page is created and closed", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] - }, { "testIdPattern": "[target.spec] Target should report when a service worker is created and destroyed", "platforms": ["darwin", "linux", "win32"], @@ -3701,23 +3718,5 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "chrome", "headless"], "expectations": ["FAIL", "PASS"] - }, - { - "testIdPattern": "[page.spec] Page Page.setUserAgent *", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["chrome", "webDriverBiDi"], - "expectations": ["PASS"] - }, - { - "testIdPattern": "[target.spec] Target should report when a target url changes", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["PASS"] - }, - { - "testIdPattern": "[oopif.spec] OOPIF should keep track of a frames OOP state", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["PASS"] } ]