I'm using API from this site: https://gorest.co.in/
Following this guide to setup and run API tests
Install Node on your machine. Check node version in .nvmrc file Next step,
git clone https://github.com/longnv1995/rest-api-automation-cypress.git
cd rest-api-automation-cypress
cp .env.example .env
Then, Login https://gorest.co.in/ and generate a token as lifetime Replace token in .env file with generated token in pre-con step
Finally, install all dependencies
npm i
- To run all tests in production environment
npm run cy:run:prod
- To run tests in browser (UI)
npm run cy:open:prod
See other commands in package.json file
Currently, we're assumming that, dev and staging envs are available That's the reason why I created two files, development.config.js and staging.config.js
- Run test in parallel
- Run smoke test/regression test
- Run on different environments such as dev, staging, prod
- Setup and run tests with CI/CD pipeline
- Integrate with Cypress cloud
- More...