Reputation: 12009
Is there any way the test results
in Cypress can be exported to an HTML or any other format ( like cucumber-report.html)
Upvotes: 6
Views: 13132
Reputation: 4113
You can use mochawesome
reporter to run to export the report. But the caveat is mochawesome when used alone generates individual reports which get overridden by the latest spec file that is run. In order to merge all the individual mochawesome
reports, give a shot to mochawesome-merge
which will combine all the test results and export it in HTML.
Towards that end,
mocha
, mochawesome
and mochawesome-merge
(mochawesome has peer dependency on mocha)npm install mocha npm install mochawesome --save-dev npm install mochawesome-merge --save-dev
cypress.json
, paste the following config:{
"reporter": "mochawesome",
"reporterOptions": {
"charts": true,
"overwrite": false,
"html": false,
"json": true,
"reportDir": "cypress/report/mochawesome-report"
}
}
npx cypress run --reporter mochawesome
npx mochawesome-merge cypress/report/mochawesome-report/*.json > cypress/report/output.json
npx marge cypress/report/output.json --reportDir ./ --inline
✓ Reports saved: E:\Project_Path\cypress\report\output.html
Upvotes: 14
Reputation: 141
Yes, you can use any mocha reporter as cypress is build on top of it: https://mochajs.org/#reporters spec reporter is the default one.
You will have to add them to your cypress.json config like this:
{
"reporter": "mochawesome"
}
You can find all the information here: Reporters
Upvotes: 1