Skip to content

Commit 971787f

Browse files
authored
docs: Update README (#56)
* docs: Update README * update install command * Run readme through prettier
1 parent cbc28e3 commit 971787f

File tree

2 files changed

+46
-28
lines changed

2 files changed

+46
-28
lines changed

README.md

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This Playwright plugin reports each project to your Sauce Labs account.
55
## Installation
66

77
Install from npm:
8+
89
```sh
910
npm install @saucelabs/playwright-reporter
1011
```
@@ -16,21 +17,22 @@ Set the `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables to allow t
1617
## Usage
1718

1819
Add to the default reporter:
20+
1921
```sh
2022
npx playwright test --reporter=line,@saucelabs/playwright-reporter
2123
```
2224

2325
Use only `@saucelabs/playwright-reporter`:
26+
2427
```sh
2528
npx playwright test --reporter=@saucelabs/playwright-reporter
2629
```
2730

2831
You can also configure it using `playwright.config.js`. To do that, add `'@saucelabs/playwright-reporter'` to the reporter section of your configuration:
32+
2933
```js
3034
const config = {
31-
reporter: [
32-
['@saucelabs/playwright-reporter'],
33-
],
35+
reporter: [['@saucelabs/playwright-reporter']],
3436
// Rest of your config goes here
3537
};
3638
```
@@ -40,40 +42,49 @@ const config = {
4042
`@saucelabs/playwright-reporter` is configurable through your `playwright.config.js` or `playwright.config.ts` file.
4143

4244
Example:
45+
4346
```js
4447
const config = {
4548
reporter: [
46-
['@saucelabs/playwright-reporter', {
47-
buildName: 'My Playwright Build',
48-
region: 'us-west-1',
49-
tags: [
50-
'playwright',
51-
'demo',
52-
],
53-
}],
49+
[
50+
'@saucelabs/playwright-reporter',
51+
{
52+
buildName: 'My Playwright Build',
53+
region: 'us-west-1',
54+
tags: ['playwright', 'demo'],
55+
},
56+
],
5457
],
5558
// Rest of your config goes here
5659
};
5760
```
5861

59-
| Name | Description | Type |
60-
|--------------|--------------------------------------------------------------------------------------------------|--------------------------------|
61-
| `buildName` | Sets a build ID. <br> Default: `''` | `string` |
62-
| `tags` | Tags to add to the uploaded Sauce job. <br> Default: `[]` | `string[]` |
63-
| `region` | Sets the region. <br> Default: `us-west-1` | `us-west-1` \| `eu-central-1` |
64-
| `upload` | Whether to upload report and assets to Sauce Labs. <br> Default: `true` | `boolean` |
65-
| `outputFile` | The local path to write the Sauce test report. Can be set in env var `SAUCE_REPORT_OUTPUT_NAME`. | `string` |
66-
| `mergeVideos` | Whether to merge all video files generated by Playwright. This is useful when used with the `upload` option to upload the test report to Sauce Labs since it will allow you to view the merged video in the Sauce Labs Test Results page. **Requires ffmpeg to be installed.**<br> Default: `false` | `boolean` |
62+
| Name | Description | Type |
63+
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
64+
| `buildName` | Sets a build ID. <br> Default: `''` | `string` |
65+
| `tags` | Tags to add to the uploaded Sauce job. <br> Default: `[]` | `string[]` |
66+
| `region` | Sets the region. <br> Default: `us-west-1` | `us-west-1` \| `eu-central-1` |
67+
| `upload` | Whether to upload report and assets to Sauce Labs. <br> Default: `true` | `boolean` |
68+
| `outputFile` | The local path to write the Sauce test report. Can be set in env var `SAUCE_REPORT_OUTPUT_NAME`. | `string` |
69+
| `mergeVideos` | Whether to merge all video files generated by Playwright. This is useful when used with the `upload` option to upload the test report to Sauce Labs since it will allow you to view the merged video in the Sauce Labs Test Results page. **Requires ffmpeg to be installed.**<br> Default: `false` | `boolean` |
6770

6871
## Limitations
6972

7073
Some limitations apply to `@saucelabs/playwright-reporter`:
71-
* For Playwright versions before v1.16.3, the Playwright version is not reported to Sauce Labs.
72-
* The browser version is not reported to Sauce Labs.
74+
75+
- For Playwright versions before v1.16.3, the Playwright version is not reported to Sauce Labs.
76+
- The browser version is not reported to Sauce Labs.
7377

7478
## Development
7579

76-
### Running integration tests
80+
### Setup
81+
82+
1. Install dependencies: `npm ci`
83+
2. Setup git hooks: `npm run prepare`. This setups pre-commit hooks to format
84+
and lint staged code.
85+
3. Build: `npm run build`
86+
87+
### Running Locally
7788

7889
There are tests included in `tests/integration` where the reporter is referenced
7990
directly.
@@ -84,22 +95,28 @@ $ cd tests/integration
8495
$ npx playwright test
8596
```
8697

87-
### Running Locally
88-
89-
If you have playwright tests outside of the repo, you can link and install the
98+
If you have playwright tests outside of the repo, you can use
99+
[npm link](https://docs.npmjs.com/cli/v11/commands/npm-link) to install the
90100
reporter to run in your external repo.
91101

92102
```sh
93-
$ npm run build
94-
$ npm link
95103
$ npm link @saucelabs/playwright-reporter
96104
$ npx playwright test --reporter=@saucelabs/playwright-reporter
97105
```
98106

99107
### Debug
100108

101-
After linking with `npm link`, you can run your Playwright tests with the environment variable `DEBUG="@saucelabs/playwright-reporter:*"` to see additional debug output.
109+
You can run your Playwright tests with the environment variable
110+
`DEBUG="@saucelabs/playwright-reporter:*"` to see additional debug output.
102111

103112
```sh
104113
$ DEBUG="@saucelabs/playwright-reporter:*" npx playwright test --reporter=@saucelabs/playwright-reporter
105114
```
115+
116+
## Releasing
117+
118+
New versions are released with a manual GitHub Actions workflow.
119+
120+
1. Go to https://github.com/saucelabs/sauce-cypress-plugin/actions/workflows/release.yml
121+
2. Run the workflow and specify the branch and release type (`major`, `minor`,
122+
or `patch`).

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"install-playwright": "playwright install",
1111
"test": "npm run install-playwright && npm run build && jest",
1212
"build": "tsc",
13+
"prepare": "husky",
1314
"lint": "prettier --check '**/*.{js,ts,mjs,cjs}' && eslint .",
1415
"fmt": "prettier --write '**/*.{js,ts,mjs,cjs}'",
1516
"release": "npm run build && release-it --github.release",

0 commit comments

Comments
 (0)