Skip to content

Commit fd75453

Browse files
authored
Tweak PWN reference documentation (#1306)
1 parent c06b93e commit fd75453

File tree

2 files changed

+113
-52
lines changed

2 files changed

+113
-52
lines changed

site/content/docs/playwright-checks/_index.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Use your existing Playwright tests as live, scheduled monitoring checks. No rewr
1616

1717
## What's a Playwright Check Suite?
1818

19-
A Playwright Check Suite lets you define a monitoring strategy using your existing Playwright tests and configured projects.
19+
A Playwright Check Suite lets you use your existing Playwright tests and projects for end-to-end monitoring with tailored monitoring strategies.
2020

2121
You can mix and match existing
2222
[projects](https://playwright.dev/docs/test-projects) (`pwProjects`) and [test tags](https://playwright.dev/docs/test-annotations#tag-tests) (`pwTags`) to select tests and group subsets into Playwright Check Suites. This approach allows you to specify different monitoring settings for each Playwright Check Suite to differenciate between smoke tests or critical path flows.
@@ -54,7 +54,7 @@ Create a `checkly.config.ts/js` and pick the tests you want to monitor, use [tes
5454

5555
Make sure:
5656

57-
* `pwProjects` match projects names in your playwright.config.ts.
57+
* `pwProjects` match projects names in your `playwright.config.ts`.
5858
* `pwTags` match tags in your test definitions.
5959

6060
Below are two example check suites:
@@ -75,26 +75,30 @@ export default defineConfig({
7575
playwrightConfigPath: './playwright.config.ts',
7676
playwrightChecks: [
7777
{
78-
/*
79-
Create a multi-browser check that runs
80-
every 10 mins in two locations.
81-
*/
78+
/**
79+
* Create a multi-browser check that runs
80+
* every 10 mins in two locations.
81+
*/
8282
logicalId: 'multi-browser',
8383
name: 'Multi Browser Suite',
84-
pwProjects: ['chromium', 'firefox', 'webkit'], // Use project (or projects) in your Playwright config
85-
pwTags: '@smoke-tests', // Use a tag (or tags) in your tests
84+
// Use one project (or multiple projects) defined in your Playwright config
85+
pwProjects: ['chromium', 'firefox', 'webkit'],
86+
// Use one tag (or multiple tags) defined in your spec files
87+
pwTags: '@smoke-tests',
8688
frequency: Frequency.EVERY_10M,
8789
locations: ['us-east-1', 'eu-west-1'],
8890
},
8991
{
90-
/*
91-
Create a check that runs the `@critical` tagged tests
92-
every 5 mins in three locations.
93-
*/
92+
/**
93+
* Create a check that runs the `@critical` tagged tests
94+
* every 5 mins in three locations.
95+
*/
9496
logicalId: 'critical-tagged',
9597
name: 'Critical Tagged tests',
96-
pwTags: '@critical', // Reference an existing tag in your tests
98+
// Use one project (or multiple projects) defined in your Playwright config
9799
pwProjects: ['chromium'],
100+
// Use one tag (or multiple tags) defined in your spec files
101+
pwTags: '@critical',
98102
frequency: Frequency.EVERY_5M,
99103
locations: ['us-east-1', 'eu-central-1', 'ap-southeast-2'],
100104
},

site/content/docs/playwright-checks/reference.md

Lines changed: 96 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,78 +11,135 @@ menu:
1111

1212
{{< markdownpartial "/_shared/playwright-native-alpha.md" >}}
1313

14-
To define your Playwright Check Suite, you use the `checkly.config.ts/js` file.
14+
Use the `checkly.config.ts/js` file to define your Playwright Check Suite.
1515

16-
Each Playwright Check Suite is connected to an existing reference in your `playwright.config.ts/js` file.
17-
During the Alpha, a Playwright Check Suite can last up to 20 minutes. This limit is open to be increased/decreased after the alpha.
16+
Each Playwright Check Suite can be connected to references in your `playwright.config.ts/js` file.
17+
18+
During the Alpha, **a Playwright Check Suite can run up to 20 minutes**. This limit can be increased/decreased after the alpha.
1819

1920
## Playwright Check Suite definition
2021

22+
To add Playwright Check Suites to your Checkly monitoring setup, specify the path to your `playwright.config.ts/js` and add a new `playwrightChecks` property to the existing `checks` configuration in your `checkly.config.ts/js`.
23+
24+
```typescript {title="checkly.config.ts"}
25+
import { defineConfig } from 'checkly'
26+
import { Frequency } from 'checkly/constructs'
27+
28+
export default defineConfig({
29+
// ...
30+
31+
checks: {
32+
playwrightConfigPath: './playwright.config.ts',
33+
playwrightChecks: [
34+
{
35+
name: 'critical-tagged',
36+
pwTags: 'critical',
37+
pwProjects: 'chromium',
38+
frequency: Frequency.EVERY_1M,
39+
locations: ['us-east-1', 'eu-west-1','eu-central-1', 'ap-south-1'],
40+
}
41+
],
42+
},
43+
})
44+
```
45+
46+
A Playwright Check Suite requires the following properties:
47+
2148
* `name` - a human friendly name for your check suite.
2249
* `logicalId` - a reference for your check suite.
2350

51+
Other available properties like `frequency`, `alertChannels` or `locations` are inherited from the general Checkly configuration if not specified otherwise.
52+
2453
## Playwright references
2554

26-
The following Playwright references are available to create a Playwright Monitor:
55+
The Checkly infrastructure will run and deploy all your existing Playwright tests (similar to what `npx playwright test` runs) as monitors if you don't reference Playwright projects or tags.
56+
57+
Specify which tests should become part of global end-to-end monitoring by defining these properties:
2758

28-
* `pwProjects` --- select existing project names from your playwright configuration to create a playwright check.
59+
* `pwProjects` --- select existing project names from your Playwright configuration to create a Playwright Check Suite.
2960

30-
* `pwTags` --- select witch tags will be grouped into a playwright check.
61+
* `pwTags` --- select test tags that will be grouped into a Playwright Check Suite.
3162

32-
You can combine `pwTags` and `pwProjects` to generate your check. For example:
63+
You can combine `pwTags` and `pwProjects` to generate your check suite, too.
64+
65+
For example:
3366

3467
```typescript {title="checkly.config.ts"}
35-
checks: {
36-
playwrightConfigPath: './playwright.config.ts',
37-
playwrightChecks: [
38-
{
39-
// Run critical tagged tests in Chromium every minute from 4 locations
40-
name:"critical-tagged",
41-
pwTags: 'critical',
42-
pwProjects: 'chromium',
43-
frequency: Frequency.EVERY_1M,
44-
locations: ['us-east-1', 'eu-west-1','eu-central-1', 'ap-south-1'],
45-
},
46-
],
47-
},
68+
export default defineConfig({
69+
// ...
70+
checks: {
71+
playwrightConfigPath: './playwright.config.ts',
72+
playwrightChecks: [
73+
{
74+
/**
75+
* Run critical tagged tests in Chromium
76+
* every minute from 4 locations.
77+
*/
78+
name: 'critical-tagged',
79+
pwTags: '@critical',
80+
pwProjects: 'chromium',
81+
frequency: Frequency.EVERY_1M,
82+
locations: ['us-east-1', 'eu-west-1','eu-central-1', 'ap-south-1'],
83+
},
84+
],
85+
},
86+
});
4887
```
4988

50-
## Monitoring customizations
89+
> We recommend using `pwTags` and `pwProjects` to group your Playwright tests into different monitoring levels with different monitoring settings. For example, critical application functionality may be monitored best with short monitoring frequencies to lower the mean time to detect (MTTD).
5190
52-
These are the available monitoring configuration options:
91+
## Monitoring customizations
5392

54-
* `installCommand:` Override the command to install dependencies, by default it'll use `npm install --dev`.
93+
A Playwright Check Suite inherits multiple properties from [the abstract `Check` class](/docs/cli/constructs-reference/#check):
5594

56-
* `testCommand:` Override the command to test, by default it uses npx playwright test with the tags, projects, and config file options your check specifies.
95+
- `name`
96+
- `activated`
97+
- `muted`
98+
- `locations`
99+
- `tags`
100+
- `frequency`
101+
- `alertChannels`
102+
- `privateLocations`
103+
- `retryStrategy`
104+
- `alertEscalationPolicy`
57105

58-
* `activated:` A boolean value to activate/run your check or not.
106+
Check [the reference documentation](/docs/cli/constructs-reference/#check) for more information on these settings.
59107

60-
* `muted:` A boolean value to mute Alert notifications.
108+
Additionally, Playwright Check Suites provide specific configuration for your Playwright monitoring.
61109

62-
* `frequency:` How often the check will run. It supports:
63-
* Formatted time: `frequency: Frequency.EVERY_10M,`
64-
* Actual seconds: `frequency:60,`
110+
* `installCommand:` Override the command to install dependencies, by default it'll use `npm install --dev`.
65111

66-
* `locations:` An array of locations where to run your Checks.
112+
* `testCommand:` Override the command to test, by default it uses npx playwright test with the tags, projects, and config file options your check specifies.
67113

68114
* `groupName:` The group this check belongs to.
69115

70116
```typescript {title="checkly.config.ts"}
71-
72117
checks: {
73118
playwrightConfigPath: './playwright.config.ts', // specify your config file
74119
playwrightChecks: [
75120
{
76-
// Run E2E tagged tests across browsers in 4 locations
121+
/**
122+
* Run `@e2e` tagged tests across browsers
123+
* every 5 minute from 4 locations.
124+
*/
125+
// Human readable name
77126
name: 'E2E test suite',
127+
// Reference id
78128
logicalId: 'e2e-test-suite',
79-
pwProjects: ['chromium', 'firefox', 'webkit'], // Reference the project or projects in playwright.config file
80-
pwTags: 'e2e', // Reference an existing tag in your tests
81-
installCommand: 'npm install --dev', // Optionally override default dependencies install command
82-
testCommand: 'npx playwright test --grep@checkly --config=playwright.foo.config.ts', //Optionally override the default test command
83-
activated: true, // Optional - Activate the check so that it runs on a schedule, true by default
84-
muted: false, // Optional - Mute the check so that it doesn't send alerts
85-
groupName: 'production-group', // use the name of the group you created
129+
// Playwright project references defined in `playwright.config`
130+
pwProjects: ['chromium', 'firefox', 'webkit'],
131+
// Playwright tags defined in `spec` files
132+
pwTags: '@e2e',
133+
// Override default dependencies install command
134+
installCommand: 'npm install --dev',
135+
// Override the default test command
136+
testCommand: 'npx playwright test --grep@checkly --config=playwright.foo.config.ts',
137+
// Activate the check so that it runs on a schedule, true by default
138+
activated: true,
139+
// Mute the check so that it doesn't send alerts
140+
muted: false,
141+
// Add a check to a group
142+
groupName: 'production-group',
86143
frequency: Frequency.EVERY_5M,
87144
locations: ['us-east-1', 'eu-west-1','eu-central-1', 'ap-south-1'],
88145
}

0 commit comments

Comments
 (0)