Skip to content

Commit f31df6e

Browse files
authored
add tests for playwright trace attachments (via #1264)
1 parent 978ce41 commit f31df6e

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

packages/allure-playwright/test/spec/attachments.spec.ts

+49
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,52 @@ it("adds snapshots correctly and provide a screenshot diff", async () => {
6060
source: expect.stringMatching(/.*\.imagediff/),
6161
});
6262
});
63+
64+
it("adds trace to the report as an attachment", async () => {
65+
const { tests } = await runPlaywrightInlineTest({
66+
"sample.test.js": `
67+
import test from '@playwright/test';
68+
69+
test('should do nothing', async ({ page }, testInfo) => {
70+
await page.goto('https://allurereport.org');
71+
});
72+
`,
73+
"playwright.config.js": `
74+
import { defineConfig } from "@playwright/test";
75+
76+
export default {
77+
outputDir: "./test-results",
78+
reporter: [
79+
[
80+
require.resolve("allure-playwright"),
81+
{
82+
resultsDir: "./allure-results",
83+
detail: false,
84+
},
85+
],
86+
["dot"],
87+
],
88+
projects: [
89+
{
90+
name: "project",
91+
},
92+
],
93+
use: {
94+
trace: "on",
95+
}
96+
};
97+
`,
98+
});
99+
100+
expect(tests[0].steps).toHaveLength(1);
101+
expect(tests[0].steps[0]).toMatchObject({
102+
name: "trace",
103+
attachments: [
104+
expect.objectContaining({
105+
name: "trace",
106+
type: "application/zip",
107+
source: expect.stringMatching(/.*\.zip/),
108+
}),
109+
],
110+
});
111+
});

0 commit comments

Comments
 (0)