Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(firefox): run Puppeteer-Firefox against Puppeteer tests #3888

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -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",
Expand Down
42 changes: 24 additions & 18 deletions test/puppeteer.spec.js
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand All @@ -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 changes: 21 additions & 10 deletions test/test.js
Expand Up @@ -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);

Expand Down Expand Up @@ -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.');
Expand Down