Search code examples
javascriptyamlplaywright

What is the equivalent of Cypress.env() in playwright


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.


Solution

  • According to docs, you can use process .env variables:

    const test_suite = process.env.VARIABE_NAME // e.g. 'test_suite'
    

    or

    const test_suite = process.env.CYPRESS_VARIABLE_NAME
    

    if you want to use the variable from cypress env