import { RuntimeCheck, RuntimeCheckProps } from './check.js'; import { Diagnostics } from './diagnostics.js'; import { PlaywrightCheckBundle } from './playwright-check-bundle.js'; import { Ref } from './ref.js'; import { ConfigDefaultsGetter } from './check-config.js'; import { CheckConfigDefaults } from '../services/checkly-config-loader.js'; import { Bundler } from '../services/check-parser/bundler.js'; import { Engine } from './engine.js'; export interface PlaywrightCheckProps extends Omit { /** * The JavaScript engine used to run the Playwright tests. * Use {@link Engine.node} or {@link Engine.bun} to create an engine instance. * When omitted, the CLI auto-detects from project version files * (.node-version, .nvmrc, .tool-versions, .bun-version, or package.json engines). * * @example Engine.node('24') * @example Engine.bun('1.3') */ engine?: Engine; /** * Path to the Playwright configuration file (playwright.config.js/ts). * This file defines test settings, browser configurations, and project structure. * * @example "playwright.config.ts" */ playwrightConfigPath: string; /** * Command to install dependencies before running tests. * Useful for ensuring test dependencies are available in the runtime environment. * * @example "npm ci" * @example "yarn install --frozen-lockfile" */ installCommand?: string; /** * Command to execute Playwright tests. * The check will automatically append configuration, project, and tag arguments. * * @defaultValue "npx playwright test" * @example "npx playwright test --grep@checkly --config=playwright.foo.config.ts" * @example "yarn playwright test" */ testCommand?: string; /** * Specific Playwright projects to run from your configuration. * Projects let you run tests in different browsers or with different settings. * * @example "chromium" * @example ["chromium", "firefox"] * @see {@link https://playwright.dev/docs/test-projects | Playwright Projects} */ pwProjects?: string | string[]; /** * Tags to filter which tests to run using Playwright's grep functionality. * Tests matching any of these tags will be executed. * * @example "@smoke" * @example ["@smoke", "@critical"] * @see {@link https://playwright.dev/docs/test-annotations#tag-tests | Playwright Test Tags} */ pwTags?: string | string[]; /** * Extra file patterns to bundle alongside the Playwright project. * * Test files and anything reachable through `import` are already bundled * via Playwright's project discovery and the import graph. Use `include` * only for non-code assets that specs read via `fs` at runtime, such as * markdown, JSON fixtures, or snapshots that aren't imported anywhere. * * Globs resolve relative to the directory of `playwrightConfigPath`. * * @example "fixtures/**\/*.json" * @example ["fixtures/**\/*.json", "docs/**\/*.md"] */ include?: string | string[]; /** * Name of the check group to assign this check to. * The group must exist in your project configuration. * * @deprecated Use {@link group} instead. Depending on load order, group * defaults may not work correctly when using {@link groupName} to attach the * check to a group. * @example "E2E Tests" * @example "Critical User Flows" */ groupName?: string; } /** * Creates a Playwright Check to run end-to-end tests using Playwright Test. * * Playwright check suites allow you to monitor complex user interactions and workflows * by running your existing Playwright test suites as monitoring checks. They support * multiple browsers, test filtering, and custom test commands. * * @example * ```typescript * // Basic Playwright check * new PlaywrightCheck('e2e-login', { * name: 'Login Flow E2E Test', * playwrightConfigPath: '../playwright.config.js', * frequency: Frequency.EVERY_10M, * locations: ['us-east-1', 'eu-west-1'] * }) * * // Advanced check with projects and tags * new PlaywrightCheck('critical-flows', { * name: 'Critical User Flows', * playwrightConfigPath: '../playwright.config.js', * installCommand: 'npm ci', * pwProjects: ['chromium', 'firefox'], * pwTags: ['@smoke', '@critical'], * // `include` is for non-code assets read via `fs` at runtime; * // imported files are bundled automatically. * include: ['fixtures/**\/*.json'], * groupName: 'E2E Tests', * frequency: Frequency.EVERY_5M * }) * ``` * * @see {@link https://www.checklyhq.com/docs/constructs/playwright-check/ | PlaywrightCheck API Reference} * @see {@link https://www.checklyhq.com/docs/detect/synthetic-monitoring/playwright-checks/overview/ | Playwright Checks Documentation} * @see {@link https://playwright.dev/ | Playwright Documentation} */ export declare class PlaywrightCheck extends RuntimeCheck { #private; installCommand?: string; testCommand?: string; playwrightConfigPath: string; pwProjects: string[]; pwTags: string[]; include: string[]; engine?: Engine; /** @deprecated Use {@link groupId} instead. Kept for compatibility with earlier versions. */ groupName?: string; constructor(logicalId: string, props: PlaywrightCheckProps); describe(): string; protected configDefaultsGetter(props: PlaywrightCheckProps): ConfigDefaultsGetter; protected validateDoubleCheck(diagnostics: Diagnostics): Promise; protected validateRetryStrategy(diagnostics: Diagnostics): Promise; protected validateHeadlessMode(diagnostics: Diagnostics): Promise; protected validateWebServerConfig(diagnostics: Diagnostics): Promise; protected validateBrowserInstallCommand(diagnostics: Diagnostics): void; validate(diagnostics: Diagnostics): Promise; getSourceFile(): string | undefined; static buildTestCommand(testCommand: string, playwrightConfigPath: string, playwrightProject?: string[], playwrightTag?: string[]): string; bundle(bundler: Bundler): Promise; synthesize(): { engine?: string | undefined; engineVersion?: string | undefined; checkType: string; doubleCheck: boolean; runtimeId: string | undefined; environmentVariables: import("./key-value-pair.js").default[] | undefined; activated: boolean | undefined; muted: boolean | undefined; shouldFail: boolean | undefined; locations: (keyof import("../index.js").Region)[] | undefined; privateLocations: undefined; tags: string[] | undefined; frequency: number | undefined; frequencyOffset: number | undefined; groupId: Ref | null; retryStrategy: import("./retry-strategy.js").LinearRetryStrategy | import("./retry-strategy.js").ExponentialRetryStrategy | import("./retry-strategy.js").FixedRetryStrategy | import("./retry-strategy.js").SingleRetryRetryStrategy | null | undefined; alertSettings: import("./alert-escalation-policy.js").AlertEscalation | undefined; useGlobalAlertSettings: boolean | undefined; runParallel: boolean | undefined; triggerIncident: { serviceId: Ref; severity: "MINOR" | "MEDIUM" | "MAJOR" | "CRITICAL"; name: string; description: string; notifySubscribers: boolean; } | undefined; description?: string | undefined; name: string; }; }