Hey everyone, not sure if this is really the correct place, as it's tied to a third party reporting integration. We are looking for the best way to achieve good reporting on each action in Report Portal. We are using the official RP agent - https://github.com/reportportal/agent-js-playwright
What's the best way to log as much info as possible with it? So far the only way we've achieved it is by wrapping the relevant (for us) Playwright API actions (click, fill, waitFor, etc) in a custom class and putting the relevant logs there. The downside is that we can't use the Playwright API directly as we lose the logging capability. Is there a better way to achieve the same behaviour directly with the Playwright API and a custom reporter or anything else?
Example of what we want to get into RP:
Entering automation in the #username
Clicking on text='Login'
This thread is trying to answer question "What's the best way to log as much info as possible with the official RP agent without losing the logging capability when using the Playwright API directly?"
Just an suggestion to look into https://playwright.dev/docs/test-annotations#custom-annotations
Related Ask AI answer for "How do I maximize logging information with the RP agent while using the Playwright API directly?".
To get the most out of your logging with the RP agent and Playwright API, you'll want to use Playwright's trace viewer. This tool gives you a detailed view of your tests, including actions, timing, parameters, return values, and logs.
When running tests locally, start recording a trace by setting the --trace
flag to "on". Use the command npx playwright test --trace on
.
npx playwright test --trace on
This records traces for each test and generates an HTML report.
For tests on continuous integration (CI), configure traces to run on the first retry of a failed test. Set the trace: 'on-first-retry'
option in your test configuration file (playwright.config.ts
).
module.exports = {
use: {
trace: 'on-first-retry',
},
};
This produces a trace.zip
file for each retried test.
The trace viewer lets you inspect your tests in detail. You can see actions, their time and duration, console output, network requests, and source code.
By integrating the Playwright trace viewer with RP Agent logging, you get detailed logging while still benefiting from Playwright API's other features.
Remember, this advice is based on the information provided. If you have specific requirements or constraints not covered here, please provide more context.
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].