chore: increase test timeout to 20 seconds on Appveyour (#3918)
Looks like Appveyour is indeed slow; try giving it more time to run tests. Drive-by: support TIMEOUT env variable for Puppeteer tests.
This commit is contained in:
parent
28087c291f
commit
00bcecbf72
@ -22,7 +22,7 @@ const {Matchers} = require('../utils/testrunner/');
|
|||||||
const YELLOW_COLOR = '\x1b[33m';
|
const YELLOW_COLOR = '\x1b[33m';
|
||||||
const RESET_COLOR = '\x1b[0m';
|
const RESET_COLOR = '\x1b[0m';
|
||||||
|
|
||||||
module.exports.addTests = ({testRunner, product, puppeteer, Errors, DeviceDescriptors, slowMo, headless}) => {
|
module.exports.addTests = ({testRunner, product, puppeteer, Errors, DeviceDescriptors}) => {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
@ -30,6 +30,9 @@ module.exports.addTests = ({testRunner, product, puppeteer, Errors, DeviceDescri
|
|||||||
const CHROME = product === 'Chromium';
|
const CHROME = product === 'Chromium';
|
||||||
const FFOX = product === 'Firefox';
|
const FFOX = product === 'Firefox';
|
||||||
|
|
||||||
|
const headless = (process.env.HEADLESS || 'true').trim().toLowerCase() === 'true';
|
||||||
|
const slowMo = parseInt((process.env.SLOW_MO || '0').trim(), 10);
|
||||||
|
|
||||||
const defaultBrowserOptions = {
|
const defaultBrowserOptions = {
|
||||||
handleSIGINT: false,
|
handleSIGINT: false,
|
||||||
executablePath: CHROME ? process.env.CHROME : process.env.FFOX,
|
executablePath: CHROME ? process.env.CHROME : process.env.FFOX,
|
||||||
|
13
test/test.js
13
test/test.js
@ -18,9 +18,6 @@ const {TestServer} = require('../utils/testserver/');
|
|||||||
const {TestRunner, Reporter} = require('../utils/testrunner/');
|
const {TestRunner, Reporter} = require('../utils/testrunner/');
|
||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
|
|
||||||
const headless = (process.env.HEADLESS || 'true').trim().toLowerCase() === 'true';
|
|
||||||
const slowMo = parseInt((process.env.SLOW_MO || '0').trim(), 10);
|
|
||||||
|
|
||||||
let parallel = 1;
|
let parallel = 1;
|
||||||
if (process.env.PPTR_PARALLEL_TESTS)
|
if (process.env.PPTR_PARALLEL_TESTS)
|
||||||
parallel = parseInt(process.env.PPTR_PARALLEL_TESTS.trim(), 10);
|
parallel = parseInt(process.env.PPTR_PARALLEL_TESTS.trim(), 10);
|
||||||
@ -29,7 +26,10 @@ if (parallelArgIndex !== -1)
|
|||||||
parallel = parseInt(process.argv[parallelArgIndex + 1], 10);
|
parallel = parseInt(process.argv[parallelArgIndex + 1], 10);
|
||||||
require('events').defaultMaxListeners *= parallel;
|
require('events').defaultMaxListeners *= parallel;
|
||||||
|
|
||||||
const timeout = slowMo ? 0 : 10 * 1000;
|
// Timeout to 20 seconds on Appveyor instances.
|
||||||
|
let timeout = process.env.APPVEYOR ? 20 * 1000 : 10 * 1000;
|
||||||
|
if (!isNaN(process.env.TIMEOUT))
|
||||||
|
timeout = parseInt(process.env.TIMEOUT, 10);
|
||||||
const testRunner = new TestRunner({timeout, parallel});
|
const testRunner = new TestRunner({timeout, parallel});
|
||||||
const {describe, fdescribe, beforeAll, afterAll, beforeEach, afterEach} = testRunner;
|
const {describe, fdescribe, beforeAll, afterAll, beforeEach, afterEach} = testRunner;
|
||||||
|
|
||||||
@ -76,7 +76,6 @@ const CHROMIUM_NO_COVERAGE = new Set([
|
|||||||
'securityDetails.issuer',
|
'securityDetails.issuer',
|
||||||
'securityDetails.validFrom',
|
'securityDetails.validFrom',
|
||||||
'securityDetails.validTo',
|
'securityDetails.validTo',
|
||||||
...(headless ? [] : ['page.pdf']),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (process.env.BROWSER !== 'firefox') {
|
if (process.env.BROWSER !== 'firefox') {
|
||||||
@ -87,8 +86,6 @@ if (process.env.BROWSER !== 'firefox') {
|
|||||||
Errors: utils.requireRoot('Errors'),
|
Errors: utils.requireRoot('Errors'),
|
||||||
DeviceDescriptors: utils.requireRoot('DeviceDescriptors'),
|
DeviceDescriptors: utils.requireRoot('DeviceDescriptors'),
|
||||||
testRunner,
|
testRunner,
|
||||||
slowMo,
|
|
||||||
headless,
|
|
||||||
});
|
});
|
||||||
if (process.env.COVERAGE)
|
if (process.env.COVERAGE)
|
||||||
utils.recordAPICoverage(testRunner, require('../lib/api'), CHROMIUM_NO_COVERAGE);
|
utils.recordAPICoverage(testRunner, require('../lib/api'), CHROMIUM_NO_COVERAGE);
|
||||||
@ -101,8 +98,6 @@ if (process.env.BROWSER !== 'firefox') {
|
|||||||
Errors: require('../experimental/puppeteer-firefox/Errors'),
|
Errors: require('../experimental/puppeteer-firefox/Errors'),
|
||||||
DeviceDescriptors: utils.requireRoot('DeviceDescriptors'),
|
DeviceDescriptors: utils.requireRoot('DeviceDescriptors'),
|
||||||
testRunner,
|
testRunner,
|
||||||
slowMo,
|
|
||||||
headless,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user