Cypress · Junior · Question 49 of 75

How do you read environment-specific values in Cypress?

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.

Further reading

Problem with a question

Cypress · Junior · question 49

Test yourself

Take the Cypress · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz