Skip to content

feat: add function to attach Playwright Trace#1274

Merged
epszaw merged 9 commits intomainfrom
pw-trace-attachments
Mar 20, 2025
Merged

feat: add function to attach Playwright Trace#1274
epszaw merged 9 commits intomainfrom
pw-trace-attachments

Conversation

@todti
Copy link
Copy Markdown
Contributor

@todti todti commented Mar 18, 2025

Context

Add special contentType application/vnd.allure.playwright-trace for Playwright Trace archives.

Checklist

@github-actions github-actions Bot added theme:api Javascript API related issue theme:playwright labels Mar 18, 2025
@todti todti requested a review from epszaw March 18, 2025 10:17
@todti todti added the type:improvement Improvement or request label Mar 18, 2025
await test.info().attach(name, { path, contentType: options.contentType });
}

async attachTrace(name: string, content: Buffer) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the function from commons only

Comment thread packages/allure-playwright/src/index.ts Outdated
} else {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const contentType =
attachment.name === "trace" ? "application/vnd.allure.playwright-trace" : attachment.contentType;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the attachment content type too to be sure because we can have trace.jpg, trace.js etc.:

attachment.name === "trace" && attachment.contentType === "application/zip" ? ...

@epszaw epszaw merged commit 01c6163 into main Mar 20, 2025
@epszaw epszaw deleted the pw-trace-attachments branch March 20, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:api Javascript API related issue theme:playwright type:improvement Improvement or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants