Rayrun

What is the 'List' reporter in Playwright Test and how does it work?

Answer

Meet the List Reporter in Playwright Test

The List reporter is a built-in reporter in @playwright/test. It's a great choice if you want a concise report of your tests without any color code characters.

What Does It Do?

The List reporter prints a line for each test run and provides detailed information about failures. It's more concise than other reporters and doesn't contain color code characters.

Here's an example of what the output looks like:

1 ✓ should access error in env (438ms)
2 ✓ handle long test names (515ms)
3 x 1) render expected (691ms)
4 ✓ should timeout (932ms)
5 should repeat each:
6 ✓ should respect enclosing .gitignore (569ms)
7 should teardown env after timeout:
8 should respect excluded tests:
9 ✓ should handle env beforeEach error (638ms)
10 should respect enclosing .gitignore:

In this example, you can see that there are 10 tests in total. Out of these, 8 have passed successfully and 1 has failed (render expected). The remaining test (should repeat each) does not have a specific pass/fail status mentioned.

How to Use It

To use the List reporter, specify it as your desired reporter format in your Playwright configuration file (playwright.config.ts). Here's how you can do that:

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

export default defineConfig({
  reporter: 'list',
});

By setting reporter to 'list', you enable the List reporter format for your test runs. This will give you a basic report of the number of tests passed, failed, etc. without any color code characters.

So, if you're looking for a straightforward and concise test report, give the List reporter a try!

References

Thank you!
Was this helpful?
Still have questions?

If you still have questions, please ask a question and I will try to answer it.

Related Discord Threads

Related Questions

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 luc@ray.run.