Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 28e4ec7

Browse filesBrowse files
authored
feat(allure-playwright): support test tags (via #1034)
1 parent 54d0087 commit 28e4ec7
Copy full SHA for 28e4ec7

File tree

Expand file treeCollapse file tree

2 files changed

+96
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+96
-0
lines changed

‎packages/allure-playwright/src/index.ts

Copy file name to clipboardExpand all lines: packages/allure-playwright/src/index.ts
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,15 @@ export class AllureReporter implements ReporterV2 {
190190
result.labels!.push({ name: "titlePath", value: suite.titlePath().join(" > ") });
191191
result.labels!.push({ name: LabelName.PACKAGE, value: pathElements.join(".") });
192192

193+
// support for earlier playwright versions
194+
if ("tags" in test) {
195+
const tags: Label[] = test.tags.map((tag) => ({
196+
name: LabelName.TAG,
197+
value: tag.startsWith("@") ? tag.substring(1) : tag,
198+
}));
199+
result.labels!.push(...tags);
200+
}
201+
193202
if (project?.name) {
194203
result.parameters!.push({ name: "Project", value: project.name });
195204
}
+87Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { expect, it } from "vitest";
2+
import { runPlaywrightInlineTest } from "../utils.js";
3+
4+
it("should support playwright tags", async () => {
5+
const { tests } = await runPlaywrightInlineTest({
6+
"sample.test.js": `
7+
import { test } from '@playwright/test';
8+
9+
test('test full report', {
10+
tag: ['@slow', '@vrt'],
11+
}, async () => {
12+
});
13+
`,
14+
});
15+
16+
expect(tests).toEqual(
17+
expect.arrayContaining([
18+
expect.objectContaining({
19+
name: "test full report",
20+
labels: expect.arrayContaining([
21+
{
22+
name: "tag",
23+
value: "slow",
24+
},
25+
{
26+
name: "tag",
27+
value: "vrt",
28+
},
29+
]),
30+
}),
31+
]),
32+
);
33+
});
34+
35+
it("should support tests with single tag", async () => {
36+
const { tests } = await runPlaywrightInlineTest({
37+
"sample.test.js": `
38+
import { test } from '@playwright/test';
39+
40+
test("test single tag report", { tag: "@single"}, async() => {});
41+
`,
42+
});
43+
44+
expect(tests).toEqual(
45+
expect.arrayContaining([
46+
expect.objectContaining({
47+
name: "test single tag report",
48+
labels: expect.arrayContaining([
49+
{
50+
name: "tag",
51+
value: "single",
52+
},
53+
]),
54+
}),
55+
]),
56+
);
57+
});
58+
59+
it("should support suites tags", async () => {
60+
const { tests } = await runPlaywrightInlineTest({
61+
"sample.test.js": `
62+
import { test } from '@playwright/test';
63+
64+
test.describe('suite', { tag: "@first"}, () => {
65+
test("test single tag report", { tag: "@second"}, async() => {});
66+
});
67+
`,
68+
});
69+
70+
expect(tests).toEqual(
71+
expect.arrayContaining([
72+
expect.objectContaining({
73+
name: "test single tag report",
74+
labels: expect.arrayContaining([
75+
{
76+
name: "tag",
77+
value: "first",
78+
},
79+
{
80+
name: "tag",
81+
value: "second",
82+
},
83+
]),
84+
}),
85+
]),
86+
);
87+
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.