Rayrun
← Back to Discord Forum

How do I get each test to be prefixed by testNr / total (e.g. 1/12) ?

snailwhale.posted in #help-playwright
Open in Discord
snailwhale.
snailwhale.

When viewing Playwright progress in a GitHub Actions run, where the start of the output is usually truncated if you 'tune in' late, the following output:

121) Title of test

... is not very helpful in terms of showing progress, without something like:

121/300) Title of test

How do I tune the line reporter to include the total amount of tests in each line?

This thread is trying to answer question "How do I tune the line reporter to include the total amount of tests in each line?"

1 reply

You can't tune built-in reporter. However, they are open source so you can just write a custom reporter based on in-line reporter and include total tests count yourself.

Answer

Displaying Total Number of Tests in Playwright Test

You can customize the line reporter in Playwright Test to display the total number of tests. This can be done by modifying the playwright.config.ts file.

Here's how you can do it:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  reporter: [['line', { printSummary: true }]],
});

The printSummary: true option will make the line reporter display the total number of tests at the end of each line. This gives you a detailed overview of your test suite progress.

When you run your tests using npx playwright test --reporter=line, your output will look something like this:

Running 124 tests using 6 workers
1) dot-reporter.spec.ts:20:1 › render expected (1/124)

The (1/124) indicates that this is the first out of 124 total tests being executed. This way, you can track how many tests have been executed out of the total number.

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].