|
| 1 | +--- |
| 2 | +title: Adding Playwright Check Suites to groups |
| 3 | +displayTitle: Adding a Playwright Check Suite to a group |
| 4 | +navTitle: Add to a group |
| 5 | +weight: 20 |
| 6 | +slug: /groups-usage |
| 7 | +menu: |
| 8 | + resources: |
| 9 | + parent: "Playwright Check Suites (Alpha)" |
| 10 | + weight: 20 |
| 11 | +--- |
| 12 | + |
| 13 | +{{< markdownpartial "/_shared/playwright-native-alpha.md" >}} |
| 14 | + |
| 15 | +You can define a new group, or associate a Playwright Check Suite to an existing group. |
| 16 | + |
| 17 | +## Steps |
| 18 | + |
| 19 | +### 1. Create a group for your checks |
| 20 | + |
| 21 | +To define a new group, create a group file, for example `website-group.check.ts`. |
| 22 | + |
| 23 | +```typescript {title="website-group.check.ts"} |
| 24 | + |
| 25 | +import { CheckGroup } from 'checkly/constructs' |
| 26 | + |
| 27 | +export const myGroup = new CheckGroup('production-group', { |
| 28 | + name: 'Production group', |
| 29 | + activated: true, |
| 30 | + muted: false, |
| 31 | + locations: ['us-east-1', 'eu-west-1'], |
| 32 | + tags: ['mac', 'group'], |
| 33 | + environmentVariables: [], |
| 34 | + apiCheckDefaults: {}, |
| 35 | + concurrency: 100, |
| 36 | + runParallel: true, |
| 37 | + retryStrategy: RetryStrategyBuilder.linearStrategy({ baseBackoffSeconds: 30, maxRetries: 2, sameRegion: false }), |
| 38 | +}) |
| 39 | +``` |
| 40 | + |
| 41 | +Learn more about [using groups](https://www.checklyhq.com/docs/cli/constructs-reference/#checkgroup) to unify checks in Checkly. |
| 42 | + |
| 43 | +## 2. Associate the group to the check |
| 44 | + |
| 45 | +When specifying your Playwright Check Suite, you can reference the new or existing group, using its name: |
| 46 | + |
| 47 | + ```typescript {title="checkly.config.ts"} |
| 48 | + import { defineConfig } from 'checkly' |
| 49 | + |
| 50 | + const config = defineConfig({ |
| 51 | + logicalId: 'checkly-website', |
| 52 | + projectName: 'checkly-website', |
| 53 | + checks: { |
| 54 | + playwrightConfigPath: './playwright.config.ts', |
| 55 | + playwrightChecks: [ |
| 56 | + { |
| 57 | + name: 'checkly-website', |
| 58 | + frequency: 10, |
| 59 | + locations: ['us-east-1',], |
| 60 | + groupName: 'Production group', // use the name of the group you created |
| 61 | + }, |
| 62 | + ], |
| 63 | + }, |
| 64 | + cli: { |
| 65 | + runLocation: 'us-east-1', |
| 66 | + }, |
| 67 | + }) |
| 68 | + |
| 69 | + export default config |
| 70 | + ``` |
| 71 | + |
| 72 | +## 3. Deploy to apply the changes |
| 73 | + |
| 74 | +```bash {title="Terminal"} |
| 75 | + npx checkly deploy --preview #confirm what will be deployed |
| 76 | + npx checkly deploy # deploy |
| 77 | +``` |
| 78 | + |
| 79 | +You can now see your Playwright Check Suite in your group. |
0 commit comments