Skip to content

feat: add Playwright trace attachments for allure-pytest and allure-robotframework (fixes #877) - #920

Open
hasanalpzengin wants to merge 1 commit into
allure-framework:masterfrom
hasanalpzengin:feat/playwright-trace
Open

feat: add Playwright trace attachments for allure-pytest and allure-robotframework (fixes #877)#920
hasanalpzengin wants to merge 1 commit into
allure-framework:masterfrom
hasanalpzengin:feat/playwright-trace

Conversation

@hasanalpzengin

@hasanalpzengin hasanalpzengin commented Jul 31, 2026

Copy link
Copy Markdown

Enable playwright-trace for allure_pytest and allure_robotframework #877

Context

Fixes #877.

Playwright can record a trace.zip per test that captures a full timeline of actions, DOM snapshots, network activity, and console logs — viewable in the interactive Playwright Trace Viewer. Previously these traces were produced on disk but never surfaced in Allure reports, so users had to hunt for them manually. This PR wires those traces into Allure as first-class attachments for both the pytest and Robot Framework integrations.

Changes:

  • New attachment type — added PLAYWRIGHT_TRACE (application/vnd.allure.playwright-trace, .zip) to AttachmentType in allure-python-commons, so the report renderer can recognize and open traces in the Trace Viewer rather than treating them as a generic zip.
  • allure-pytest — after each test call phase, the listener now detects the pytest-playwright plugin and, when tracing is enabled, locates the test's output folder (via --output, default test-results), matches it by the pytest-playwright node slug (including the >255-char hash-truncation fallback that pytest-playwright uses), and attaches any trace*.zip files found. No-ops cleanly when the plugin is absent, tracing is off, slugify is unavailable, or no traces exist.
  • allure-robotframework — snapshots the ${OUTPUTDIR}/browser folder at test start and, at test end, attaches any newly created *.zip traces (produced by robotframework-browser). No-ops when the folder or Robot's BuiltIn context is unavailable.

Both integrations are additive and degrade gracefully when the respective browser tooling isn't installed or tracing isn't turned on.

Tests: added end-to-end fixture tests for both integrations (tests/allure_pytest/externals/pytest_playwright/ and tests/allure_robotframework/externals/robotframework_browser/, the latter with a fake_browser_library stand-in).

Checklist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support open trace viewer from plugin allure-pytest (flow version allure-2.35.1)

1 participant