@currents/playwright

Setup and usage instructions for Playwright integration with Currents Dashboard

Requirements

  • NodeJS 14.0.0+

  • Playwright 1.22.2+


Setup

Creating a new organization and a project at https://app.currents.dev, 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


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.

pwc command-line executable

  • 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 the Currents reporter to playwright.config.ts and use playwright test as usual.

pwc-p command-line executable

Use pwc-p run to orchestrate the full suite. When applying Playwright filters, run pwc-p discover first and pass the same discovery file to pwc-p run.

Filter tests, then orchestrate the discovered list:

  • pwc-p run reads configuration from currents.config.ts

  • Playwright filter flags belong on discover; runtime flags (-j, --timeout) belong on run

Manually Add Currents Reporter

You can manually add the Currents reporter to playwright.config.ts and use playwright test as usual.

  • 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:

Playwright Fixtures

Examples

  • Run all tests in the current directory:

  • Run orchestration for all tests in the current directory:

  • Run orchestration for tests filtered by the tag "@smoke":

  • Run only tests filtered by the tag "@smoke" (non-orchestrated):

  • Run playwright tests and add tags "tagA", "tagB" to the recorded run:

  • Provide playwright arguments and flags:

CI Examples

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

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

Last updated

Was this helpful?