Repository created with the purpose to storing the project used during the training of the cypress created by iLAB. Also store my steps using git history.
Cypress is a next generation front end testing tool built for the modern web. They address the key pain points developers and QA engineers face when testing modern applications. The final training project is to create some test cases for the My Store page. A common site used for automation testing courses.
- Register in website
- Buy 3 products
- Change product quantity in shopping car.
- cypress
- cypress-xpath
- prettier
- eslint
- cypress-real-events
- @faker-js/faker
- cypress-mochawesome-reporter
To run this project, you will need:
- git (I've used version
2.34.1while writing this doc) - nodejs (I've used version
v16.15.1while writing this doc) - NPM (I've used version
8.11.0while writing this doc)
Note: When installing nodejs, NPM is automatically installed too.
- Clone the repository
- Access the project folder
- Run
npm install(ornpm ifor the short version) to install the dev dependencies.
Before running the tests, some environment variables need to be set up.
Make a copy of the cypress.env.example.json file as cypress.env.json, and set the appropriate values for all the variables.
Note: cypress.env.json file is not tracked by git.
In this project, you can run tests in interactive and headless modes
Run npm test (or npm t for the short version) to run the test in headless mode.
Run npm run cy:browser + name of browser to run the test in headless mode om your preferred browser.
The test results should look like the below image.
Or, run npm run cy:open to open Cypress in interactive mode.
You can also run a specific suite test using tags.
Example:
# run test with tag '@login'
npx cypress run --env grepTags=@loginYou can skip running the tests with specific tag, using the not option: prefix the tag with -.
npx cypress run --env grepTags=-@loginYou can repeat (burn) the filtered tests to make sure they are flake-free
npx cypress run --env grepTags=@login,burn=5You can pass the number of times to run the tests via environment name burn or grepBurn or grep-burn.
If you do not specify the "grep" or "grep tags" option, the "burn" will repeat every test.



