Currents Documentation
Currents.devGitHubChangelog
  • Getting Started
    • What is Currents?
    • Playwright
      • Playwright: Quick Start
      • Troubleshooting Playwright
    • Cypress
      • Your First Cypress Run
      • Integrating with Cypress
        • Compatibility
        • Alternative Cypress Binaries
      • Troubleshooting Cypress
    • Jest
      • Your First Jest Run
      • Detox + Jest
      • Troubleshooting Jest
    • Others
    • CI Setup
      • GitHub Actions
        • Cypress - GitHub Actions
        • Playwright - GitHub Actions
        • Jest - GitHub Actions
        • Node.js - GitHub Actions
        • Commit data for GitHub Actions
        • Custom Docker runners
        • Named Runners
      • GitLab
        • Cypress - GitLab CI/CD
        • Playwright - GitLab CI/CD
        • Custom Docker runners
      • Jenkins
        • Cypress - Jenkins
        • Playwright - Jenkins
      • CircleCI
        • Cypress - CircleCI
        • Playwright - CircleCI
      • Bitbucket
        • Cypress - Bitbucket Pipelines
      • Azure DevOps
        • Cypress - Azure DevOps
        • Playwright - Azure DevOps
      • AWS Code Build
        • Cypress - AWS Code Build
        • Playwright - AWS Code Build
      • NX
        • Playwright - NX
        • Cypress - NX
  • Guides
    • Record Key
    • CI Build ID
    • Reporting
      • Reporting Strategy
      • Reporting in CI
      • Step-Level Reporting
    • CI Optimization
      • Playwright Parallelization
      • Orchestration Setup
      • Fully Parallel Mode
      • Re-run Only Failed Tests
      • Cloud Spot Instances
      • Failing Fast
      • Load Balancing
    • Code Coverage
      • Code Coverage for Playwright
      • Code Coverage for Cypress
    • Currents Actions
      • Setup Currents Actions
      • Using Currents Actions
      • Reference
        • Conditions
        • Actions
    • Playwright Component Testing
    • Playwright Visual Testing
    • Playwright Annotations
    • Playwright Tags
    • MCP Server
  • Dashboard
    • Projects
      • Projects Summary view
      • Project Settings
      • Archive and Unarchive Projects
    • Runs
      • Run Status
      • Run Details
      • Commit Information
      • Tags
      • Run Timeouts
      • Cancelling Runs
      • Deleting Runs
      • Run Progress
    • Tests
      • Spec File Status
      • Test Status
      • Flaky Tests
      • Test History
    • Test Suite Explorer
      • Test Explorer
        • Tests Performance
      • Spec Files Explorer
        • Spec Files Performance
      • Errors Explorer
  • Automated Reports
  • Insights and Analytics
  • Administration
    • Email Domain Based Access
    • SSO SAML2.0
      • SAML2.0 Configuration
      • SCIM User Provisioning
      • IdP-initiated Sessions
      • JumpCloud
        • JumpCloud User provisioning
      • Okta
        • Okta User provisioning
      • Troubleshooting SSO
    • Billing & Usage
  • Billing and Pricing
  • Resources
    • Reporters
      • cypress-cloud
        • Batched Orchestration
        • Migration to Cypress@13
      • @currents/cli
      • @currents/playwright
        • Configuration
        • pwc
        • pwc-p (orchestration)
        • Playwright Fixtures
      • @currents/jest
      • @currents/node-test-reporter
      • @currents/cmd
        • currents api
        • currents upload
        • currents cache
        • currents convert
      • Data Format Reference
    • Integrations
      • GitHub
        • GitHub App
        • GitHub OAuth
      • GitLab
      • Slack
      • Microsoft Teams
      • HTTP Webhooks
      • Bitbucket
    • API
      • Introduction
      • Authentication
      • API Keys
      • Errors
      • Pagination
      • API Resources
        • Instances
        • Runs
        • Projects
        • Spec Files
        • Test Signature
        • Test Results
    • Data Privacy
      • Access to Customer Data
      • Data Retention
      • Cloud Endpoints
    • Support
Powered by GitBook
On this page
  • Requirements
  • Setup
  • Install @currents/playwright
  • Create currents.config.ts
  • Update playwright.config.js|ts
  • Usage
  • pwc command-line executable
  • Manually Add Currents Reporter
  • Configuration
  • Fixtures
  • Examples
  • CI Examples

