chore: reduce default timeout to 10s (#9906)

This commit is contained in:
Alex Rudenko 2023-03-24 09:35:45 +01:00 committed by GitHub
parent 48e7bdd75e
commit de86cafe3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 12 deletions

View File

@ -20,8 +20,8 @@ module.exports = {
require: ['./test/build/mocha-utils.js', 'source-map-support/register'], require: ['./test/build/mocha-utils.js', 'source-map-support/register'],
spec: 'test/build/**/*.spec.js', spec: 'test/build/**/*.spec.js',
exit: !!process.env.CI, exit: !!process.env.CI,
retries: 0, retries: process.env.CI ? 3 : 0,
parallel: !!process.env.PARALLEL, parallel: !!process.env.PARALLEL,
timeout: 25_000, timeout: 10_000,
reporter: process.env.CI ? 'spec' : 'dot', reporter: process.env.CI ? 'spec' : 'dot',
}; };

View File

@ -22,6 +22,7 @@ import {
PageEmittedEvents, PageEmittedEvents,
WaitForOptions, WaitForOptions,
} from '../../api/Page.js'; } from '../../api/Page.js';
import {isErrorLike} from '../../util/ErrorLike.js';
import {ConsoleMessage, ConsoleMessageLocation} from '../ConsoleMessage.js'; import {ConsoleMessage, ConsoleMessageLocation} from '../ConsoleMessage.js';
import {Handler} from '../EventEmitter.js'; import {Handler} from '../EventEmitter.js';
import {EvaluateFunc, HandleFor} from '../types.js'; import {EvaluateFunc, HandleFor} from '../types.js';
@ -45,12 +46,18 @@ export class Page extends PageBase {
super(); super();
this.#context = context; this.#context = context;
this.#context.connection.send('session.subscribe', { this.#context.connection
events: [ .send('session.subscribe', {
...this.#subscribedEvents.keys(), events: [
] as Bidi.Session.SubscribeParameters['events'], ...this.#subscribedEvents.keys(),
contexts: [this.#context.id], ] as Bidi.Session.SubscribeParameters['events'],
}); contexts: [this.#context.id],
})
.catch(error => {
if (isErrorLike(error) && !error.message.includes('Target closed')) {
throw error;
}
});
for (const [event, subscriber] of this.#subscribedEvents) { for (const [event, subscriber] of this.#subscribedEvents) {
this.#context.on(event, subscriber); this.#context.on(event, subscriber);

View File

@ -107,6 +107,12 @@
"parameters": ["cdp", "firefox"], "parameters": ["cdp", "firefox"],
"expectations": ["SKIP"] "expectations": ["SKIP"]
}, },
{
"testIdPattern": "[emulation.spec] Emulation Page.viewport should detect touch when applying viewport with touches",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox"],
"expectations": ["FAIL", "PASS", "TIMEOUT"]
},
{ {
"testIdPattern": "[evaluation.spec] Evaluation specs Frame.evaluate should execute after cross-site navigation", "testIdPattern": "[evaluation.spec] Evaluation specs Frame.evaluate should execute after cross-site navigation",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
@ -801,7 +807,7 @@
"testIdPattern": "[jshandle.spec] JSHandle JSHandle.asElement should return ElementHandle for TextNodes", "testIdPattern": "[jshandle.spec] JSHandle JSHandle.asElement should return ElementHandle for TextNodes",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"], "parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL", "TIMEOUT"] "expectations": ["FAIL", "PASS", "TIMEOUT"]
}, },
{ {
"testIdPattern": "[jshandle.spec] JSHandle JSHandle.jsonValue should not work with dates", "testIdPattern": "[jshandle.spec] JSHandle JSHandle.jsonValue should not work with dates",

View File

@ -197,7 +197,9 @@ describe('AriaQueryHandler', () => {
}); });
}); });
describe('queryAllArray', () => { describe('queryAllArray', () => {
it('$$eval should handle many elements', async () => { it('$$eval should handle many elements', async function () {
this.timeout(25_000);
const {page} = getTestState(); const {page} = getTestState();
await page.setContent(''); await page.setContent('');
await page.evaluate( await page.evaluate(

View File

@ -474,6 +474,7 @@ describe('Evaluation specs', function () {
expect(result).toEqual([42]); expect(result).toEqual([42]);
}); });
it('should transfer 100Mb of data from page to node.js', async function () { it('should transfer 100Mb of data from page to node.js', async function () {
this.timeout(25_000);
const {page} = getTestState(); const {page} = getTestState();
const a = await page.evaluate(() => { const a = await page.evaluate(() => {

View File

@ -129,7 +129,9 @@ describe('querySelector', function () {
); );
expect(sum).toBe(8); expect(sum).toBe(8);
}); });
it('should handle many elements', async () => { it('should handle many elements', async function () {
this.timeout(25_000);
const {page} = getTestState(); const {page} = getTestState();
await page.evaluate( await page.evaluate(
` `
@ -479,7 +481,9 @@ describe('querySelector', function () {
); );
expect(sum).toBe(8); expect(sum).toBe(8);
}); });
it('$$eval should handle many elements', async () => { it('$$eval should handle many elements', async function () {
this.timeout(25_000);
const {page} = getTestState(); const {page} = getTestState();
await page.evaluate( await page.evaluate(
` `