Skip to content

Commit

Permalink
add tests for playwright trace attachments (via #1264)
Browse files Browse the repository at this point in the history
  • Loading branch information
epszaw authored Feb 24, 2025
1 parent 978ce41 commit f31df6e
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions packages/allure-playwright/test/spec/attachments.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,52 @@ it("adds snapshots correctly and provide a screenshot diff", async () => {
source: expect.stringMatching(/.*\.imagediff/),
});
});

it("adds trace to the report as an attachment", async () => {
const { tests } = await runPlaywrightInlineTest({
"sample.test.js": `
import test from '@playwright/test';
test('should do nothing', async ({ page }, testInfo) => {
await page.goto('https://allurereport.org');
});
`,
"playwright.config.js": `
import { defineConfig } from "@playwright/test";
export default {
outputDir: "./test-results",
reporter: [
[
require.resolve("allure-playwright"),
{
resultsDir: "./allure-results",
detail: false,
},
],
["dot"],
],
projects: [
{
name: "project",
},
],
use: {
trace: "on",
}
};
`,
});

expect(tests[0].steps).toHaveLength(1);
expect(tests[0].steps[0]).toMatchObject({
name: "trace",
attachments: [
expect.objectContaining({
name: "trace",
type: "application/zip",
source: expect.stringMatching(/.*\.zip/),
}),
],
});
});

0 comments on commit f31df6e

Please sign in to comment.