Environments
How to label and filter Currents runs by environment (e.g. staging, production)
An environment is a label that describes where or under which conditions a test run was executed — for example staging, production, preview, or a CI matrix dimension such as a target region or device pool. Attaching an environment lets you compare and filter results across deployment targets without mixing them into the same metrics.
Common uses:
Separate staging vs production smoke runs in the same project.
Compare stability of the same suite across regions (e.g.
us-east,eu-west).Slice Analytics (run status, duration, flakiness, test results) by deployment target.

Environments vs. Tags
Both classify runs, but they serve different purposes:
Cardinality
One value per run or per Playwright project
Many values per run/group/test
Intent
Where the tests ran (deployment target)
Arbitrary classification (feature, team, lifecycle)
Source
Reporter config / project metadata
Test titles, project metadata, run config
A run can still end up with multiple environments when different Playwright projects within the same run set different values — see How environments aggregate to a run below.
Setting the environment
The environment is a run-level value, with an optional per-project override. It can be provided through any of the standard configuration sources.
currents.config.ts
CURRENTS_ENVIRONMENT environment variable
--pwc-environment CLI option
Supported by pwc, pwc-p discover, and pwc-p run:
Inline reporter option
Per-project override
Set metadata.pwc.environment on a Playwright project to override the run-level environment for that project only:
Precedence of configuration options
When the environment is defined in more than one place, Currents resolves the value as follows (highest priority first):
Per-project
projects[].metadata.pwc.environment, if set for the project;Otherwise the run-level value:
CURRENTS_ENVIRONMENTenvironment variable, if provided; otherwise--pwc-environmentCLI option, if provided; otherwiseenvironmentfrom the inline reporter options inplaywright.config.ts; otherwiseenvironmentfromcurrents.config.ts; otherwiseno environment is attached.
How environments aggregate to a run
The environment is resolved per Playwright project and attached to the corresponding group when results are reported. At the run level, Currents collects the distinct environments from all groups into a list.
For the per-project example above, the resulting run is associated with both staging and production, and shows up when filtering by either value:
Run
staging, production
Group chromium
staging
Group firefox
production
If every project shares the same value (or you only set a run-level value), the run is associated with that single environment.
Filtering in the Dashboard
Once runs carry an environment, an Environment filter is available in the Runs and across Analytics. Selecting one or more environments narrows every metric on the page to runs that ran in those environments.
Filtering via the REST API
Both the runs and insights endpoints accept an environments[] query parameter (repeat it to pass multiple values). Runs that match any of the supplied environments are returned.
See the API reference for the full list of query parameters.
Last updated
Was this helpful?