Skip to content

Commit 82db12f

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

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

src/utils/report/client/render/TestRunDescription.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const TestRunDescription: JSX.Component<Props> = ({fullTestRun}) => {
3131
const valueWithLinks = parseMarkdownLinks`${value}`;
3232
const metaHtml = (
3333
<>
34-
<dt class="test-description__term">{key}</dt>
34+
<dt class="test-description__term">{key}</dt>{' '}
3535
<dd class="test-description__definition">{valueWithLinks}</dd>
3636
</>
3737
);
@@ -49,7 +49,7 @@ export const TestRunDescription: JSX.Component<Props> = ({fullTestRun}) => {
4949

5050
traceHtml = (
5151
<>
52-
<dt class="test-description__term">{traceLabel}</dt>
52+
<dt class="test-description__term">{traceLabel}</dt>{' '}
5353
<dd class="test-description__definition">
5454
<a href={traceUrl} download={traceName} aria-label={traceLabel}>
5555
{traceName}
@@ -63,11 +63,11 @@ export const TestRunDescription: JSX.Component<Props> = ({fullTestRun}) => {
6363
<dl class="test-description" aria-label="Test meta data">
6464
<List elements={metaHtmls} />
6565
{traceHtml}
66-
<dt class="test-description__term">Date</dt>
66+
<dt class="test-description__term">Date</dt>{' '}
6767
<dd class="test-description__definition">
6868
<DatesInterval endTimeInMs={endTimeInMs} startTimeInMs={startTimeInMs} />
6969
</dd>
70-
<dt class="test-description__term">Duration</dt>
70+
<dt class="test-description__term">Duration</dt>{' '}
7171
<dd class="test-description__definition">
7272
<Duration durationInMs={endTimeInMs - startTimeInMs} />
7373
</dd>

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)