mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test(webdriver): fix some tests (#12164)
This commit is contained in:
parent
950cbf73f8
commit
c9ad6b48c4
@ -5,6 +5,7 @@
|
||||
*/
|
||||
import type ProtocolMapping from 'devtools-protocol/types/protocol-mapping.js';
|
||||
|
||||
import type {CommandOptions} from '../api/CDPSession.js';
|
||||
import {CDPSession} from '../api/CDPSession.js';
|
||||
import type {Connection as CdpConnection} from '../cdp/Connection.js';
|
||||
import {TargetCloseError, UnsupportedOperation} from '../common/Errors.js';
|
||||
@ -61,7 +62,8 @@ export class BidiCdpSession extends CDPSession {
|
||||
|
||||
override async send<T extends keyof ProtocolMapping.Commands>(
|
||||
method: T,
|
||||
params?: ProtocolMapping.Commands[T]['paramsType'][0]
|
||||
params?: ProtocolMapping.Commands[T]['paramsType'][0],
|
||||
options?: CommandOptions
|
||||
): Promise<ProtocolMapping.Commands[T]['returnType']> {
|
||||
if (this.#connection === undefined) {
|
||||
throw new UnsupportedOperation(
|
||||
@ -74,11 +76,15 @@ export class BidiCdpSession extends CDPSession {
|
||||
);
|
||||
}
|
||||
const session = await this.#sessionId.valueOrThrow();
|
||||
const {result} = await this.#connection.send('cdp.sendCommand', {
|
||||
method: method,
|
||||
params: params,
|
||||
session,
|
||||
});
|
||||
const {result} = await this.#connection.send(
|
||||
'cdp.sendCommand',
|
||||
{
|
||||
method: method,
|
||||
params: params,
|
||||
session,
|
||||
},
|
||||
options?.timeout
|
||||
);
|
||||
return result.result;
|
||||
}
|
||||
|
||||
|
@ -97,11 +97,12 @@ export class BidiConnection
|
||||
|
||||
send<T extends keyof Commands>(
|
||||
method: T,
|
||||
params: Commands[T]['params']
|
||||
params: Commands[T]['params'],
|
||||
timeout?: number
|
||||
): Promise<{result: Commands[T]['returnType']}> {
|
||||
assert(!this.#closed, 'Protocol error: Connection closed.');
|
||||
|
||||
return this.#callbacks.create(method, this.#timeout, id => {
|
||||
return this.#callbacks.create(method, timeout ?? this.#timeout, id => {
|
||||
const stringifiedMessage = JSON.stringify({
|
||||
id,
|
||||
method,
|
||||
|
@ -18,7 +18,7 @@
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["webDriverBiDi"],
|
||||
"expectations": ["SKIP"],
|
||||
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
|
||||
"comment": "Chrome-only feature blocked on https://github.com/GoogleChromeLabs/chromium-bidi/issues/2082"
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[device-request-prompt.spec] *",
|
||||
@ -1109,13 +1109,6 @@
|
||||
"expectations": ["FAIL"],
|
||||
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[CDPSession.spec] Target.createCDPSession should respect custom timeout",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["chrome", "webDriverBiDi"],
|
||||
"expectations": ["SKIP"],
|
||||
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[CDPSession.spec] Target.createCDPSession should respect custom timeout",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
|
@ -134,7 +134,7 @@ describe('Target.createCDPSession', function () {
|
||||
}
|
||||
)
|
||||
).rejects.toThrowError(
|
||||
`Runtime.evaluate timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.`
|
||||
/Increase the 'protocolTimeout' setting in launch\/connect calls for a higher timeout if needed./gi
|
||||
);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user