This project is used to PetStoreRestAPI automation test using Cypress with Javascript.
Install the items bellow:
- NodeJS (last version)
- Visual Code (last version)
- Cypress (version 3.8.3)
Get clone this project to your computer and execute the commands bellow:
- Open terminal.
- Execute cd 'to the your paste' (Ex: name_your_paste).
cd petstorerestapi-cypress-js
- On paste, execute the command in terminal.
npm run cypress:open
or
./node_modules/.bin/cypress open
- Done! The painel cypress is opened to execute the tests.
- User
- POST /user/createWithArray
- POST /user/createWithList
- GET /user/{username}
- PUT /user/{username}
- DELETE /user/{username}
- GET /user/login
- GET /user/logout
- POST /user
Link (back-end)
https://petstore.swagger.io/v2
To execute the tests on terminal, execute the commands, bellow:
- On terminal, under the paste the project, execute the command in terminal, bellow:
- To execute all tests and view results on terminal, execute the command:
npm run cypress:run -- --spec cypress
- To execute only a tests and view result on screen, execute the command (alter the name file on command, ex: loginTest.spec.js):
npm run cypress:run -- --spec cypress/integration/userTest.spec.js
- To execute one test and view result on screen (without closing the screen), execute the command (alter the name file on command, ex: userTest.spec.js):
npm run cypress:run -- --spec cypress/integration/userTest.spec.js --headed --no-exit
- To execute tests in browser Chrome, execute the command (alter the name file on command, ex: userTest.spec.js):
npm run cypress:run -- --spec cypress/integration/userTest.spec.js --headed --no-exit
- To execute all specs tests, execute the command(alter the name of integration, ex: barriga to barriga-cy-test):
./node_modules/.bin/cypress run -- --spec cypress/integration/barriga/**/*
- To execute all specs tests (mac or windows), execute the command (alter the name of integration, ex: barriga to barriga-cy-test):
./node_modules/.bin/cypress run -- --spec cypress/integration/userTest.spec.js --browser chrome