@currents/playwright
Setup and usage instructions for Playwright integration with Currents Dashboard
Requirements
NodeJS 14.0.0+
Playwright 1.22.2+
Setup
Install @currents/playwright
package
@currents/playwright
packageUpdate playwright.config.js|ts
playwright.config.js|ts
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.
Enabled traces, videos and screenshots in
playwright.config.js|ts
Using @currents/playwright
Choose the preferred usage method for @currents/playwright
pwc
CLI command - runsplaywright
with a predefined configuration.pwc-p
CLI command - runsplaywright
with orchestration.Alternatively, you can add
@currents/playwright
reporter toplaywright.config.ts
pwc
CLI command
pwc
CLI commandRun pwc
to create your first Playwright run in Currents dashboard.
Set the Record Key, and Project ID obtained from Currents dashboard.
Set
--ci-build-id
to a unique value for local testing. Learn more about CI Build ID for CI runs.
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.
@currents/playwright
reporter
@currents/playwright
reporterAlternatively, you can manually add the reporter to Playwright configuration and keep using playwright test
CLI command.
You can provide the required configuration as a parameter of currentsReporter
function or as environment variables.
With the reporter configured, you can run npx playwright test
to start sending the results to Currents dashboard. Learn more about CI Build ID.
Configuration
Configuring @currents/playwright
@currents/playwright
accepts configuration from the following sources:
environment variables, e.g.
CURRENTS_TAG=tagA,tagB
CLI command options, e.g.
npx pwc ---tag tagA --tag tagB
reading
currentsReporter
JS configuration object, e.g.reporters: [currentsReporter(options)]
Options
The following configuration options are available for both pwc
and pwc-p
:
--ci-build-id
the unique identifier for a run.
Environment variable:
CURRENTS_CI_BUILD_ID
JS configuration key:
ciBuildId?: string
-k, --key
your secret Record Key obtained from Currents.
Environment variable:
CURRENTS_RECORD_KEY
JS configuration key:
recordKey: string
-p, --project-id
the project ID for results reporting obtained from Currents.
Environment variable:
CURRENTS_PROJECT_ID
JS configuration key:
recordKey: string
-t, --tag
comma-separated tag(s) for recorded runs in Currents.
Environment variable:
CURRENTS_TAG
JS configuration key:
tag?: string[]
Released in version:
0.7.0
--pwc-remove-title-tags
remove tags from test names in Currents, e.g.
Test name @smoke
becomesTest name
in the dashboard (default: false). See Playwright Tags.Environment variable: n/a
JS configuration key:
removeTitleTags?: boolean = false
Released in version:
0.10.0
--pwc-disable-title-tags
disable parsing tags from test title, e.g.
Test name @smoke
would not have tagsmoke
in the dashboard (default: false). See Playwright Tags.Environment variable:
CURRENTS_DISABLE_TITLE_TAGS
JS configuration key:
disableTitleTags?: boolean = false
Released in version:
0.11.0
--pwc-cancel-after-failures <number | false>
abort the cloud run after the specified number of failed tests detected. Overrides the default Currents Project settings. If set, must be a positive integer or
false
to override automatic cancellations and project's Fail Fast Strategy. Also, see Canceling Runs andFail Fast StrategyEnvironment variable:
CURRENTS_CANCEL_AFTER_FAILURES
JS configuration key:
cancelAfterFailures?: number | boolean = undefined
Released in version:
0.11.0
--pwc-debug [boolean | "remote" | "full"]
enable collecting debug logs for the reporter (default: false).
true
will print the debug logs to stdoutremote
will upload the debug logs to Currents servers.full
will print the logs to stdout and also upload to Currents.
Environment variable:
CURRENTS_DEBUG=true | "remote" | "full"
JS configuration key:
debug?: boolean | "remote" | "full" = false
Released in version:
0.11.3
--pwc-output-file <path>
file path for run summary output in JSON format. The summary data TypeScript type definition is available:
Environment variable:
CURRENTS_OUTPUT_FILE=/path/to/file.json
JS configuration key:
outputFile?: string
Released in version:
1.2.0
-V, --version
show package version-h, --help
showpwc
help
pwc-p
specific flags:
--pwc-reset-signal <'SIGUSR1'|'SIGUSR2'>
specify a process signal to listen for to trigger a reset of the current in progress tests. Only avaiable on OSes with POSIX signal support.
Supported in CLI only
Released in version:
1.3.0
--pwc-skip-reporter-injection
Do no inject @currents/playwright reporter via CLI, use the reporter specified in the playwright config
Supported in CLI only
Released in version:
1.5.9
Overriding Configuration
Certain configuration values can have multiple sources, e.g. CLI fag and environment variables. Configuration values will resolve as follows:
first, the environment variable, if exists, otherwise
the corresponding CLI flag if exists, otherwise
currentsReporter
JS configuration object, otherwisethe default value, otherwise
throw if the configuration is mandatory
Examples
Run all tests in the current directory:
Run orchestration for all tests in the current directory:
Run only tests filtered by the tag "@smoke":
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 running enabling Playwright Parallelization.
Good To Know
Screenshots
By default, Playwright only captures screenshots at the end of a test, according to the provided screenshot option. Manually created screenshots are hidden by default and won't be attached to any test.
To send screenshots to Currents, they have to be attached to the test. For example, you can attach a screenshot to a test like this
For more information see the Playwright test info attachment documentation.
Limitations
Rerunning with the same CI build ID would generate a warning and new results would not be uploaded. Please use a new CI build ID.
Last updated