mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: implement page target for BiDi to run the console test (#11480)
This commit is contained in:
parent
be081ba17a
commit
37bcb77494
@ -89,6 +89,7 @@ import type {BiDiNetworkIdle} from './lifecycle.js';
|
||||
import {getBiDiReadinessState, rewriteNavigationError} from './lifecycle.js';
|
||||
import {BidiNetworkManager} from './NetworkManager.js';
|
||||
import {createBidiHandle} from './Realm.js';
|
||||
import type {BiDiPageTarget} from './Target.js';
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@ -159,6 +160,7 @@ export class BidiPage extends Page {
|
||||
#keyboard: BidiKeyboard;
|
||||
#browsingContext: BrowsingContext;
|
||||
#browserContext: BidiBrowserContext;
|
||||
#target: BiDiPageTarget;
|
||||
|
||||
_client(): CDPSession {
|
||||
return this.mainFrame().context().cdpSession;
|
||||
@ -166,11 +168,13 @@ export class BidiPage extends Page {
|
||||
|
||||
constructor(
|
||||
browsingContext: BrowsingContext,
|
||||
browserContext: BidiBrowserContext
|
||||
browserContext: BidiBrowserContext,
|
||||
target: BiDiPageTarget
|
||||
) {
|
||||
super();
|
||||
this.#browsingContext = browsingContext;
|
||||
this.#browserContext = browserContext;
|
||||
this.#target = target;
|
||||
this.#connection = browsingContext.connection;
|
||||
|
||||
for (const [event, subscriber] of this.#browsingContextEvents) {
|
||||
@ -846,8 +850,8 @@ export class BidiPage extends Page {
|
||||
throw new UnsupportedOperation();
|
||||
}
|
||||
|
||||
override target(): never {
|
||||
throw new UnsupportedOperation();
|
||||
override target(): BiDiPageTarget {
|
||||
return this.#target;
|
||||
}
|
||||
|
||||
override waitForFileChooser(): never {
|
||||
|
@ -119,7 +119,7 @@ export class BiDiPageTarget extends BiDiBrowsingContextTarget {
|
||||
) {
|
||||
super(browserContext, browsingContext);
|
||||
|
||||
this.#page = new BidiPage(browsingContext, browserContext);
|
||||
this.#page = new BidiPage(browsingContext, browserContext, this);
|
||||
}
|
||||
|
||||
override async page(): Promise<BidiPage> {
|
||||
|
@ -983,6 +983,12 @@
|
||||
"parameters": ["webDriverBiDi"],
|
||||
"expectations": ["PASS"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[page.spec] Page Page.Events.Console should not throw when there are console messages in detached iframes",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["webDriverBiDi"],
|
||||
"expectations": ["PASS"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[page.spec] Page Page.Events.Console should work",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
|
Loading…
Reference in New Issue
Block a user