Is it possible to get a parsable file with the list of all passed or failed tests after a Playwright Test run?

When I went to go answer this question at the beginning of my Playwright journey, I wasn't able to find a solution that worked for me. Thankfully the Playwright team has built the reporters functionality where it's easy to create your own custom reports.

This lead me down the path of building my own custom reporter that output the specific details I wanted, in a format that I could parse after a run was complete. My goal was to create a json file that included the duration of the run, the final status (passed/failed), and a list of passed, failed, and skipped tests. Having this information I would be able to programmatically retry any failed tests easily, and list out any failed tests as a part of a slack notification integration.

That leads me to this fun announcement! I created a NPM Package that will do this for you!

A Simple Playwright Reporter. Latest version: 1.0.0, last published: 25 days ago. Start using playwright-json-summary-reporter in your project by running `npm i playwright-json-summary-reporter`. There are no other projects in the npm registry using playwright-json-summary-reporter.

To use this package in your playwright repo it is quite simple.


Run the below command within your playwright directory in order to install the package into your repository. This should add the dependencies to your package.json file.

$ npm install playwright-json-summary-reporter --save-dev


Now modify your playwright.config.ts file to include the custom reporter:

  reporter: [
    ['html'], // other reporters

Now when you run a test there should be a new file summary.json that gets saved to the root of the directory. An example of the file is shown below.

// summary.json

  "durationInMS": 41565,
  "passed": [
  "skipped": [],
  "failed": [],
  "warned": [],
  "timedOut": [],
  "status": "passed",
  "startedAt": 1674431153277

With this file in place I can now utilize command line tools such as cat and jq in order to parse and get the data from the file from the command line. The below command will get any values in the failed array and replace the return character with a space, so you now have a list of files that can be used to re-run failures.

failed=`cat summary.json | jq -r '.failed[]' |  tr '\n' ' '`

This will also allow us to build out other notifications outside of a Playwright Test Run, such as Slack notifications!

If what I provided above isn't helpful and you are looking for just a plain text file with details of your test run, you should check out Stephen Kilbourn's report summary package.

generate a customizable text summary of your playwright test results. Latest version: 1.1.1, last published: 19 days ago. Start using @skilbourn/playwright-report-summary in your project by running `npm i @skilbourn/playwright-report-summary`. There are no other projects in the npm registry using @s…

Thanks for reading! If you found this helpful, reach out and let me know on LinkedIn or consider buying me a cup of coffee. If you want more content delivered to you in your inbox subscribe below.