This project contains automated tests for the [Swag Labs]https://saucedemo.com website. Test coverage includes the login, shopping cart and checkout flows.
Clone the repository Open the folder in your shell (such as bash or power shell) Run
npm install to install dependencies
Run
npx cypress runto run all tests
To run individual test suites
npx cypress run test --spec ".\cypress\e2e\test\[filename]"e.g.
for login
npx cypress run --spec .\cypress\e2e\test\login.cy.jsfor sorting
npx cypress run --spec .\cypress\e2e\test\sort.cy.jsfor Add to cart
npx cypress run --spec .\cypress\e2e\test\addToCart.cy.jsfor checkout
npx cypress run --spec .\cypress\e2e\test\checkout.cy.jsThe project is configured for cross browser testing. Tests run in Google Chrome by default but changing this to run in other browsers or multiple browsers is simple. User the '--browser' argument when running the test:
npx cypress run --browser [browser name]e.g.
npx cypress run --browser firefoxShopping cart checkout is tested with ramdom products. A randdom index is generated and used to select a product/(s) from the products list for each test.