Skip to content

Commit 4b31f09

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

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
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: 15 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,23 @@ 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+
try {
43+
playwrightTest.skip(true, skipReason);
44+
} catch {}
45+
46+
return RESOLVED_PROMISE;
47+
},
48+
};
4149
}
4250

4351
const {

styles/report.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ a:visited {
553553
color: var(--subtitle-color);
554554
}
555555
.test-description__term::after {
556-
content: ':\00a0';
556+
content: ': ';
557557
}
558558
.test-description__definition {
559559
margin: 0;

0 commit comments

Comments
 (0)