Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(testrunner): show maximum 10 skipped tests in test report
Andrey Lushnikov44b39bad335f
diff --git a/test/test.js b/test/test.jsindex 1f3aa5a37a..603705d241 100644--- a/test/test.js+++ b/test/test.js@@ -73,49 +73,49 @@ beforeEach(async({server, httpsServer}) => {httpsServer.reset();});-(async() => {- if (process.env.BROWSER === 'firefox') {- await describe('Firefox', () => {- require('./playwright.spec.js').addTests({- product: 'Firefox',- playwrightPath: path.join(utils.projectRoot(), 'firefox.js'),- testRunner,- });+if (process.env.BROWSER === 'firefox') {+ describe('Firefox', () => {+ require('./playwright.spec.js').addTests({+ product: 'Firefox',+ playwrightPath: path.join(utils.projectRoot(), 'firefox.js'),+ testRunner,});- } else if (process.env.BROWSER === 'webkit') {- await describe('WebKit', () => {- require('./playwright.spec.js').addTests({- product: 'WebKit',- playwrightPath: path.join(utils.projectRoot(), 'webkit.js'),- testRunner,- });+ });+} else if (process.env.BROWSER === 'webkit') {+ describe('WebKit', () => {+ require('./playwright.spec.js').addTests({+ product: 'WebKit',+ playwrightPath: path.join(utils.projectRoot(), 'webkit.js'),+ testRunner,});- } else {- await describe('Chromium', () => {- require('./playwright.spec.js').addTests({- product: 'Chromium',- playwrightPath: path.join(utils.projectRoot(), 'chromium.js'),- testRunner,- });- if (process.env.COVERAGE)- utils.recordAPICoverage(testRunner, require('../lib/api').Chromium, require('../lib/chromium/events').Events);+ });+} else {+ describe('Chromium', () => {+ require('./playwright.spec.js').addTests({+ product: 'Chromium',+ playwrightPath: path.join(utils.projectRoot(), 'chromium.js'),+ testRunner,});- }+ if (process.env.COVERAGE)+ utils.recordAPICoverage(testRunner, require('../lib/api').Chromium, require('../lib/chromium/events').Events);+ });+}- if (process.env.CI && testRunner.hasFocusedTestsOrSuites()) {- console.error('ERROR: "focused" tests/suites are prohibitted on bots. Remove any "fit"/"fdescribe" declarations.');- process.exit(1);- }+if (process.env.CI && testRunner.hasFocusedTestsOrSuites()) {+ console.error('ERROR: "focused" tests/suites are prohibitted on bots. Remove any "fit"/"fdescribe" declarations.');+ process.exit(1);+}- new Reporter(testRunner, {- verbose: process.argv.includes('--verbose'),- summary: !process.argv.includes('--verbose'),- projectFolder: utils.projectRoot(),- showSlowTests: process.env.CI ? 5 : 0,- });+new Reporter(testRunner, {+ verbose: process.argv.includes('--verbose'),+ summary: !process.argv.includes('--verbose'),+ projectFolder: utils.projectRoot(),+ showSlowTests: process.env.CI ? 5 : 0,+ showSkippedTests: 10,+});- // await utils.initializeFlakinessDashboardIfNeeded(testRunner);- const result = await testRunner.run();+// await utils.initializeFlakinessDashboardIfNeeded(testRunner);+testRunner.run().then(result => {process.exit(result.terminationError ? 130 : 0);-})();+});diff --git a/utils/testrunner/Reporter.js b/utils/testrunner/Reporter.jsindex 4bc59beb10..400029c047 100644--- a/utils/testrunner/Reporter.js+++ b/utils/testrunner/Reporter.js@@ -25,12 +25,14 @@ class Reporter {const {projectFolder = null,showSlowTests = 3,+ showSkippedTests = Infinity,verbose = false,summary = true,} = options;this._runner = runner;this._projectFolder = projectFolder;this._showSlowTests = showSlowTests;+ this._showSkippedTests = showSkippedTests;this._verbose = verbose;this._summary = summary;this._testCounter = 0;@@ -125,12 +127,16 @@ class Reporter {}const skippedTests = this._runner.skippedTests();- if (this._summary && skippedTests.length > 0) {- console.log('\nSkipped:');- for (let i = 0; i < skippedTests.length; ++i) {- const test = skippedTests[i];- console.log(`${i + 1}) ${test.fullName} (${formatTestLocation(test)})`);- console.log(` ${YELLOW_COLOR}Temporary disabled with xit${RESET_COLOR}`);+ if (this._showSkippedTests && this._summary && skippedTests.length) {+ if (skippedTests.length > 0) {+ console.log('\nSkipped:');+ skippedTests.slice(0, this._showSkippedTests).forEach((test, index) => {+ console.log(`${index + 1}) ${test.fullName} (${formatTestLocation(test)})`);+ });+ }+ if (this._showSkippedTests < skippedTests.length) {+ console.log('');+ console.log(`... and ${YELLOW_COLOR}${skippedTests.length - this._showSkippedTests}${RESET_COLOR} more skipped tests ...`);}}diff --git a/utils/testrunner/TestRunner.js b/utils/testrunner/TestRunner.jsindex b807659150..d664812a3e 100644--- a/utils/testrunner/TestRunner.js+++ b/utils/testrunner/TestRunner.js@@ -345,14 +345,12 @@ class TestRunner extends EventEmitter {this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;}- async _addSuite(mode, comment, name, callback) {+ _addSuite(mode, comment, name, callback) {const oldSuite = this._currentSuite;const suite = new Suite(this._currentSuite, name, mode, comment);this._currentSuite.children.push(suite);this._currentSuite = suite;const result = callback();- if (result && (typeof result.then === 'function'))- await result;this._currentSuite = oldSuite;this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;}