Cypress · Junior · Question 49 of 75
How do you read environment-specific values in Cypress?
- 1
Cypress.env('API_URL') - 2
cy.env.get('API_URL') - 3
process.env.API_URLin the spec
Show the answer
Correct answer: Cypress.env('API_URL')
Explanation
Env values come from config, cypress.env.json, CYPRESS_ variables or --env. Specs run in the browser, so process.env isn't available there.