2

Followed the below steps mentioned in tutorial: https://dev.to/bushraalam/using-mochawesome-reporter-with-cypress-54pf

  1. Installed necessary packages through npm
  2. Added pre and post scripts along with combine and generate report
  3. Ran test script and was able to see that folders getting created in "rm -R -f cypress/reports && mkdir cypress/reports && mkdir cypress/reports/mocha"
  4. But fails to generate report for the script - enter image description here

commands: "combine_reports": "mochawesome-merge ./cypress/reports/mocha/*.json > cypress/reports/mochareports/report.json", "generate_report": "marge cypress/reports/mochareports/ report.json -f report -o cypress/reports/mochareports", "post_test": "npm run combine_reports && npm run generate_report",

SOLUTION: "cypress run -r cypress-multi-reporters test_script --reporter mochawesome" - generated the correct .json files for all test suites

Meg
  • 55
  • 7
  • 1
    When you run commands **combine_reports** and **generate_report** individually, which fails? –  Jan 05 '21 at 03:29
  • 1
    By convention you should name the command **posttest** not *post_test*, so that npm auto-runs it after the **test** command. –  Jan 05 '21 at 03:39
  • oh didnt know its a reserve word thank you. – Meg Jan 14 '21 at 01:31
  • 1
    I was able to resolve this issue. --reporter mochawesome was supposed to be added in order for scripts to be generated automatically. Once the .json files were generated for each test suite, combine_reports && npm run generate_report ran successfully – Meg Jan 14 '21 at 01:33

0 Answers0