课程: End-to-End JavaScript Testing with Cypress.io

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Setting environment variables

Setting environment variables

- [Instructor] All right, so the next thing that we're going to take a look at is another very helpful thing to know when doing any kind of Cyprus testing, and that is how to set up and use environment variables. Right now, environment variables, just to show you what this might look like. Environment variables are certain points in our tests that will change depending on where our tests are running. So one example of this might be that maybe the paths that our different pages have in our application will change depending on whether our app is running locally or in production or on a dev server. So what you might see are things like this where we say CYPRESS and then we'll say something like, EXAMPLE_2_PATH. This is what's known as an environment variable. And among other things, it also gives us a place to specify things like secret keys or usernames and passwords If we have a site that we need to log into so that we don't have to specify things like passwords in our code and…

内容