mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore(firefox): mark all Puppeteer tests that are failing on FF (#3924)
This patch: - introduces new testRunner methods `addTestDSL` and `addSuiteDSL` to add annotated test / suite. - introduces new test/suite declaration methods: `it_fails_ffox` and `describe_fails_ffox`. These are equal to `it`/`describe` for chromium tests and to `xit`/`xdescribe` for firefox. - marks all unsupported tests with `it_fails_ffox` - adds a new command-line flag `'--firefox-status'` to `//test/test.js`. This flag dumps current amount of tests that are intentionally skipped for Firefox. End goal: get rid of all `it_fails_ffox` and `describe_fails_ffox` tests. Drive-By: remove cookie tests "afterEach" hook that was removing cookies - it's not needed any more since every test is run in a designated browser context. References #3889
This commit is contained in:
23
test/test.js
23
test/test.js
@@ -79,6 +79,8 @@ const CHROMIUM_NO_COVERAGE = new Set([
|
||||
]);
|
||||
|
||||
if (process.env.BROWSER !== 'firefox') {
|
||||
testRunner.addTestDSL('it_fails_ffox', 'run');
|
||||
testRunner.addSuiteDSL('describe_fails_ffox', 'run');
|
||||
describe('Chromium', () => {
|
||||
require('./puppeteer.spec.js').addTests({
|
||||
product: 'Chromium',
|
||||
@@ -91,6 +93,9 @@ if (process.env.BROWSER !== 'firefox') {
|
||||
utils.recordAPICoverage(testRunner, require('../lib/api'), CHROMIUM_NO_COVERAGE);
|
||||
});
|
||||
} else {
|
||||
const FFOX_SKIPPED_TESTS = Symbol('FFOX_SKIPPED_TESTS');
|
||||
testRunner.addTestDSL('it_fails_ffox', 'skip', FFOX_SKIPPED_TESTS);
|
||||
testRunner.addSuiteDSL('describe_fails_ffox', 'skip', FFOX_SKIPPED_TESTS);
|
||||
describe('Firefox', () => {
|
||||
require('./puppeteer.spec.js').addTests({
|
||||
product: 'Firefox',
|
||||
@@ -100,6 +105,24 @@ if (process.env.BROWSER !== 'firefox') {
|
||||
testRunner,
|
||||
});
|
||||
});
|
||||
|
||||
if (process.argv.indexOf('--firefox-status') !== -1) {
|
||||
const allTests = testRunner.tests();
|
||||
const ffoxTests = allTests.filter(test => {
|
||||
if (test.comment === FFOX_SKIPPED_TESTS)
|
||||
return false;
|
||||
for (let suite = test.suite; suite; suite = suite.parentSuite) {
|
||||
if (suite.comment === FFOX_SKIPPED_TESTS)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
console.log(JSON.stringify({
|
||||
allTests: allTests.length,
|
||||
firefoxTests: ffoxTests.length
|
||||
}));
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.CI && testRunner.hasFocusedTestsOrSuites()) {
|
||||
|
||||
Reference in New Issue
Block a user