Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(runner): do not restart worker after skipping tests (#7511)

Yury Semikhatskyb2742976a857
diff --git a/src/test/workerRunner.ts b/src/test/workerRunner.ts
index 566dfac71f..d8ea34ee10 100644
--- a/src/test/workerRunner.ts
+++ b/src/test/workerRunner.ts
@@ -338,7 +338,7 @@ export class WorkerRunner extends EventEmitter {
if (!preserveOutput)
await removeFolderAsync(testInfo.outputDir).catch(e => {});
- if (testInfo.status !== 'passed') {
+ if (testInfo.status !== 'passed' && testInfo.status !== 'skipped') {
this._failedTestId = testId;
this._reportDoneAndStop();
}
diff --git a/tests/playwright-test/worker-index.spec.ts b/tests/playwright-test/worker-index.spec.ts
index b2afac1df6..9b89b7a6b1 100644
--- a/tests/playwright-test/worker-index.spec.ts
+++ b/tests/playwright-test/worker-index.spec.ts
@@ -69,6 +69,52 @@ test('should reuse worker for multiple tests', async ({ runInlineTest }) => {
expect(result.exitCode).toBe(0);
});
+test('should reuse worker after test.fixme()', async ({ runInlineTest }) => {
+ const result = await runInlineTest({
+ 'a.test.js': `
+ const { test } = pwt;
+ test('succeeds 1', async ({}, testInfo) => {
+ expect(testInfo.workerIndex).toBe(0);
+ });
+
+ test('fixme 1', async ({}, testInfo) => {
+ test.fixme();
+ expect(testInfo.workerIndex).toBe(0);
+ });
+
+ test('succeeds 2', async ({}, testInfo) => {
+ expect(testInfo.workerIndex).toBe(0);
+ });
+ `,
+ });
+ expect(result.passed).toBe(2);
+ expect(result.skipped).toBe(1);
+ expect(result.exitCode).toBe(0);
+});
+
+test('should reuse worker after test.skip()', async ({ runInlineTest }) => {
+ const result = await runInlineTest({
+ 'a.test.js': `
+ const { test } = pwt;
+ test('succeeds 1', async ({}, testInfo) => {
+ expect(testInfo.workerIndex).toBe(0);
+ });
+
+ test('skip 1', async ({}, testInfo) => {
+ test.skip();
+ expect(testInfo.workerIndex).toBe(0);
+ });
+
+ test('succeeds 2', async ({}, testInfo) => {
+ expect(testInfo.workerIndex).toBe(0);
+ });
+ `,
+ });
+ expect(result.passed).toBe(2);
+ expect(result.skipped).toBe(1);
+ expect(result.exitCode).toBe(0);
+});
+
test('should not reuse worker for different suites', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `