chore: add Page.reload for BiDi (#10274)
This commit is contained in:
parent
3fdad21744
commit
6f8ea5764d
16
package-lock.json
generated
16
package-lock.json
generated
@ -2733,9 +2733,9 @@
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/chromium-bidi": {
|
||||
"version": "0.4.10",
|
||||
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.10.tgz",
|
||||
"integrity": "sha512-ngdRIq/f5G3nIOz1M0MtCABCTezr79MBCrJ09K2xRk+hTZQGTH8JIeFbgQmVvNPBMQblh7ROfJnSzsE07YpFfg==",
|
||||
"version": "0.4.11",
|
||||
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.11.tgz",
|
||||
"integrity": "sha512-p03ajLhlQ5gebw3cmbDBFmBc2wnJM5dnXS8Phu6mblGn/KQd76yOVL5VwE0VAisa7oazNfKGTaXlIZ8Q5Bb9OA==",
|
||||
"dependencies": {
|
||||
"mitt": "3.0.0"
|
||||
},
|
||||
@ -9845,7 +9845,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@puppeteer/browsers": "1.4.0",
|
||||
"chromium-bidi": "0.4.10",
|
||||
"chromium-bidi": "0.4.11",
|
||||
"cross-fetch": "3.1.6",
|
||||
"debug": "4.3.4",
|
||||
"devtools-protocol": "0.0.1120988",
|
||||
@ -11860,9 +11860,9 @@
|
||||
"version": "1.1.4"
|
||||
},
|
||||
"chromium-bidi": {
|
||||
"version": "0.4.10",
|
||||
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.10.tgz",
|
||||
"integrity": "sha512-ngdRIq/f5G3nIOz1M0MtCABCTezr79MBCrJ09K2xRk+hTZQGTH8JIeFbgQmVvNPBMQblh7ROfJnSzsE07YpFfg==",
|
||||
"version": "0.4.11",
|
||||
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.11.tgz",
|
||||
"integrity": "sha512-p03ajLhlQ5gebw3cmbDBFmBc2wnJM5dnXS8Phu6mblGn/KQd76yOVL5VwE0VAisa7oazNfKGTaXlIZ8Q5Bb9OA==",
|
||||
"requires": {
|
||||
"mitt": "3.0.0"
|
||||
}
|
||||
@ -15174,7 +15174,7 @@
|
||||
"version": "file:packages/puppeteer-core",
|
||||
"requires": {
|
||||
"@puppeteer/browsers": "1.4.0",
|
||||
"chromium-bidi": "0.4.10",
|
||||
"chromium-bidi": "0.4.11",
|
||||
"cross-fetch": "3.1.6",
|
||||
"debug": "4.3.4",
|
||||
"devtools-protocol": "0.0.1120988",
|
||||
|
@ -30,6 +30,7 @@
|
||||
"test:chrome:new-headless": "wireit",
|
||||
"test:chrome:headless": "wireit",
|
||||
"test:chrome:bidi": "wireit",
|
||||
"test:chrome:bidi-local": "wireit",
|
||||
"test:chrome": "wireit",
|
||||
"test:firefox:bidi": "wireit",
|
||||
"test:firefox:headful": "wireit",
|
||||
@ -81,6 +82,12 @@
|
||||
"./test:build"
|
||||
]
|
||||
},
|
||||
"test:chrome:bidi-local": {
|
||||
"command": "PUPPETEER_EXECUTABLE_PATH=$(node tools/download_chrome_bidi.mjs ~/.cache/puppeteer/chrome-canary --shell) npm test -- --test-suite chrome-bidi",
|
||||
"dependencies": [
|
||||
"./test:build"
|
||||
]
|
||||
},
|
||||
"test:firefox:headful": {
|
||||
"command": "npm test -- --test-suite firefox-headful",
|
||||
"dependencies": [
|
||||
|
@ -132,7 +132,7 @@
|
||||
"author": "The Chromium Authors",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"chromium-bidi": "0.4.10",
|
||||
"chromium-bidi": "0.4.11",
|
||||
"cross-fetch": "3.1.6",
|
||||
"debug": "4.3.4",
|
||||
"devtools-protocol": "0.0.1120988",
|
||||
|
@ -1,6 +1,7 @@
|
||||
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
||||
import ProtocolMapping from 'devtools-protocol/types/protocol-mapping.js';
|
||||
|
||||
import {WaitForOptions} from '../../api/Page.js';
|
||||
import {assert} from '../../util/assert.js';
|
||||
import {stringifyFunction} from '../../util/Function.js';
|
||||
import {ProtocolError, TimeoutError} from '../Errors.js';
|
||||
@ -116,6 +117,26 @@ export class BrowsingContext extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
async reload(options: WaitForOptions = {}): Promise<void> {
|
||||
const {
|
||||
waitUntil = 'load',
|
||||
timeout = this.#timeoutSettings.navigationTimeout(),
|
||||
} = options;
|
||||
|
||||
const readinessState = lifeCycleToReadinessState.get(
|
||||
getWaitUntilSingle(waitUntil)
|
||||
) as Bidi.BrowsingContext.ReadinessState;
|
||||
|
||||
await waitWithTimeout(
|
||||
this.connection.send('browsingContext.reload', {
|
||||
context: this.#id,
|
||||
wait: readinessState,
|
||||
}),
|
||||
'Navigation',
|
||||
timeout
|
||||
);
|
||||
}
|
||||
|
||||
async evaluateHandle<
|
||||
Params extends unknown[],
|
||||
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
|
||||
|
@ -59,6 +59,10 @@ interface Commands {
|
||||
params: Bidi.BrowsingContext.NavigateParameters;
|
||||
returnType: Bidi.BrowsingContext.NavigateResult;
|
||||
};
|
||||
'browsingContext.reload': {
|
||||
params: Bidi.BrowsingContext.ReloadParameters;
|
||||
returnType: Bidi.Message.EmptyResult;
|
||||
};
|
||||
'browsingContext.print': {
|
||||
params: Bidi.BrowsingContext.PrintParameters;
|
||||
returnType: Bidi.BrowsingContext.PrintResult;
|
||||
|
@ -313,6 +313,22 @@ export class Page extends PageBase {
|
||||
return this.mainFrame().goto(url, options);
|
||||
}
|
||||
|
||||
override async reload(
|
||||
options?: WaitForOptions
|
||||
): Promise<HTTPResponse | null> {
|
||||
const [response] = await Promise.all([
|
||||
this.waitForResponse(response => {
|
||||
return (
|
||||
response.request().isNavigationRequest() &&
|
||||
response.url() === this.url()
|
||||
);
|
||||
}),
|
||||
this.mainFrame().context().reload(options),
|
||||
]);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
override url(): string {
|
||||
return this.mainFrame().url();
|
||||
}
|
||||
|
@ -461,12 +461,6 @@
|
||||
"parameters": ["webDriverBiDi"],
|
||||
"expectations": ["FAIL"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[navigation.spec] navigation Page.reload should work",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["webDriverBiDi"],
|
||||
"expectations": ["FAIL", "TIMEOUT"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[network.spec] network Network Events Page.Events.RequestFinished",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
@ -530,7 +524,7 @@
|
||||
{
|
||||
"testIdPattern": "[network.spec] network Response.fromCache should work",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["webDriverBiDi"],
|
||||
"parameters": ["firefox", "webDriverBiDi"],
|
||||
"expectations": ["FAIL"]
|
||||
},
|
||||
{
|
||||
@ -1379,6 +1373,12 @@
|
||||
"parameters": ["firefox", "webDriverBiDi"],
|
||||
"expectations": ["FAIL"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[navigation.spec] navigation Page.goto should return last response in redirect chain",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["chrome", "webDriverBiDi"],
|
||||
"expectations": ["FAIL"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[navigation.spec] navigation Page.goto should return response when page changes its URL after load",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
@ -1457,6 +1457,12 @@
|
||||
"parameters": ["cdp", "firefox"],
|
||||
"expectations": ["SKIP"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[navigation.spec] navigation Page.reload should work",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["firefox", "webDriverBiDi"],
|
||||
"expectations": ["FAIL"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work when subframe issues window.stop()",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
|
@ -51,7 +51,9 @@ try {
|
||||
browser,
|
||||
buildId,
|
||||
});
|
||||
actions.setOutput('executablePath', executablePath);
|
||||
if (process.argv.indexOf('--shell') === -1) {
|
||||
actions.setOutput('executablePath', executablePath);
|
||||
}
|
||||
console.log(executablePath);
|
||||
} catch (err) {
|
||||
actions.setFailed(`Failed to download the browser: ${err.message}`);
|
||||
|
Loading…
Reference in New Issue
Block a user