chore: BiDi waitForNavigation (#10424)

This commit is contained in:
Nikolay Vitkov 2023-06-21 12:45:17 +02:00 committed by GitHub
parent a3fa4017ad
commit 337184e722
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 439 additions and 113 deletions

16
package-lock.json generated
View File

@ -3020,9 +3020,9 @@
}
},
"node_modules/chromium-bidi": {
"version": "0.4.12",
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.12.tgz",
"integrity": "sha512-yl0ngMHtYUGJa2G0lkcbPvbnUZ9WMQyMNSfYmlrGD1nHRNyI9KOGw3dOaofFugXHHToneUaSmF9iUdgCBamCjA==",
"version": "0.4.13",
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.13.tgz",
"integrity": "sha512-9m2SY5DHI43OBQ7SMXjwp/iQaYo6iihqJ4IiD1OlrawGQTNveYYeJJt1yCqMxjp5y86m/uHxc9VooOWVlKFi4w==",
"dependencies": {
"mitt": "3.0.0"
},
@ -10109,7 +10109,7 @@
"license": "Apache-2.0",
"dependencies": {
"@puppeteer/browsers": "1.4.2",
"chromium-bidi": "0.4.12",
"chromium-bidi": "0.4.13",
"cross-fetch": "3.1.6",
"debug": "4.3.4",
"devtools-protocol": "0.0.1135028",
@ -12230,9 +12230,9 @@
}
},
"chromium-bidi": {
"version": "0.4.12",
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.12.tgz",
"integrity": "sha512-yl0ngMHtYUGJa2G0lkcbPvbnUZ9WMQyMNSfYmlrGD1nHRNyI9KOGw3dOaofFugXHHToneUaSmF9iUdgCBamCjA==",
"version": "0.4.13",
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.13.tgz",
"integrity": "sha512-9m2SY5DHI43OBQ7SMXjwp/iQaYo6iihqJ4IiD1OlrawGQTNveYYeJJt1yCqMxjp5y86m/uHxc9VooOWVlKFi4w==",
"requires": {
"mitt": "3.0.0"
}
@ -15653,7 +15653,7 @@
"version": "file:packages/puppeteer-core",
"requires": {
"@puppeteer/browsers": "1.4.2",
"chromium-bidi": "0.4.12",
"chromium-bidi": "0.4.13",
"cross-fetch": "3.1.6",
"debug": "4.3.4",
"devtools-protocol": "0.0.1135028",

View File

@ -133,7 +133,7 @@
"author": "The Chromium Authors",
"license": "Apache-2.0",
"dependencies": {
"chromium-bidi": "0.4.12",
"chromium-bidi": "0.4.13",
"cross-fetch": "3.1.6",
"debug": "4.3.4",
"devtools-protocol": "0.0.1135028",

View File

@ -1548,10 +1548,9 @@ export class Page extends EventEmitter {
* API usage, the navigation will resolve with `null`.
*/
async waitForNavigation(
options?: WaitForOptions
): Promise<HTTPResponse | null>;
async waitForNavigation(): Promise<HTTPResponse | null> {
throw new Error('Not implemented');
options: WaitForOptions = {}
): Promise<HTTPResponse | null> {
return await this.mainFrame().waitForNavigation(options);
}
/**

View File

@ -885,12 +885,6 @@ export class CDPPage extends Page {
return result[0];
}
override async waitForNavigation(
options: WaitForOptions = {}
): Promise<HTTPResponse | null> {
return await this.mainFrame().waitForNavigation(options);
}
override async waitForRequest(
urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise<boolean>),
options: {timeout?: number} = {}

View File

@ -96,7 +96,10 @@ export class BrowserContext extends BrowserContextBase {
const {result} = await this.#connection.send('browsingContext.create', {
type: 'tab',
});
const page = new Page(this, result);
const page = new Page(this, {
context: result.context,
children: [],
});
if (this.#defaultViewport) {
try {
await page.setViewport(this.#defaultViewport);
@ -113,6 +116,10 @@ export class BrowserContext extends BrowserContextBase {
override async close(): Promise<void> {
await this.#init.valueOrThrow();
if (this.#isDefault) {
throw new Error('Default context cannot be closed!');
}
for (const page of this.#pages.values()) {
await page?.close().catch(error => {
debugError(error);

View File

@ -17,7 +17,10 @@ import {Realm} from './Realm.js';
/**
* @internal
*/
const lifeCycleToSubscribedEvent = new Map<PuppeteerLifeCycleEvent, string>([
export const lifeCycleToSubscribedEvent = new Map<
PuppeteerLifeCycleEvent,
string
>([
['load', 'browsingContext.load'],
['domcontentloaded', 'browsingContext.domContentLoaded'],
]);
@ -87,7 +90,7 @@ export class CDPSessionWrapper extends EventEmitter implements CDPSession {
export class BrowsingContext extends Realm {
#timeoutSettings: TimeoutSettings;
#id: string;
#url = 'about:blank';
#url: string;
#cdpSession: CDPSession;
constructor(
@ -99,7 +102,15 @@ export class BrowsingContext extends Realm {
this.connection = connection;
this.#timeoutSettings = timeoutSettings;
this.#id = info.context;
this.#url = info.url;
this.#cdpSession = new CDPSessionWrapper(this);
this.on(
'browsingContext.fragmentNavigated',
(info: Bidi.BrowsingContext.NavigationInfo) => {
this.#url = info.url;
}
);
}
createSandboxRealm(sandbox: string): Realm {
@ -118,6 +129,10 @@ export class BrowsingContext extends Realm {
return this.#cdpSession;
}
navigated(url: string): void {
this.#url = url;
}
async goto(
url: string,
options: {

View File

@ -14,15 +14,22 @@
* limitations under the License.
*/
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
import {ElementHandle} from '../../api/ElementHandle.js';
import {Frame as BaseFrame} from '../../api/Frame.js';
import {Deferred} from '../../util/Deferred.js';
import {UTILITY_WORLD_NAME} from '../FrameManager.js';
import {PuppeteerLifeCycleEvent} from '../LifecycleWatcher.js';
import {TimeoutSettings} from '../TimeoutSettings.js';
import {EvaluateFunc, EvaluateFuncWith, HandleFor, NodeFor} from '../types.js';
import {withSourcePuppeteerURLIfNone} from '../util.js';
import {waitForEvent, withSourcePuppeteerURLIfNone} from '../util.js';
import {BrowsingContext} from './BrowsingContext.js';
import {
BrowsingContext,
getWaitUntilSingle,
lifeCycleToSubscribedEvent,
} from './BrowsingContext.js';
import {HTTPResponse} from './HTTPResponse.js';
import {Page} from './Page.js';
import {
@ -39,6 +46,8 @@ import {
export class Frame extends BaseFrame {
#page: Page;
#context: BrowsingContext;
#timeoutSettings: TimeoutSettings;
#abortDeferred = Deferred.create<Error>();
sandboxes: SandboxChart;
override _id: string;
@ -51,6 +60,7 @@ export class Frame extends BaseFrame {
super();
this.#page = page;
this.#context = context;
this.#timeoutSettings = timeoutSettings;
this._id = this.#context.id;
this._parentId = parentId ?? undefined;
@ -114,17 +124,12 @@ export class Frame extends BaseFrame {
override async goto(
url: string,
options?:
| {
referer?: string | undefined;
referrerPolicy?: string | undefined;
timeout?: number | undefined;
waitUntil?:
| PuppeteerLifeCycleEvent
| PuppeteerLifeCycleEvent[]
| undefined;
}
| undefined
options?: {
referer?: string;
referrerPolicy?: string;
timeout?: number;
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
}
): Promise<HTTPResponse | null> {
const navigationId = await this.#context.goto(url, options);
return this.#page.getNavigationResponse(navigationId);
@ -155,13 +160,13 @@ export class Frame extends BaseFrame {
override $<Selector extends string>(
selector: Selector
): Promise<ElementHandle<NodeFor<Selector>> | null> {
return this.sandboxes[MAIN_SANDBOX].$(selector);
return this.mainRealm().$(selector);
}
override $$<Selector extends string>(
selector: Selector
): Promise<Array<ElementHandle<NodeFor<Selector>>>> {
return this.sandboxes[MAIN_SANDBOX].$$(selector);
return this.mainRealm().$$(selector);
}
override $eval<
@ -177,7 +182,7 @@ export class Frame extends BaseFrame {
...args: Params
): Promise<Awaited<ReturnType<Func>>> {
pageFunction = withSourcePuppeteerURLIfNone(this.$eval.name, pageFunction);
return this.sandboxes[MAIN_SANDBOX].$eval(selector, pageFunction, ...args);
return this.mainRealm().$eval(selector, pageFunction, ...args);
}
override $$eval<
@ -193,14 +198,54 @@ export class Frame extends BaseFrame {
...args: Params
): Promise<Awaited<ReturnType<Func>>> {
pageFunction = withSourcePuppeteerURLIfNone(this.$$eval.name, pageFunction);
return this.sandboxes[MAIN_SANDBOX].$$eval(selector, pageFunction, ...args);
return this.mainRealm().$$eval(selector, pageFunction, ...args);
}
override $x(expression: string): Promise<Array<ElementHandle<Node>>> {
return this.sandboxes[MAIN_SANDBOX].$x(expression);
return this.mainRealm().$x(expression);
}
override async waitForNavigation(
options: {
timeout?: number;
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
} = {}
): Promise<HTTPResponse | null> {
const {
waitUntil = 'load',
timeout = this.#timeoutSettings.navigationTimeout(),
} = options;
const waitUntilEvent = lifeCycleToSubscribedEvent.get(
getWaitUntilSingle(waitUntil)
) as string;
const [info] = await Promise.all([
waitForEvent<Bidi.BrowsingContext.NavigationInfo>(
this.#context,
waitUntilEvent,
() => {
return true;
},
timeout,
this.#abortDeferred.valueOrThrow()
),
waitForEvent(
this.#context,
Bidi.BrowsingContext.EventNames.FragmentNavigated,
() => {
return true;
},
timeout,
this.#abortDeferred.valueOrThrow()
),
]);
return this.#page.getNavigationResponse(info.navigation);
}
dispose(): void {
this.#abortDeferred.reject(new Error('Frame detached'));
this.#context.dispose();
}
}

View File

@ -16,6 +16,7 @@
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
import Protocol from 'devtools-protocol';
import {Frame} from '../../api/Frame.js';
import {
HTTPResponse as BaseHTTPResponse,
RemoteAddress,
@ -93,4 +94,8 @@ export class HTTPResponse extends BaseHTTPResponse {
override timing(): Protocol.Network.ResourceTiming | null {
return this.#timings as any;
}
override frame(): Frame | null {
return this.#request.frame();
}
}

View File

@ -35,7 +35,6 @@ import {Coverage} from '../Coverage.js';
import {EmulationManager} from '../EmulationManager.js';
import {TargetCloseError} from '../Errors.js';
import {Handler} from '../EventEmitter.js';
import {FrameManagerEmittedEvents} from '../FrameManager.js';
import {FrameTree} from '../FrameTree.js';
import {NetworkManagerEmittedEvents} from '../NetworkManager.js';
import {PDFOptions} from '../PDFOptions.js';
@ -77,17 +76,10 @@ export class Page extends PageBase {
#closedDeferred = Deferred.create<TargetCloseError>();
#subscribedEvents = new Map<string, Handler<any>>([
['log.entryAdded', this.#onLogEntryAdded.bind(this)],
[
'browsingContext.load',
() => {
return this.emit(PageEmittedEvents.Load);
},
],
['browsingContext.load', this.#onFrameLoaded.bind(this)],
[
'browsingContext.domContentLoaded',
() => {
return this.emit(PageEmittedEvents.DOMContentLoaded);
},
this.#onFrameDOMContentLoaded.bind(this),
],
['browsingContext.contextCreated', this.#onFrameAttached.bind(this)],
['browsingContext.contextDestroyed', this.#onFrameDetached.bind(this)],
@ -96,33 +88,23 @@ export class Page extends PageBase {
#networkManagerEvents = new Map<symbol, Handler<any>>([
[
NetworkManagerEmittedEvents.Request,
event => {
return this.emit(PageEmittedEvents.Request, event);
},
this.emit.bind(this, PageEmittedEvents.Request),
],
[
NetworkManagerEmittedEvents.RequestServedFromCache,
event => {
return this.emit(PageEmittedEvents.RequestServedFromCache, event);
},
this.emit.bind(this, PageEmittedEvents.RequestServedFromCache),
],
[
NetworkManagerEmittedEvents.RequestFailed,
event => {
return this.emit(PageEmittedEvents.RequestFailed, event);
},
this.emit.bind(this, PageEmittedEvents.RequestFailed),
],
[
NetworkManagerEmittedEvents.RequestFinished,
event => {
return this.emit(PageEmittedEvents.RequestFinished, event);
},
this.emit.bind(this, PageEmittedEvents.RequestFinished),
],
[
NetworkManagerEmittedEvents.Response,
event => {
return this.emit(PageEmittedEvents.Response, event);
},
this.emit.bind(this, PageEmittedEvents.Response),
],
]);
#tracing: Tracing;
@ -132,7 +114,12 @@ export class Page extends PageBase {
#touchscreen: Touchscreen;
#keyboard: Keyboard;
constructor(browserContext: BrowserContext, info: {context: string}) {
constructor(
browserContext: BrowserContext,
info: Omit<Bidi.BrowsingContext.Info, 'url'> & {
url?: string;
}
) {
super();
this.#browserContext = browserContext;
this.#connection = browserContext.connection;
@ -140,8 +127,8 @@ export class Page extends PageBase {
this.#networkManager = new NetworkManager(this.#connection, this);
this.#onFrameAttached({
...info,
url: 'about:blank',
children: [],
url: info.url ?? 'about:blank',
children: info.children ?? [],
});
for (const [event, subscriber] of this.#subscribedEvents) {
@ -216,6 +203,20 @@ export class Page extends PageBase {
return this.#frameTree.childFrames(frameId);
}
#onFrameLoaded(info: Bidi.BrowsingContext.NavigationInfo): void {
const frame = this.frame(info.context);
if (frame && this.mainFrame() === frame) {
this.emit(PageEmittedEvents.Load);
}
}
#onFrameDOMContentLoaded(info: Bidi.BrowsingContext.NavigationInfo): void {
const frame = this.frame(info.context);
if (frame && this.mainFrame() === frame) {
this.emit(PageEmittedEvents.DOMContentLoaded);
}
}
#onFrameAttached(info: Bidi.BrowsingContext.Info): void {
if (
!this.frame(info.context) &&
@ -235,7 +236,7 @@ export class Page extends PageBase {
info.parent
);
this.#frameTree.addFrame(frame);
this.emit(FrameManagerEmittedEvents.FrameAttached, frame);
this.emit(PageEmittedEvents.FrameAttached, frame);
}
}
@ -247,12 +248,8 @@ export class Page extends PageBase {
let frame = this.frame(frameId);
// Detach all child frames first.
if (frame) {
for (const child of frame.childFrames()) {
this.#removeFramesRecursively(child);
}
frame = await this.#frameTree.waitForFrame(frameId);
this.emit(FrameManagerEmittedEvents.FrameNavigated, frame);
this.emit(PageEmittedEvents.FrameNavigated, frame);
}
}
@ -260,6 +257,9 @@ export class Page extends PageBase {
const frame = this.frame(info.context);
if (frame) {
if (frame === this.mainFrame()) {
this.emit(PageEmittedEvents.Close);
}
this.#removeFramesRecursively(frame);
}
}
@ -270,7 +270,7 @@ export class Page extends PageBase {
}
frame.dispose();
this.#frameTree.removeFrame(frame);
this.emit(FrameManagerEmittedEvents.FrameDetached, frame);
this.emit(PageEmittedEvents.FrameDetached, frame);
}
#onLogEntryAdded(event: Bidi.Log.LogEntry): void {
@ -337,12 +337,13 @@ export class Page extends PageBase {
return;
}
this.#closedDeferred.resolve(new TargetCloseError('Page closed!'));
this.removeAllListeners();
this.#networkManager.dispose();
await this.#connection.send('browsingContext.close', {
context: this.mainFrame()._id,
});
this.emit(PageEmittedEvents.Close);
this.removeAllListeners();
}
override async evaluateHandle<

View File

@ -87,7 +87,7 @@
"testIdPattern": "[navigation.spec] navigation Frame.waitForNavigation *",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL", "TIMEOUT"]
"expectations": ["PASS"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.goBack *",
@ -95,12 +95,6 @@
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation *",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL", "TIMEOUT"]
},
{
"testIdPattern": "[network.spec] network *",
"platforms": ["darwin", "linux", "win32"],
@ -359,12 +353,6 @@
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[click.spec] Page.click should click on checkbox input and toggle",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[click.spec] Page.click should click on checkbox label and toggle",
"platforms": ["darwin", "linux", "win32"],
@ -593,12 +581,6 @@
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluate should work right after framenavigated",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL", "TIMEOUT"]
},
{
"testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluateOnNewDocument *",
"platforms": ["darwin", "linux", "win32"],
@ -629,18 +611,6 @@
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should report frame from-inside shadow DOM",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should support url fragment",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame.evaluate allows readonly array to be an argument",
"platforms": ["darwin", "linux", "win32"],
@ -837,7 +807,7 @@
"testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch should have custom URL when launching browser",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL"]
"expectations": ["SKIP"]
},
{
"testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch should take fullPage screenshots when defaultViewport is null",
@ -911,6 +881,30 @@
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[mouse.spec] Mouse should click the document",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[mouse.spec] Mouse should not throw if clicking in parallel",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[mouse.spec] Mouse should trigger hover state",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[mouse.spec] Mouse should trigger hover state with removed window.Node",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[navigation.spec] navigation \"after each\" hook for \"should work with both domcontentloaded and load\"",
"platforms": ["darwin", "linux", "win32"],
@ -959,6 +953,36 @@
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation *",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with clicking on anchor links",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["TIMEOUT"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with DOM history.back()/history.forward()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL", "TIMEOUT"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.pushState()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["TIMEOUT"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.replaceState()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["TIMEOUT"]
},
{
"testIdPattern": "[network.spec] network Network Events Page.Events.RequestFinished",
"platforms": ["darwin", "linux", "win32"],
@ -1079,12 +1103,24 @@
"parameters": ["cdp", "firefox"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[page.spec] Page Page.close should *not* run beforeunload by default",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.close should reject all promises when page is closed",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.Events.Close should work with page.close",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.Events.Console should not fail for window object",
"platforms": ["darwin", "linux", "win32"],
@ -1109,6 +1145,90 @@
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should deselect all options when passed no values for a multiple select",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should deselect all options when passed no values for a select without multiple",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should respect event bubbling",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should return [] on no matched values",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should return [] on no values",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should return an array of matched values",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should return an array of one element when multiple is not set",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should select multiple options",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should select only first option",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should select single option",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should throw if passed in non-strings",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should throw when element is not a <select>",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should work when re-defining top-level Event class",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.setGeolocation should throw when invalid longitude",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.title should return the page title",
"platforms": ["darwin", "linux", "win32"],
@ -1199,6 +1319,12 @@
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[target.spec] Target should be able to use the default page in the browser",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[TargetManager.spec] *",
"platforms": ["darwin", "linux", "win32"],
@ -1475,6 +1601,18 @@
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[click.spec] Page.click should click on checkbox input and toggle",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[click.spec] Page.click should click on checkbox input and toggle",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL", "PASS"]
},
{
"testIdPattern": "[click.spec] Page.click should click on checkbox label and toggle",
"platforms": ["darwin", "linux", "win32"],
@ -1829,18 +1967,42 @@
"parameters": ["cdp", "firefox"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluate should work right after framenavigated",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluate should work right after framenavigated",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[fixtures.spec] Fixtures should close the browser when the node process closes",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL", "TIMEOUT"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should detach child frames on navigation",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should report different frame instance when frame re-attaches",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should report frame from-inside shadow DOM",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should report frame from-inside shadow DOM",
"platforms": ["darwin", "linux", "win32"],
@ -1859,18 +2021,36 @@
"parameters": ["cdp", "firefox"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should send \"framenavigated\" when navigating on anchor URLs",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should send events when frames are manipulated dynamically",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should support framesets",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should support lazy frames",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should support url fragment",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[frame.spec] Frame specs Frame.evaluate should throw for detached frames",
"platforms": ["darwin", "linux", "win32"],
@ -2165,6 +2345,12 @@
"parameters": ["cdp", "chrome"],
"expectations": ["FAIL", "PASS"]
},
{
"testIdPattern": "[mouse.spec] Mouse should select the text with mouse",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[mouse.spec] Mouse should send mouse wheel events",
"platforms": ["darwin", "linux", "win32"],
@ -2189,12 +2375,24 @@
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL", "PASS"]
},
{
"testIdPattern": "[mouse.spec] Mouse should work with mobile viewports and cross process navigations",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[navigation.spec] navigation Frame.goto should navigate subframes",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[navigation.spec] navigation Frame.goto should navigate subframes",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[navigation.spec] navigation Frame.goto should reject when frame detaches",
"platforms": ["darwin", "linux", "win32"],
@ -2219,12 +2417,24 @@
"parameters": ["cdp", "firefox"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[navigation.spec] navigation Frame.waitForNavigation should fail when frame detaches",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["TIMEOUT"]
},
{
"testIdPattern": "[navigation.spec] navigation Frame.waitForNavigation should work",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[navigation.spec] navigation Frame.waitForNavigation should work",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["TIMEOUT"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.goBack should work with HistoryAPI",
"platforms": ["darwin", "linux", "win32"],
@ -2405,12 +2615,30 @@
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["TIMEOUT"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work when subframe issues window.stop()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work when subframe issues window.stop()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with both domcontentloaded and load",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["TIMEOUT"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with DOM history.back()/history.forward()",
"platforms": ["darwin", "linux", "win32"],
@ -2801,6 +3029,12 @@
"parameters": ["cdp", "firefox"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[page.spec] Page Page.close should not be visible in browser.pages",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.close should run beforeunload if asked for",
"platforms": ["darwin", "linux", "win32"],
@ -2993,6 +3227,12 @@
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[page.spec] Page Page.select should not throw when select causes navigation",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.select should work when re-defining top-level Event class",
"platforms": ["darwin", "linux", "win32"],
@ -3047,6 +3287,12 @@
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[page.spec] Page Page.setJavaScriptEnabled should work",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.setOfflineMode should emulate navigator.onLine",
"platforms": ["darwin", "linux", "win32"],
@ -3107,6 +3353,18 @@
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[proxy.spec] request proxy should proxy requests when configured",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[proxy.spec] request proxy should respect proxy bypass list",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[queryhandler.spec] Query handler tests P selectors should work ARIA selectors",
"platforms": ["darwin", "linux", "win32"],

View File

@ -610,9 +610,9 @@ describe('navigation', function () {
return (error = _error);
});
const bothFiredPromise = page
const loadFiredPromise = page
.waitForNavigation({
waitUntil: ['load', 'domcontentloaded'],
waitUntil: 'load',
})
.then(() => {
return (bothFired = true);
@ -625,7 +625,7 @@ describe('navigation', function () {
await domContentLoadedPromise;
expect(bothFired).toBe(false);
response.end();
await bothFiredPromise;
await loadFiredPromise;
await navigationPromise;
expect(error).toBeUndefined();
});
@ -734,7 +734,6 @@ describe('navigation', function () {
navigationPromise.catch(() => {});
throw error;
}
await Promise.all([
frame!.evaluate(() => {
return window.stop();
@ -884,7 +883,10 @@ describe('navigation', function () {
return frame.remove();
});
await navigationPromise;
expect(error.message).toBe('Navigating frame was detached');
expect(error.message).atLeastOneToContain([
'Navigating frame was detached',
'Frame detached',
]);
});
});