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(runner): mark tests skipped due to sharding in junit report (#7578)
Yury Semikhatsky5d62d014503b
diff --git a/tests/playwright-test/json-reporter.spec.ts b/tests/playwright-test/json-reporter.spec.tsindex c6cb64321a..1b362f0456 100644--- a/tests/playwright-test/json-reporter.spec.ts+++ b/tests/playwright-test/json-reporter.spec.ts@@ -34,6 +34,35 @@ test('should support spec.ok', async ({ runInlineTest }) => {expect(result.report.suites[0].specs[1].ok).toBe(false);});+test('should report skipped due to sharding', async ({ runInlineTest }) => {+ const result = await runInlineTest({+ 'a.test.js': `+ const { test } = pwt;+ test('one', async () => {+ });+ test('two', async () => {+ test.skip();+ });+ `,+ 'b.test.js': `+ const { test } = pwt;+ test('three', async () => {+ });+ test('four', async () => {+ test.skip();+ });+ test('five', async () => {+ });+ `,+ }, { shard: '1/3', reporter: 'json' });+ expect(result.exitCode).toBe(0);+ expect(result.report.suites[0].specs[0].tests[0].status).toBe('expected');+ expect(result.report.suites[0].specs[1].tests[0].status).toBe('skipped');+ expect(result.report.suites[1].specs[0].tests[0].status).toBe('skipped');+ expect(result.report.suites[1].specs[1].tests[0].status).toBe('skipped');+ expect(result.report.suites[1].specs[2].tests[0].status).toBe('skipped');+});+test('should report projects', async ({ runInlineTest }, testInfo) => {const result = await runInlineTest({'playwright.config.ts': `diff --git a/tests/playwright-test/junit-reporter.spec.ts b/tests/playwright-test/junit-reporter.spec.tsindex aa74939118..f27fbd828d 100644--- a/tests/playwright-test/junit-reporter.spec.ts+++ b/tests/playwright-test/junit-reporter.spec.ts@@ -157,6 +157,39 @@ test('should render skipped', async ({ runInlineTest }) => {expect(result.exitCode).toBe(0);});+test('should report skipped due to sharding', async ({ runInlineTest }) => {+ const result = await runInlineTest({+ 'a.test.js': `+ const { test } = pwt;+ test('one', async () => {+ });+ test('two', async () => {+ test.skip();+ });+ `,+ 'b.test.js': `+ const { test } = pwt;+ test('three', async () => {+ });+ test('four', async () => {+ test.skip();+ });+ test('five', async () => {+ });+ `,+ }, { shard: '1/3', reporter: 'junit' });+ const xml = parseXML(result.output);+ expect(xml['testsuites']['testsuite'][0]['$']['tests']).toBe('2');+ expect(xml['testsuites']['testsuite'][0]['$']['failures']).toBe('0');+ expect(xml['testsuites']['testsuite'][0]['$']['skipped']).toBe('1');++ expect(xml['testsuites']['testsuite'][1]['$']['tests']).toBe('3');+ expect(xml['testsuites']['testsuite'][1]['$']['failures']).toBe('0');+ expect(xml['testsuites']['testsuite'][1]['$']['skipped']).toBe('3');+ expect(result.exitCode).toBe(0);+});++test('should render projects', async ({ runInlineTest }) => {const result = await runInlineTest({'playwright.config.ts': `