LironEr / cypress-mochawesome-reporter

Zero config Mochawesome reporter for Cypress with screenshots and videos
MIT License
163 stars 51 forks source link

Save the json files #33

Closed pav-elis closed 3 years ago

pav-elis commented 3 years ago

The issue: Currently I'm trying to implement Cypress and Testrail integration. In order to do that, I am planning to use this reporter. But as long as cypress-mochawesome-reporter delete the initial json files with the results, I'm unable to continue.

Question/Feature I'd like to see: Any way how I can save both the html report and initial json files?

Thanks in advance!

pav-elis commented 3 years ago

If that is an option and maybe it is easier to implement: instead of saving all initial json files, there is more sence to save one final json which has all initial json files merged.

LironEr commented 3 years ago

All mochawesome-report-generator flags can be used with this reporter

cypress.json

{
  "reporter": "cypress-mochawesome-reporter",
  "reporterOptions": {
    "saveJson": true
  }
}

this will save a JSON file with the final report

pav-elis commented 3 years ago

Hey @LironEr , thank you for your answer. It is weird but in my case, I have it set in config. I'm using a multi reporter and two reporters with their own options in the reporter-config.json file.

image

And weird enough, I can see during the run all json files appear, but after html generation - it seems like it overwrite the reports folder completely and no json files saved after that.

Maybe you can give me a clue, what am I missing?

P.S.: I even tried to set it both in cypress.json and in reporter-config.json but it didn't help...

LironEr commented 3 years ago

Try like this:

{
  "reporterEnabled": "cypress-mochawesome-reporter, mocha-junit-reporter",
  "mochaJunitReporterReporterOptions": {
    "mochaFile": "cypress/results/xml/test-result-[hash].xml"
  },
  "cypressMochawesomeReporterReporterOptions": {
    "saveJson": true
  }
}
pav-elis commented 3 years ago

@LironEr Thank you, it works! Great reporter, keep up what you are doing! :)