@checkly/playwright-reporter

中文文档
1.15.0发布于 2026/10/26Apache-2.0TypeScriptCommonJS近 30 天下载 3.2万

Standalone Playwright reporter for Checkly - compatible with Playwright 1.40-1.64+

原始使用文档
文档目录21 节
  1. Installation
  2. Quick Start
  3. 1. Get Your Credentials
  4. 2. Configure Playwright
  5. 3. Set Environment Variables
  6. 4. Run Tests
  7. Configuration Options
  8. Environment Variables
  9. What Gets Uploaded
  10. Secret Scrubbing
  11. Flaky Test Detection
  12. Running Locally (No Upload)
  13. Dry Run Mode
  14. CI/CD Integration
  15. GitHub Actions
  16. GitLab CI
  17. Multiple Reporters
  18. Understanding Test Sessions
  19. Security
  20. Documentation
  21. License

@checkly/playwright-reporter

Official Playwright reporter for Checkly. Automatically upload test results, screenshots, videos, and traces to gain visibility into your end-to-end tests.

Fully compatible with Playwright's built-in JSON reporter - use it as a drop-in replacement that adds Checkly integration.

Installation

npm install --save-dev @checkly/playwright-reporter

Requirements:

Quick Start

1. Get Your Credentials

  1. Go to Account Settings > General to find your Account ID
  2. Go to User Settings > API Keys to create an API key

2. Configure Playwright

Add the reporter to your playwright.config.ts:

import { defineConfig } from '@playwright/test';
import { createChecklyReporter } from '@checkly/playwright-reporter';

export default defineConfig({
  reporter: [
    ['list'],
    createChecklyReporter(),
  ],
});

Tip: Using createChecklyReporter() provides full intellisense for configuration options. Alternatively, use the array syntax: ['@checkly/playwright-reporter', { ... }]

3. Set Environment Variables

export CHECKLY_API_KEY=your_api_key
export CHECKLY_ACCOUNT_ID=your_account_id

Or pass them inline:

CHECKLY_API_KEY=... CHECKLY_ACCOUNT_ID=... npx playwright test

4. Run Tests

npx playwright test

You'll see a session URL in the output:

View test results: https://app.checklyhq.com/test-sessions/abc123

[...test execution...]

✓ Check the results: https://app.checklyhq.com/test-sessions/abc123

Configuration Options

import { createChecklyReporter } from '@checkly/playwright-reporter';

createChecklyReporter({
  outputDir: 'test-results',
  sessionName: 'My Test Suite',
  dryRun: false,
  verbose: false,
  showProgress: true,
  showSummaryTable: true,
})
OptionTypeDefaultDescription
apiKeystringCHECKLY_API_KEY env varCheckly API key
accountIdstringCHECKLY_ACCOUNT_ID env varCheckly account ID
outputDirstringPlaywright's outputDirDirectory for assets, JSON, and ZIP
sessionNamestring | functionAuto-generatedCustom session name
dryRunbooleanfalseCreate ZIP without uploading
verbosebooleanfalseEnable debug logging
showProgressbooleantrueShow real-time test progress in the terminal
printStepsbooleanfalsePrint individual test steps (requires showProgress)
showSummaryTablebooleantrueShow per-project breakdown table after the run
scrubbingobject | falseSee Secret ScrubbingConfigure secret scrubbing for reports and traces
testCommandstringAuto-detectedOverride the test command shown in the Checkly UI
webVitalsbooleanfalseCollect Core Web Vitals (LCP, CLS, INP, FCP, TTFB, TBT) by instrumenting browser contexts; results appear in the Checkly report. On by default when running on Checkly's runners

Output files (written to outputDir):

  • checkly-report.json - JSON test report
  • checkly-report.zip - ZIP archive with report and assets

Environment Variables

