adamgruber / mochawesome-report-generator

Standalone mochawesome report generator. Just add test data.
MIT License
234 stars 89 forks source link

Snapshots stopped showing up on reports after upgrade to v6.0.1 #183

Closed brnquester closed 2 years ago

brnquester commented 2 years ago

After the latest upgrade the snapshots stopped showing up on the report and now shows a code on its place as below:

[
  [
    {
      "title": "Failed screenshot",
      "value": "/1-forms/sales-de.spec.js/sales (failed).png"
    }
  ]
]

Packages used:

"cypress": "^9.1.0",
"mocha": "^9.1.3",
"mochawesome": "^7.0.1",
"mochawesome-merge": "^4.2.1",
"mochawesome-report-generator": "^6.0.1"

Commands to generate the report

"cypress:run": "cypress run || npm run posttest",
"cypress:merge": "mochawesome-merge cypress/reports/*.json > cypress/reports/fullreport.json",
"cypress:generate": "marge cypress/reports/fullreport.json --reportDir cypress/reports/ --inline",

Reporter configs

"reporter": "mochawesome",
    "screenShotOnRunFailure": true,
    "screenshotsFolder": "cypress/reports/screenshots/",
    "reporterOptions": {
            "reportDir": "cypress/reports/",
            "overwrite": false,
            "html": false,
            "json": true,
            "timestamp": "mmddyyyy_HHMMss",
            "embeddedScreenshots": true,
            "inlineAssets": true,
            "charts": true            
        },      

Note: The actual snapshot files are created just fine, I was able to open them in the preset folder.

Expected result

The snapshot showing inline inside the final report. It was working fine in the previous version used.

Actual result

Shows a JSON like code on the snapshot place.

brnquester commented 2 years ago

The issue has been resolved. In my case, there was a conflict between @mochawesome-report-generator and @cypress-mochawesome-reporter configuration. I had the hooks for cypress-mochawesome-reporter defined as this example; however, I was calling in my cypress.json the parameter "reporter": "mochawesome".