chore(firefox): run Puppeteer-Firefox against Puppeteer tests (#3888)
Introduce a `npm run funit` script that runs puppeteer tests against Puppeteer-Firefox. Next steps: - bring Puppeteer-Firefox unique tests to Puppeteer - skip failing tests and run Puppeteer-Firefox on CI - work through tests to pass them all with Puppeteer-Firefox
This commit is contained in:
parent
fd67fa7a36
commit
84fe6014e9
@ -12,6 +12,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"unit": "node test/test.js",
|
||||
"funit": "BROWSER=firefox node test/test.js",
|
||||
"debug-unit": "node --inspect-brk test/test.js",
|
||||
"test-doclint": "node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js",
|
||||
"test": "npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types",
|
||||
|
@ -27,6 +27,8 @@ module.exports.addTests = ({testRunner, product, puppeteer, defaultBrowserOption
|
||||
const {it, fit, xit} = testRunner;
|
||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||
|
||||
const CHROME = product === 'Chromium';
|
||||
|
||||
if (defaultBrowserOptions.executablePath) {
|
||||
console.warn(`${YELLOW_COLOR}WARN: running ${product} tests with ${defaultBrowserOptions.executablePath}${RESET_COLOR}`);
|
||||
} else {
|
||||
@ -94,30 +96,32 @@ module.exports.addTests = ({testRunner, product, puppeteer, defaultBrowserOption
|
||||
|
||||
// Page-level tests that are given a browser, a context and a page.
|
||||
// Each test is launched in a new browser context.
|
||||
require('./CDPSession.spec.js').addTests(testOptions);
|
||||
require('./accessibility.spec.js').addTests(testOptions);
|
||||
require('./browser.spec.js').addTests(testOptions);
|
||||
require('./cookies.spec.js').addTests(testOptions);
|
||||
require('./coverage.spec.js').addTests(testOptions);
|
||||
require('./click.spec.js').addTests(testOptions);
|
||||
require('./dialog.spec.js').addTests(testOptions);
|
||||
require('./elementhandle.spec.js').addTests(testOptions);
|
||||
require('./queryselector.spec.js').addTests(testOptions);
|
||||
require('./waittask.spec.js').addTests(testOptions);
|
||||
require('./emulation.spec.js').addTests(testOptions);
|
||||
require('./evaluation.spec.js').addTests(testOptions);
|
||||
require('./frame.spec.js').addTests(testOptions);
|
||||
require('./input.spec.js').addTests(testOptions);
|
||||
require('./mouse.spec.js').addTests(testOptions);
|
||||
require('./keyboard.spec.js').addTests(testOptions);
|
||||
require('./touchscreen.spec.js').addTests(testOptions);
|
||||
require('./click.spec.js').addTests(testOptions);
|
||||
require('./jshandle.spec.js').addTests(testOptions);
|
||||
require('./network.spec.js').addTests(testOptions);
|
||||
require('./page.spec.js').addTests(testOptions);
|
||||
require('./dialog.spec.js').addTests(testOptions);
|
||||
require('./keyboard.spec.js').addTests(testOptions);
|
||||
require('./mouse.spec.js').addTests(testOptions);
|
||||
require('./navigation.spec.js').addTests(testOptions);
|
||||
require('./evaluation.spec.js').addTests(testOptions);
|
||||
require('./emulation.spec.js').addTests(testOptions);
|
||||
require('./page.spec.js').addTests(testOptions);
|
||||
require('./screenshot.spec.js').addTests(testOptions);
|
||||
require('./queryselector.spec.js').addTests(testOptions);
|
||||
require('./target.spec.js').addTests(testOptions);
|
||||
require('./worker.spec.js').addTests(testOptions);
|
||||
require('./touchscreen.spec.js').addTests(testOptions);
|
||||
require('./waittask.spec.js').addTests(testOptions);
|
||||
if (CHROME) {
|
||||
require('./CDPSession.spec.js').addTests(testOptions);
|
||||
require('./accessibility.spec.js').addTests(testOptions);
|
||||
require('./cookies.spec.js').addTests(testOptions);
|
||||
require('./coverage.spec.js').addTests(testOptions);
|
||||
require('./network.spec.js').addTests(testOptions);
|
||||
require('./worker.spec.js').addTests(testOptions);
|
||||
}
|
||||
});
|
||||
|
||||
// Browser-level tests that are given a browser.
|
||||
@ -127,6 +131,8 @@ module.exports.addTests = ({testRunner, product, puppeteer, defaultBrowserOption
|
||||
// Top-level tests that launch Browser themselves.
|
||||
require('./ignorehttpserrors.spec.js').addTests(testOptions);
|
||||
require('./launcher.spec.js').addTests(testOptions);
|
||||
require('./headful.spec.js').addTests(testOptions);
|
||||
require('./tracing.spec.js').addTests(testOptions);
|
||||
if (CHROME) {
|
||||
require('./headful.spec.js').addTests(testOptions);
|
||||
require('./tracing.spec.js').addTests(testOptions);
|
||||
}
|
||||
};
|
||||
|
31
test/test.js
31
test/test.js
@ -38,7 +38,7 @@ require('events').defaultMaxListeners *= parallel;
|
||||
|
||||
const timeout = slowMo ? 0 : 10 * 1000;
|
||||
const testRunner = new TestRunner({timeout, parallel});
|
||||
const {describe, it, xit, beforeAll, afterAll, beforeEach, afterEach} = testRunner;
|
||||
const {describe, fdescribe, beforeAll, afterAll, beforeEach, afterEach} = testRunner;
|
||||
|
||||
console.log('Testing on Node', process.version);
|
||||
|
||||
@ -84,16 +84,27 @@ const CHROMIUM_NO_COVERAGE = new Set([
|
||||
...(headless ? [] : ['page.pdf']),
|
||||
]);
|
||||
|
||||
describe('Chromium', () => {
|
||||
require('./puppeteer.spec.js').addTests({
|
||||
product: 'Chromium',
|
||||
puppeteer: utils.requireRoot('index'),
|
||||
defaultBrowserOptions,
|
||||
testRunner,
|
||||
if (process.env.BROWSER !== 'firefox') {
|
||||
describe('Chromium', () => {
|
||||
require('./puppeteer.spec.js').addTests({
|
||||
product: 'Chromium',
|
||||
puppeteer: utils.requireRoot('index'),
|
||||
defaultBrowserOptions,
|
||||
testRunner,
|
||||
});
|
||||
if (process.env.COVERAGE)
|
||||
utils.recordAPICoverage(testRunner, require('../lib/api'), CHROMIUM_NO_COVERAGE);
|
||||
});
|
||||
if (process.env.COVERAGE)
|
||||
utils.recordAPICoverage(testRunner, require('../lib/api'), CHROMIUM_NO_COVERAGE);
|
||||
});
|
||||
} else {
|
||||
describe('Firefox', () => {
|
||||
require('./puppeteer.spec.js').addTests({
|
||||
product: 'Firefox',
|
||||
puppeteer: require('../experimental/puppeteer-firefox'),
|
||||
defaultBrowserOptions,
|
||||
testRunner,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (process.env.CI && testRunner.hasFocusedTestsOrSuites()) {
|
||||
console.error('ERROR: "focused" tests/suites are prohibitted on bots. Remove any "fit"/"fdescribe" declarations.');
|
||||
|
Loading…
Reference in New Issue
Block a user