adamgruber / mochawesome

A Gorgeous HTML/CSS Reporter for Mocha.js
https://gitter.im/mochawesome/general
MIT License
1.06k stars 160 forks source link

Want to Email html Report #240

Open ankansithole opened 6 years ago

ankansithole commented 6 years ago

Hi,

I want to attach generated html report in email. using NodeMailer for sending email. So how we can do this ??

adamgruber commented 6 years ago

You can use the inline option to generate a report with all assets inlined or the cdn option to load assets via CDN. Either option would give you a single file to email instead of having to bundle up the assets. Does this help?

li-01 commented 6 years ago

@adamgruber I tried the inline option, and I could open this single html file correctly on my local machine, but the thing is, it shows nothing in email client such as Outlook.

another problem: I used the code=false option to hide all scripts, but in fact these codes are still in the html source file, which makes the file a little too big. Is there any solution not to generate these codes?

thanks~

adamgruber commented 6 years ago

What version of mochawesome and mochawesome-report-generator are you using? Can you show me how you are passing the reporter options? Also, can you provide a screenshot showing the code in the html source that you are seeing?

TSSumanth commented 5 years ago

@adamgruber Even i have the same issues what li mentioned, i am passing the reporter options as shown below: mocha mochachaisample.js --timeout 6000000 --reporter mochawesome --reporter-options -- reportDir=%batchexecutionresultspath%,reportFilename=TestReport,overwrite=false,timestamp --code=false --inline=true

The above command generates a report which i can open in the directory in which it is created. if i copy the report and paste it in some other directory, a blank html page is opened. Also, the code is still present in the report.

Kindly help me out.

"mochawesome": "^3.1.1".

swathijois commented 4 years ago

@adamgruber Facing the same issue. Any update on this ?

rob-mason commented 4 years ago

@adamgruber I'm encountering this issue too, did anyone find a workaround for this? I've tried both inline and CDN options and the email always comes out blank (although the content is there within the email body).

adamgruber commented 4 years ago

What is your expectation of emailing the report? I am able to email the HTML file, download it and then open it in a browser and see the report as expected. You will NOT be able to view the report directly in your email client since it requires javascript to run.

rodolforodriguess commented 3 years ago

Hi. I have been using mochawesome: "^6.1.1", mochawesome-report-generator "^5.1.0" and cypress version 5.3.0.

I was able to send the report via email or attach it to JIRA task or issue for example, Then, you just need to download the html and you will see it but the screenshots will not be available. When I attach the screenshots to the report, the absolute path to the local png image is set to the tag in the html of the report. So, is there any way to attach the relative path or even adding it as as base64 image?

With webdriver io it was possible and I believe the "screenshotUseRelativePath" option in the section Reporter Configurations does the trick. https://webdriver.io/docs/docs/wdio-mochawesome-reporter.html

This is what the html of the report generated by mochawesome with webdriver io look like: image

As you can see in the image above, the screenshots are set as a base64 image.

And this is the report generated with mochawesome and cypress: image

mohanakesavalu69 commented 3 years ago

What version of mochawesome and mochawesome-report-generator are you using? Can you show me how you are passing the reporter options? Also, can you provide a screenshot showing the code in the html source that you are seeing?

@adamgruber the issue is while attaching the report in email since the assest folder have js files it is not sending in the outlook due to security issue

sanghamitra-shinde commented 2 years ago

@adamgruber I am also facing the similar issue. Looks the html file needs app.js to be executed which sits in assets folder in report directory. but went the report is sent only index.html(report file) is attached which when downloaded and opened is browser renders blank. Any workaround for this one ?

adamgruber commented 2 years ago

@mohanakesavalu69 @sanghamitra-shinde From my above response:

You can use the inline option to generate a report with all assets inlined or the cdn option to load assets via CDN. Either option would give you a single file to email instead of having to bundle up the assets.

madnaniftikhar commented 1 year ago

I am still facing this issue

Mocha Report opens in the directory in which it is created, but If I copy the report and paste it into some other directory, a blank html page is opened

is there any workaround?