1.1.1 • Published 1 year ago

@skilbourn/playwright-report-summary v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

📜 🎭 Playwright Report Summary 🎭 📜

Coverage Status

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.

Table of Contents

✨ Installation ✨

Run following commands:

npm

npm install @skilbourn/playwright-report-summary --save-dev

yarn

yarn add @skilbourn/playwright-report-summary --dev

📍 Configuration 📍

Modify your playwright.config.ts file to include the reporter:

  reporter: [
    ['@skilbourn/playwright-report-summary', { outputFile: 'custom-summary.txt' }]],
    ['html'], // other reporters
    ['dot']
  ],

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:

Total Tests in Suite: 30,
Total Tests Completed: 30,
Tests Passed: 27,
Tests Failed: 0,
Flaky Tests: 0,
Test run was failure free? true,
Test Skipped: 3,
Duration of CPU usage in ms: 75188,
Duration of entire test run in ms: 12531,
Average Test Duration in ms:2506.3,
Test Suite Duration: 00:13 (mm:ss),
Average Test Duration: 00:03 (mm:ss),
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:

import type { Stats } from '@skilbourn/playwright-report-summary';

function customReport(stats: Stats) {
  return `Greetings, hello, ${stats.expectedResults} tests passed as expected in ${stats.formattedDurationSuite}`;
}

export default customReport;

and then modify your playwright.config.ts file with the following:

import type { PlaywrightTestConfig } from '@playwright/test';
import { devices } from '@playwright/test';

import customReport from './customReport';
 // Your custom report path and preferred name


const config: PlaywrightTestConfig = {
  ...
  reporter: [
    ['@skilbourn/playwright-report-summary', { outputFile: 'custom-summary.txt', inputTemplate: customReport }]]
  ],

this will generate a custom-summary.txt file such as :

hello, 50 tests passed as expected in 03:51 (mm:ss)

Available Stats 🧰

The stats object provides information on your test suite:

NametypeDescription
testsInSuitenumberTotal number of tests in suite
totalTestsRunnumbertotal tests run. Retried tests can make this value larger than testsInSuite
expectedResultsnumbertotal test finished as expected
unexpectedResultsnumbertotal tests not finished as expected
flakyTestsnumbertotal of tests that passed when retried
testMarkedSkippednumbertotal tests marked as test.skip() or test.fixme()
failureFreebooleanreturns true if suite completes with all test completing as expected after retries
durationCPUnumbertotal milliseconds spent run tests. If tests run parallel with multiple workers, this value will be larger than the duration of running the suite
durationSuitenumbermilliseconds to complete all tests in suite
avgTestDurationnumberaverage test duration of all tests in milliseconds
formattedDurationSuitestringduration to complete all tests in mm:ss format
formattedAvgTestDurationstringaverage test duration of all tests in mm:ss format
failuresobjectan object containing each failure in the format {[test.title: result.status]} Retries with failures will populate this with multiple entries of the same test
workersnumbertotal number of workers used to run the suite
1.1.1

1 year ago

1.1.0

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.3

2 years ago

0.1.0

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago