Skip to content

Commit

Permalink
update readme and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenkilbourn committed Oct 26, 2022
1 parent eb288f5 commit 0463000
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
37 changes: 34 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
Small text based custom reporter for Playwright.
It can be handy to publish test results for things such as an SNS message or minimal Slack update. This Tool allows you to generate smaller reports with basic info about your test run.

<!-- @import "[TOC]" {cmd="toc" depthFrom=1 depthTo=6 orderedList=false} -->
## Table of Contents

* [✨ Installation ✨](#✨-installation-✨)
* [📍 Configuration 📍](#📍-configuration-📍)
* [ Default Output 📜](#default-output-📜)
* [Customizing Outputs 👨‍💻](#customizing-outputs-👨‍💻)
* [Available Stats 🧰](#available-stats-🧰)

## ✨ Installation ✨

Run following commands:
Expand All @@ -29,11 +38,11 @@ Modify your `playwright.config.ts` file to include the reporter:
],
```

The default output location will be to your root as `summary.txt` Including the `outputFile` parameter allows you to specify a custom report location.
The default output location will be to your root as `summary.txt` Including the optional `outputFile` parameter allows you to specify a custom report location.

## Default Output 📜

If you do not pass an outputFile option, then the summary will be generated to a `summary.txt` file in the following format:
If you do not pass an `outputFile` option, then the summary will be generated to a `summary.txt` file in the following format:

```txt
Total Tests in Suite: 30,
Expand All @@ -53,7 +62,7 @@ Number of workers used for test run: 6

## Customizing Outputs 👨‍💻

YOu may also create a custom report by leveraging the values in the `stats` object. To add a custom report leveraging your stats, create a function in the format:
You may also create a custom report by leveraging the values in the [`stats`](#available-stats-🧰) object. To add a custom report leveraging your stats, create a function in the format:

```typescript
import type { Stats } from '@skilbourn/playwright-report-summary';
Expand Down Expand Up @@ -88,3 +97,25 @@ this will generate a `custom-summary.txt` file such as :
```txt
hello, 50 tests passed as expected in 03:51 (mm:ss)
```

## Available Stats 🧰

The `stats` object provides information on your test suite:

| **Name** | **type** | **Description** |
|--------------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| testsInSuite | number | Total number of tests in suite |
| totalTestsRun | number | t
otal tests run. Retried tests can make this value larger than testsInSuite |
| expectedResults | number | total test finished as [expected](https://playwright.dev/docs/api/class-testcase#test-case-expected-status) |
| unexpectedResults | number | total tests not finished as expected |
| flakyTests | number | total of tests that passed when retried |
| testMarkedSkipped | number | total tests marked as test.skip() or test.fixme() |
| failureFree | boolean | returns `true` if suite completes with unexpectedResults = 0 |
| durationCPU | number | total milliseconds spent run tests. If tests run parallel with multiple workers, this value will be larger than the duration of running the suite |
| durationSuite | number | milliseconds to complete all tests in suite |
| avgTestDuration | number | average test duration of all tests in milliseconds |
| formattedDurationSuite | string | duration to complete all tests in mm:ss format |
| formattedAvgTestDuration | string | average test duration of all tests in mm:ss format |
| failures | object | an object containing each failure in the format `{[test.title: result.status]}` Retries with failures will populate this with multiple entries of the same test |
| workers | number | total number of workers used to run the suite |
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@skilbourn/playwright-report-summary",
"version": "0.1.3",
"version": "0.2.0",
"description": "generate a customizable text summary of your playwright test results",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down

0 comments on commit 0463000

Please sign in to comment.