May I know what is the equivalent of the cypress.env()
in playwright.
We have below line of code in yml file in Cypress
CYPRESS_test_suite: 'Smoke tests'
Then in 1 of our spec file we have this line of code
const test_suite = Cypress.env('test_suite')
I would like to do it also in playwright but I am not able to find any references.
2
Answers
According to docs, you can use process
.env
variables:or
if you want to use the variable from cypress env
If you are trying to tag your tests, for example as a ‘smoke_test’, Playwright has other ways to support this beyond
process.env.{variable}
with thetag
attribute.which can then be ran with
npx playwright test --grep @smoke
and will be appropriately tagged for filtering in subsequent test reports.
This is available in Playwright versions >= 1.4.2.