@currents/playwright
Setup and usage instructions for Playwright integration with Currents Dashboard
Requirements
NodeJS 18.17.0+
Playwright 1.40.1+
Playwright 1.60.0+ requires @currents/playwright 2.0.0+. See Compatibility Guide.
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/playwrightCreate 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!,
projectId: process.env.CURRENTS_PROJECT_ID!,
};
export default config;Update playwright.config.js|ts
Enable traces, videos and screenshots in playwright.config.js|ts
Usage
Choose the preferred usage method. See details below.
pwccommand-line executable.Run
pwc testinstead ofplaywright testpwcautomatically configures Playwright to work with CurrentsKeep Currents configuration in
currents.config.ts
Manually add Currents Reporter.
Explicitly add Currents reporter to
playwright.config.tsRun
playwright testas usualKeep Currents configuration in
currents.config.ts
pwc-pcommand-line executable for orchestration.Run
pwc-p runto orchestrate tests across CI machinesRun
pwc-p discoverwhen filtering the suite (--grep,--last-failed,--project, spec paths)Required to enable Playwright Orchestration
pwc command-line executable
pwcreads configuration fromcurrents.config.tsRun
pwcto start recording Playwright runs to Currents.Learn more about CI Build ID.
See pwc reference documentation.
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.
Full suite (discovery optional):
Filtered tests (discovery required):
pwc-p runreads configuration fromcurrents.config.tsPlaywright filter flags belong on
discover; runtime flags (-j,--timeout) belong onrun
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.tsfile. See additional configuration options Configuration.Run
npx playwright testto 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:
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
playwrightarguments 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?