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 {getBiDiReadinessState, rewriteNavigationError} from './lifecycle.js';
|
||||||
import {BidiNetworkManager} from './NetworkManager.js';
|
import {BidiNetworkManager} from './NetworkManager.js';
|
||||||
import {createBidiHandle} from './Realm.js';
|
import {createBidiHandle} from './Realm.js';
|
||||||
|
import type {BiDiPageTarget} from './Target.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -159,6 +160,7 @@ export class BidiPage extends Page {
|
|||||||
#keyboard: BidiKeyboard;
|
#keyboard: BidiKeyboard;
|
||||||
#browsingContext: BrowsingContext;
|
#browsingContext: BrowsingContext;
|
||||||
#browserContext: BidiBrowserContext;
|
#browserContext: BidiBrowserContext;
|
||||||
|
#target: BiDiPageTarget;
|
||||||
|
|
||||||
_client(): CDPSession {
|
_client(): CDPSession {
|
||||||
return this.mainFrame().context().cdpSession;
|
return this.mainFrame().context().cdpSession;
|
||||||
@ -166,11 +168,13 @@ export class BidiPage extends Page {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
browsingContext: BrowsingContext,
|
browsingContext: BrowsingContext,
|
||||||
browserContext: BidiBrowserContext
|
browserContext: BidiBrowserContext,
|
||||||
|
target: BiDiPageTarget
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.#browsingContext = browsingContext;
|
this.#browsingContext = browsingContext;
|
||||||
this.#browserContext = browserContext;
|
this.#browserContext = browserContext;
|
||||||
|
this.#target = target;
|
||||||
this.#connection = browsingContext.connection;
|
this.#connection = browsingContext.connection;
|
||||||
|
|
||||||
for (const [event, subscriber] of this.#browsingContextEvents) {
|
for (const [event, subscriber] of this.#browsingContextEvents) {
|
||||||
@ -846,8 +850,8 @@ export class BidiPage extends Page {
|
|||||||
throw new UnsupportedOperation();
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override target(): never {
|
override target(): BiDiPageTarget {
|
||||||
throw new UnsupportedOperation();
|
return this.#target;
|
||||||
}
|
}
|
||||||
|
|
||||||
override waitForFileChooser(): never {
|
override waitForFileChooser(): never {
|
||||||
|
@ -119,7 +119,7 @@ export class BiDiPageTarget extends BiDiBrowsingContextTarget {
|
|||||||
) {
|
) {
|
||||||
super(browserContext, browsingContext);
|
super(browserContext, browsingContext);
|
||||||
|
|
||||||
this.#page = new BidiPage(browsingContext, browserContext);
|
this.#page = new BidiPage(browsingContext, browserContext, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
override async page(): Promise<BidiPage> {
|
override async page(): Promise<BidiPage> {
|
||||||
|
@ -983,6 +983,12 @@
|
|||||||
"parameters": ["webDriverBiDi"],
|
"parameters": ["webDriverBiDi"],
|
||||||
"expectations": ["PASS"]
|
"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",
|
"testIdPattern": "[page.spec] Page Page.Events.Console should work",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
Loading…
Reference in New Issue
Block a user