From the course: End-to-End JavaScript Testing with Cypress.io
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Environment variables
From the course: End-to-End JavaScript Testing with Cypress.io
Environment variables
- [Instructor] One thing that's very helpful to know when doing any kind of testing, is how to set and use environment variables. Environment variables are places in our tests that will change depending on where our tests are running. And this allows us to do things like change the URL that our tests visit, depending on whether or not our tests are running on our development server, our staging server, or our production server. And if done the right way, it also gives us a place to specify things like secret keys, since we definitely don't want to have our secret keys committed and pushed up to our git repo. So, Cypress provides us with several different ways that we can define environment variables for our end-to-end tests. The first way is by adding the environment variables directly to your machine. To do this, open up a terminal, again I like to use VS Code's built in terminal, and if you're on a Linux-based machine such…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.