VariableDescription
CHECKLY_API_KEYYour Checkly API key
CHECKLY_ACCOUNT_IDYour Checkly account ID
CHECKLY_REPORTER_VERBOSESet to true for detailed debug output
CHECKLY_REPORTER_DRY_RUNSet to true to skip uploading
CHECKLY_REPORTER_OUTPUT_DIROverride the output directory
CHECKLY_REPORTER_SHOW_SUMMARY_TABLESet to false to hide the summary table
CHECKLY_REPORTER_WEB_VITALSSet to false to disable Core Web Vitals collection (kill switch; vitals are on by default on Checkly's runners)
CHECKLY_TEST_COMMANDOverride the test command shown in the Checkly UI

Environment variables take precedence over options passed in the config.

What Gets Uploaded

  • Test results and status (passed/failed/flaky)
  • Execution duration and timing
  • Screenshots (on failure or explicit capture)
  • Video recordings
  • Playwright traces
  • Console logs and network requests (extracted from traces)

Secret Scrubbing

The reporter automatically scrubs sensitive values from JSON reports, trace files, attachments and logs before upload.

By default, any environment variable whose name starts with CHECKLY_SECRET_ is scrubbed. You can configure additional scrubbing strategies:

createChecklyReporter({
  scrubbing: {
    envVars: ['DB_PASSWORD', 'STRIPE_KEY'],
    autoDetect: true,
    prefix: 'CHECKLY_SECRET_',
    replacement: '[REDACTED]',
  },
})
OptionTypeDefaultDescription
envVarsstring[][]Environment variable names whose runtime values should be scrubbed
autoDetectbooleanfalseScrub env vars matching common secret patterns (SECRET, KEY, TOKEN, PASSWORD, CREDENTIAL, AUTH, PRIVATE, API)
prefixstring | false | null'CHECKLY_SECRET_'Scrub all env vars starting with this prefix. Set to false or '' to disable
replacementstring'*********'Custom replacement string for scrubbed values
unscrubbableTraces'reject' | 'upload''reject'What to do with a trace whose secrets can't be scrubbed completely: 'reject' leaves it out of the upload, 'upload' uploads it as recorded, secrets included, and logs a warning

Set scrubbing: false to disable scrubbing entirely.

Flaky Test Detection

The reporter automatically detects flaky tests:

  • Flaky test: A test that failed initially but passed after retry
  • Degraded status: Set when there are flaky tests but no complete failures
  • Overall status: passed if all tests eventually pass, failed otherwise

Running Locally (No Upload)

For local development without uploading to Checkly:

# Simply don't set CHECKLY_API_KEY or CHECKLY_ACCOUNT_ID
npx playwright test

What happens:

  • The reporter prints that credentials are missing and skips the upload
  • Tests run normally
  • With outputDir set, the reporter writes a scrubbed checkly-report.json there

To get checkly-report.zip locally, use dry run mode.

Dry Run Mode

Create local JSON and ZIP files without uploading:

createChecklyReporter({
  dryRun: true,
})

Conditional dry run (skip uploads when no credentials):

createChecklyReporter({
  dryRun: !process.env.CHECKLY_API_KEY,
})

CI/CD Integration

GitHub Actions

name: Playwright Tests
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      - name: Install dependencies
        run: npm ci

      - name: Install Playwright browsers
        run: npx playwright install --with-deps

      - name: Run Playwright tests
        env:
          CHECKLY_API_KEY: ${{ secrets.CHECKLY_API_KEY }}
          CHECKLY_ACCOUNT_ID: ${{ secrets.CHECKLY_ACCOUNT_ID }}
        run: npx playwright test

GitLab CI

test:
  image: mcr.microsoft.com/playwright:v1.57.0-jammy
  stage: test
  script:
    - npm ci
    - npx playwright test
  variables:
    CHECKLY_API_KEY: $CHECKLY_API_KEY
    CHECKLY_ACCOUNT_ID: $CHECKLY_ACCOUNT_ID

Setting up variables:

  1. Go to your GitLab project
  2. Navigate to Settings > CI/CD > Variables
  3. Add CHECKLY_API_KEY (check "Mask variable")
  4. Add CHECKLY_ACCOUNT_ID (check "Mask variable")

Multiple Reporters

Combine with other Playwright reporters:

import { createChecklyReporter } from '@checkly/playwright-reporter';

export default defineConfig({
  reporter: [
    createChecklyReporter(),
    ['html', { outputFolder: 'playwright-report' }],
    ['list'],
    ['junit', { outputFile: 'test-results/junit.xml' }],
  ],
});

Understanding Test Sessions

The reporter creates suite-level test sessions, not individual test file results.

When you run npx playwright test:

  1. One test session is created, named after your directory
  2. One test result for the entire run
  3. All assets uploaded together in a single ZIP file

Benefits:

  • Consolidated view of your entire test suite
  • Efficient storage
  • Track overall pass/fail rates over time

Security

Always use environment variables for credentials. Never commit API keys to version control.

// DON'T DO THIS
createChecklyReporter({
  apiKey: 'chk_api_...',  // Hardcoded credentials!
})

// DO THIS
createChecklyReporter()  // Reads from environment

Use the Secret Scrubbing feature to ensure sensitive values don't leak into uploaded reports and traces.

Documentation

For detailed documentation, visit checklyhq.com/docs/detect/testing/playwright-reporter.

License

Apache 2.0

版本与发布记录

@checkly/playwright-reporter 共发布 99 个版本,首次发布于 2025/10/21;过去 12 个月发布了 87 个版本。

版本发布日期距今
1.15.0latest2026/10/2614 天前
1.15.0-pre-ea31d8d1pre2026/10/2614 天前
1.14.02026/10/1525 天前
1.13.22026/06/174 个月前
1.13.2-pre-54dde572026/06/174 个月前
1.13.12026/06/124 个月前

其他发布通道:alpha → 0.0.9-alpha,beta → 0.1.0-beta,legacy → 0.1.5,pre → 1.15.0-pre-ea31d8d1。

关于 @checkly/playwright-reporter 的常见问题

@checkly/playwright-reporter 是什么?

Standalone Playwright reporter for Checkly - compatible with Playwright 1.40-1.64+

如何安装 @checkly/playwright-reporter?

在项目目录运行 npm install @checkly/playwright-reporter,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@playwright/test(>=1.40.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@checkly/playwright-reporter 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@checkly/playwright-reporter 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@checkly/playwright-reporter 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^20.19.0 || >=22.12.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@checkly/playwright-reporter 可以商用吗?

@checkly/playwright-reporter 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@checkly/playwright-reporter 的下载量有多少?

根据 npm 官方下载统计,@checkly/playwright-reporter 在 2026/10/10 – 2026/11/08 这 30 天内被下载 32,101 次,日均约 1,070 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@checkly/playwright-reporter 还在维护吗?

最新版本 1.15.0 发布于 2026/10/26(14 天前);至今共发布 99 个版本,其中过去 12 个月发布了 87 个;首次发布于 2025/10/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。