Skip to content

Commit 42c6806

Browse files
committed
PRO-14812 fix: really skip skipped tests in Playwright
1 parent ee8b0d9 commit 42c6806

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/utils/test/beforeTest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export const beforeTest = ({
7575
const {onlog, reject, testFnWithReject} = getTestFnAndReject({
7676
isSkipped,
7777
runId,
78+
skipReason,
7879
testFn,
7980
testIdleTimeout,
8081
testTimeout,

src/utils/test/getTestFnAndReject.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,19 @@ import {getPromiseWithResolveAndReject} from '../promise';
88

99
import type {Onlog, RejectTestRun, RunId, TestFn, Void} from '../../types/internal';
1010

11+
import {test as playwrightTest} from '@playwright/test';
12+
1113
type Options = Readonly<{
1214
isSkipped: boolean;
1315
runId: RunId;
16+
skipReason: string | undefined;
1417
testFn: TestFn;
1518
testIdleTimeout: number;
1619
testTimeout: number;
1720
}>;
1821

1922
type Return = Readonly<{onlog: Onlog; reject: RejectTestRun; testFnWithReject: TestFn}>;
2023

21-
const skippedTestFnAndReject: Return = {
22-
onlog: () => undefined,
23-
reject: () => undefined,
24-
testFnWithReject: () => RESOLVED_PROMISE,
25-
};
26-
2724
/**
2825
* Get test function with execution timeout, idle timeout, reject and onlog functions,
2926
* by isSkipped flag, test function, runId, test execution timeout and test idle timeouts.
@@ -32,12 +29,21 @@ const skippedTestFnAndReject: Return = {
3229
export const getTestFnAndReject = ({
3330
isSkipped,
3431
runId,
32+
skipReason,
3533
testFn,
3634
testIdleTimeout,
3735
testTimeout,
3836
}: Options): Return => {
3937
if (isSkipped) {
40-
return skippedTestFnAndReject;
38+
return {
39+
onlog: () => undefined,
40+
reject: () => undefined,
41+
testFnWithReject: () => {
42+
playwrightTest.skip(true, skipReason);
43+
44+
return RESOLVED_PROMISE;
45+
},
46+
};
4147
}
4248

4349
const {

0 commit comments

Comments
 (0)