- Local Setup
- Github Setup
npm install
Before running the tests locally, it requires to have a .env created, this file can be personalized for each person using the project, this file is not pushed to project repository, its on gitignore.
.env
BROWSER_NAME=chrome
BASE_WEB_URL=https://www.saucedemo.com
LOGIN_PASSWORD=
More information about how .env works together with Cypress, check out the following docs:
https://nodejs.org/dist/latest-v8.x/docs/api/processhtml#process_process_env
https://docs.cypress.io/api/cypress-api/env#Syntax
https://www.npmjs.com/package/dotenv
https://www.npmjs.com/package/cypress-dotenv
BASE_WEB_URL (The environment URL used for the tests, this project is testing at this sample website from Sauce Labs https://www.saucedemo.com)
BROWSER_NAME (Usually chrome but can be firefox, edge or electron)
LOGIN_PASSWORD (Password for the users used for the automation, this can be found at https://www.saucedemo.com home page (On real world scenario, only the project owners must have access to this value and this value must be stored only on github secrets variable)
TODO
Cypress can be executed using its UI, for that, just use the bellow command, a window will be opened, choose the testing type, next, choose the desired browser and click on a spec file to start test execution.
npx cypress open
There is also NPM scripts created to easily trigger cypress execution through command line, take a look at package.json to see all available scripts.
npm run <NPM_SCRIPT>
For example, executing only login spec:
More information about running cypress can be found at official documentation https://docs.cypress.io/guides/guides/command-line
TODO
Github uses the same variables as local execution plus a few extra more to personalize pipeline workflow and docker image, it is just like executing locally, the main difference is that .env is created automatically at install job based on all varibles at Project Settings > Environments > Environment secrets.
TODO
TODO
TODO
TODO
TODO