Cypress Quiz https://automationstepbystep.com/quiz...
Cypress Udemy Course https://bit.ly/3wJAdjq
1. How to install mochawesome reporter
2. How to configure the reporter
3. How to merge multiple JSON report files
4. How to generate a single HTML report
5. Troubleshooting issues like
Unexpected token in JSON at position 0
Unexpected end of JSON input
6. Run reports command automatically using
pretest and posttest scripts in package.json
Step 1 Install mochawesome library
npm install mochawesome savedev
Step 2 Install mochawesomemerge library
npm install mochawesomemerge savedev
Step 3 Add reports configuration in cypress.json
{
"reporter": "mochawesome",
"reporterOptions": {
"charts": true,
"overwrite": false,
"html": false,
"json": true,
"reportDir": "cypress/report/mochawesomereport"
}
}
Step 4 Run command to execute tests
npx cypress run reporter mochawesome
Step 5 Run command to merge multiple json reports into one
npx mochawesomemerge cypress/report/mochawesomereport/*.json cypress/report/output.json
npx mochawesomemerge cypress/report/mochawesomereport/*.json | outfile encoding ascii cypress/report/output.json
Step 6 Run command to generate html report
npx marge cypress/report/output.json reportDir ./ inline
Add report generation commands
in package.json scripts
pretest
test
posttest
#CypressBeginnerTutorials
Stories by Raghav https://automationstepbystep.com/stor...
You can support my mission for education by sharing this knowledge and helping as many people as you can
If my work has helped you, consider helping any animal near you, in any way you can
To save cows https://radhasurabhi.com/donate/
Never Stop Learning
Raghav
https://automationstepbystep.com/