Test automation project for the I-Tallent session using Cypress.
- Basic info
- How to Configure
- How to run
before starting on the project you'll need to run the 'npm install' command to install all needed dependencies. Once you have done that it is possible to use the predefined scripts in package.json. The 'local' script profile is used for local debugging not for actually running the tests, since we would like to do that headless.
In the project we are using specs, and pre-configured scripts (examples, project). These scripts use a folder, and it runs all tests within that folder.
in the package.json you will be able to find the run scripts under the script tag. Once there you'll notice that different profiles will result in a different result. Chaining scripts is also possible by using 'npm otherScriptName'.
{
"scripts": {
"cypress-open": "npx cypress open --config-file cypress.json",
"cypress-run-project": "npm run clean-data && npm run run-project",
"cypress-run-examples": "npm run clean-data && npm run run-examples",
"run-project": "npx cypress run --config-file cypress.json --spec \"cypress/integration/project/*.js\"",
"run-examples": "npx cypress run --config-file cypress.json --spec \"cypress/integration/examples/*.js\"",
"clean-data": "npm run clean-report && npm run clean-videos && npm run clean-screenshots",
"clean-report": "rm -rf ./cypress/reports",
"clean-videos": "rm -rf ./cypress/videos",
"clean-screenshots": "rm -rf ./cypress/screenshots"
}
}
The most important is the usage of environment parameters which allows you to set certain environmental values. These environment parameters can be chained by comma separation.
The way we use them in this project is to:
- choose which tests to run (project, examples)
- choose which config to run (dev, acc, prod)