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
test: make sure skipped tests in serial mode are reported (#30484)
Dmitry Gozmanb52cd7e4dcda
diff --git a/tests/playwright-test/reporter.spec.ts b/tests/playwright-test/reporter.spec.tsindex 7b48677e4f..f07576b90c 100644--- a/tests/playwright-test/reporter.spec.ts+++ b/tests/playwright-test/reporter.spec.ts@@ -76,7 +76,8 @@ class Reporter {}onTestEnd(test, result) {- console.log('onTestEnd: ' + formatTitle(test) + '; retry #' + result.retry);+ const status = this.options.printTestStatus ? '[' + result.status + '] ' : '';+ console.log('onTestEnd: ' + status + formatTitle(test) + '; retry #' + result.retry);this.printErrors(result.errors);}@@ -676,3 +677,39 @@ test('should report annotations from test declaration', async ({ runInlineTest }`title=fixme-bar-suite, annotations=bar,fixme`,]);});++test('tests skipped in serial mode receive onTestBegin/onTestEnd', async ({ runInlineTest }) => {+ test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/28321' });++ const result = await runInlineTest({+ 'reporter.ts': smallReporterJS,+ 'playwright.config.ts': `module.exports = { reporter: [['./reporter', { printTestStatus: true }]] };`,+ 'a.spec.ts': `+ import { test, expect } from '@playwright/test';++ test.describe.configure({ mode: 'serial', retries: 1 });++ test('test1', () => {+ expect(test.info().retry).toBe(1);+ });++ test('test2', () => {+ });+ `,+ }, { 'reporter': '', 'workers': 1 });++ expect(result.output).toBe(`+onBegin: 2 tests total+onTestBegin: > a.spec.ts > test1; retry #0+onTestEnd: [failed] > a.spec.ts > test1; retry #0+ error: Error: expect(received).toBe(expected) // Object.is equality @ a.spec.ts:7+onTestBegin: > a.spec.ts > test2; retry #0+onTestEnd: [skipped] > a.spec.ts > test2; retry #0+onTestBegin: > a.spec.ts > test1; retry #1+onTestEnd: [passed] > a.spec.ts > test1; retry #1+onTestBegin: > a.spec.ts > test2; retry #1+onTestEnd: [passed] > a.spec.ts > test2; retry #1+onEnd+onExit+`);+});