Rayrun
โ† Back to Discord Forum

Github Action - Include trace in report

jan.ostgrenposted in #help-playwright
Open in Discord

How can include traces in Github action workflows.

This thread is trying to answer question "How can traces be included in Github action workflows and integrated into the Allure report?"

6 replies

๐Ÿ‘‹ Hey there,

In my repository, https://github.com/nullptrerror/DotNetE2EStarterKit, I've already set up GitHub Actions to include the video recordings as .zip artifacts.

We're currently exploring ways to publish the Allure report with both the trace and video as attachments. If anyone has insights or suggestions on how to seamlessly integrate these into the Allure report via GitHub Actions, it would be greatly appreciated!

Thanks in advance!

Yes, integrating the traces of failing test cases into Allure would be a huge step!

Yes, I also stuck with this one. Allure is a great reporter, but not having the traces is frustrating. If anyone has an idea how to attach them to the report will appreciate.

The report in version 1.38.1 should have solved this issue

@ondra123. Look at https://github.com/nullptrerror/DotNetE2EStarterKit. It attaches it to the allure report.

Currently I'm working on making the report a github page but I'm having trouble feeding the history to the nest report.

https://github.com/nullptrerror/DotNetE2EStarterKit/actions/runs/6326550028

Answer

Enabling Traces in GitHub Actions with Playwright

First, ensure Playwright is set up in your project. Then, in your GitHub Action workflow file (.github/workflows/main.yml), define a job for running tests with Playwright. This includes setting up the environment, installing dependencies, and executing test scripts.

To enable tracing, add a step that runs the tests with the --trace on flag. Here's how:

npx playwright test --trace on

This generates a trace.zip file for each retried test (if retries are configured). These files contain information about each action performed during the test execution.

Viewing Traces

You can view these traces using either Playwright CLI or the Trace Viewer tool provided by Playwright.

For Playwright CLI:

npx playwright show-trace <path-to-trace.zip>

For Trace Viewer, visit trace.playwright.dev and upload your trace files.

Configuring Traces

To record traces on the first retry of a failed test, configure Playwright in your playwright.config.ts file:

{
  trace: 'on-first-retry'
}

You can also customize other trace recording options in your playwright.config.ts file.

Remember to refer to the official Playwright documentation for more detailed instructions and updates.

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].