Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reporter still not generating in a single file after sending inline as true and html as false #164

Open
hem678 opened this issue Mar 29, 2021 · 7 comments

Comments

@hem678
Copy link

hem678 commented Mar 29, 2021

Reporter still not generating in a single file after sending inline as true

reporter options :

"inline":true
"html":false

still reporter generating asserts folder and when sending an email with the report.html showing blank page

tried mochaawesome version : 6.1.1 and 6.2.2

@adamgruber
Copy link
Owner

Can you show exactly how you are passing options?

@hem678
Copy link
Author

hem678 commented Mar 30, 2021

under cypress.json

"reporter": "mochawesome",
"reporterOptions": {
"reportDir": "cypress/reports",
"inline": true,
"charts": true,
"overwrite": false,
"html": false,
"json": true,
"reportTitle": "UI Automation Test Report",
"reportPageTitle": "E2E Reports",
"reportFilename": "TestReport",
"quiet": false,
"includeScreenshots": true,
"timestamp": true,
"code": false

@hem678
Copy link
Author

hem678 commented Apr 5, 2021

@adamgruber - any update on this issue ?

@adamgruber
Copy link
Owner

adamgruber commented Apr 5, 2021

I'm unable to reproduce this. When I run a simple test with the above configuration the output is a single JSON file as expected.

If you can create a repo that reproduces the behavior you are seeing then I can try to dig a little deeper.

@hem678
Copy link
Author

hem678 commented Apr 6, 2021

i can see single HTML report after combining multiple JSONs but its creating assets folder as well, which unable to display html page on EMAIL Body

@la55u
Copy link

la55u commented May 11, 2021

I think the issue is that this library does not read the options from the output.json file generated by mochawesome instead we have to pass cli options or create another .mocharc.js which are both just duplicates of the already existing options in the json file.
There is a top level meta key in output.json which looks like this:

  "meta": {
    "mocha": {
      "version": "7.0.1"
    },
    "mochawesome": {
      "options": {
        "quiet": false,
        "reportFilename": "mochawesome",
        "saveHtml": false,
        "saveJson": true,
        "consoleReporter": "spec",
        "useInlineDiffs": false,
        "code": true
      },
      "version": "6.2.2"
    },
    "marge": {
      "options": {
        "reportTitle": "My test report",
        "reportPageTitle": "My test report",
        "reportDir": "cypress/results",
        "charts": true,
        "inline": true,
        "showHooks": "always",
        "overwrite": false,
        "html": false,
        "json": true
      },
      "version": "5.2.0"
    }
  }

@adamgruber Is my assumption correct that the options under the marge key are not used in this library? If yes I might be able to add it in a PR if you approve it.

Steps to reproduce: produce a combined Mochawesome JSON file

  1. create a sample project then npm i --save-dev cypress mochawesome mochawesome-merge mochawesome-report-generator
  2. create a cypress.json file with the following:
{
  "reporter": "mochawesome",
  "reporterOptions": {
    "reportTitle": "My test report",
    "reportDir": "cypress/results",
    "overwrite": false,
    "html": false,
    "json": true
  }
}
  1. add this in your package.json scripts:
    "cypress:run": "cypress run && npx mochawesome-merge ./cypress/results/*.json -o ./cypress/results/output.json && npx marge ./cypress/results/output.json"
  2. npm run cypress:run

Noice I did not create any additional files for mocha nor did I pass any cli args to marge.

Expected behaviour:

The output.html file should be under ./cypress/results/output.html and the title in the navbar should be "My test report"

Actual behaviour:

The output.html file is under ./mochawesome-report and the title is your current directory.

@abhishek747400
Copy link

abhishek747400 commented Mar 23, 2023

PS C:\Users\LENOVO\CypressAutomation> npx run cypress:run
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/run failed, reason: getaddrinfo ENOTFOUND host
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\LENOVO\AppData\Roaming\npm-cache_logs\2023-03-23T06_28_52_039Z-debug.log
Install for [ 'run@latest' ] failed with code 1
PS C:\Users\LENOVO\CypressAutomation> npx run cypress:run
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\LENOVO\AppData\Roaming\npm-cache_logs\2023-03-23T06_28_58_670Z-debug.log
Install for [ 'run@latest' ] failed with code 1

I have followed the instructions but i keep facing this issue in cypress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants