Cypress Usage and Configuration
Last updated
Last updated
Software testing encompasses various levels to thoroughly inspect the product from different perspectives, increasing the likelihood of detecting defects. While end-to-end testing is crucial, it only addresses a single layer of testing and typically detects less than 10% of errors within a product. However, this approach has been selected to automate user experiences within processes and identify potential failures that could disrupt the process flow.
The package.json
file within the project facilitates the installation of all necessary packages and dependencies for automation. Below is a sample configuration:
{
"name": "qa_ps",
"version": "1.0.0",
"description": "QA automation",
"main": "index.js",
"scripts": {
"cypress:open": "cypress open",
"cypress:run": "cypress run --browser chrome",
"generate:report": "npx mochawesome-merge 'cypress/results/*.json' > mochawesome.json && npx marge mochawesome.json",
"cypress:run:report": "cypress run --browser chrome --config-file cypress.config.js && npx mochawesome-merge 'cypress/results/*.json' > mochawesome.json && npx marge mochawesome.json",
"delete:reports": "rm -rd cypress/results/* || true && rm mochawesome.json && rm -rd mochawesome-report",
"complete:execution": "npm run delete:reports && npm run cypress:run:report"
},
"keywords": ["automation"],
"author": "",
"license": "ISC",
"devDependencies": {
"cypress": "^13.6.3",
"@cypress/grep": "^4.0.1",
"cypress-file-upload": "^5.0.8",
"mochawesome": "^7.1.3",
"mochawesome-merge": "^4.3.0",
"mochawesome-report-generator": "^6.2.0"
},
"dependencies": {
"cypress-iframe": "^1.0.1"
}
}
The Cypress automation project should adhere to the following basic folders and file structure:
cypress/
fixtures/
integration/
plugins/
support/
node_modules/
cypress.json
package.json
This structure ensures organization and clarity within the project, facilitating efficient development and maintenance of automated tests.