In order to run the automated test suite, please follow the steps described below:
-
If this is the first time cloning the repository, execute the following command in the project's terminal:
npm install -
Execute the command
cp cypress/config/secrets-example.json cypress/config/secrets.jsonand replace the content incypress/config/secrets.jsonwith your proper credentials
- If you want to record your local runs to the cloud, run
source cypress/config/set-key.sh
-
Run one of the commands below depending on which environment needs to be tested
-
To execute the tests using the Test Runner (does not generate reports)
npx cypress open --env envKey=devnpx cypress open --env envKey=uat
-
To execute the testing headless (generates the reports)
npx cypress run --env envKey=devnpx cypress run --env envKey=uat
-
-
To generate the mochawesome complete report, first execute the tests headless and afterwards run the command:
npm run awesome-report
Additional options available
- To record the tests into the Cypress Dashboard
CYPRESS_PROJECT_ID={projectId} CYPRESS_RECORD_KEY={record key} npx cypress run --record - To choose a specific test file
npx cypress run --spec cypress/{SPEC FILE PATH} - To choose a pattern of files into the Test Runner
npx cypress open testFiles='cypress/tests/e2e/hero*' - If the DB test throws an error such as:
ER_NOT_SUPPORTED_AUTH_MODE, as seen in, run the following commands: -sudo mysql -u root -p-mysql> ALTER USER the_user IDENTIFIED WITH mysql_native_password BY 'the_password';