Was this helpful?

  1. Resources
  2. Reporters

@currents/playwright

Setup and usage instructions for Playwright integration with Currents Dashboard

Previous@currents/cliNextConfiguration

Last updated 5 days ago

Was this helpful?

Requirements

  • NodeJS 14.0.0+

  • Playwright 1.22.2+


Setup

Creating a new organization and a project at , you'll see on-screen instructions with your newly created Project ID and Record Key.

Install @currents/playwright

npm i -D @currents/playwright

Create currents.config.ts

Create currents.config.(m|j|t)s configuration file.

  • Set the Record Key, and Project ID obtained from Currents dashboard.

  • Learn more about CI Build ID.

import { CurrentsConfig } from "@currents/playwright";

const config: CurrentsConfig = {
  recordKey: process.env.CURRENTS_RECORD_KEY || throw new Error("oh no!"),
  projectId: process.env.CURRENTS_PROJECT_ID
};

export default config;

Update playwright.config.js|ts

Enabled traces, videos and screenshots in playwright.config.js|ts

use: {
    // ...
    trace: "on",
    video: "on",
    screenshot: "on",
}

Usage

Choose the preferred usage method. See details below.

  • pwc command-line executable.

    • Run pwc test instead of playwright test

    • pwc automatically configures Playwright to work with Currents

    • Keep Currents configuration in currents.config.ts

  • Manually add Currents Reporter.

    • Explicitly add Currents reporter to playwright.config.ts

    • Run playwright test as usual

    • Keep Currents configuration in currents.config.ts

  • pwc-p command-line executable for orchestration.

    • See Orchestration Setup.

    • See pwc-p (orchestration)

pwc command-line executable

npx pwc --key RECORD_KEY --project-id PROJECT_ID --ci-build-id hello-currents
  • pwc reads configuration from currents.config.ts

  • Run pwc to start recording Playwright runs to Currents.

  • Learn more about CI Build ID.

  • See pwc reference documentation.

Using pwc command overrides the reporters configured in playwright.config.ts - you can specify additional reporters using --reporter flag. Alternatively, you can explicitly add currents reported in the Playwright configuration as appears below.

Manually Add Currents Reporter

You can manually add Current sreporter to playwright.config.ts and keep using playwright test CLI command.

// playwright.config.ts
import { defineConfig, devices, PlaywrightTestConfig } from "@playwright/test";
import { 
  CurrentsFixtures,
  CurrentsWorkerFixtures,
  currentsReporter
} from "@currents/playwright";

export default defineConfig<CurrentsFixtures, CurrentsWorkerFixtures>({
  // ...
  reporter: [currentsReporter()], // 👈🏻 add Currents reporter
})
  • The reporter reads the configuration from currents.config.ts file. See additional configuration options Configuration.

  • Run npx playwright test to start sending the results to Currents dashboard.

  • Learn more about CI Build ID.


Configuration

Numerous configuration options are available. See Configuration.


Fixtures

The package also provides additional fixtures for Playwright that support various features:

  • Code Coverage for Playwright

  • Currents Actions


Examples

  • Run all tests in the current directory:

pwc --key <record-key> --project-id <id>    
  • Run orchestration for all tests in the current directory:

pwc-p --key <record-key> --project-id <id> --ci-build-id <build-id>
  • Run only tests filtered by the tag "@smoke":

pwc --key <record-key> --project-id <id> --grep smoke
  • Run playwright tests and add tags "tagA", "tagB" to the recorded run:

pwc --key <record-key> --project-id <id> --tag tagA --tag tagB
  • Provide playwright arguments and flags:

pwc --key <record-key> --project-id <id> -- --workers 2 --timeout 10000 --shard 1/2

CI Examples

Check out the example repositories that showcase running Playwright tests on popular CI providers and recording the results to Currents:

  • Playwright - GitHub Actions

  • Playwright - GitLab CI/CD

  • Playwright - Jenkins

  • Playwright - CircleCI

  • Playwright - AWS Code Build

  • Playwright - Azure DevOps

Explore how to speed up CI Playwright runs by enabling Playwright Parallelization.

Required to enable .

https://app.currents.dev
Playwright Fixtures
Playwright Orchestration