Closed k87perera closed 6 months ago
try this custom reporter:
// playwright.config.js
module.exports = {
reporter: [
['monocart-reporter', {
name: "My Test Report",
outputFile: './test-results/report.html',
onEnd: async (reportData, { sendEmail, config }) => {
const emailOptions = {
// https://nodemailer.com/smtp/
transport: {
service: 'Hotmail',
auth: {
user: '',
pass: ''
}
},
// https://nodemailer.com/message/
message: {
from: '',
to: '',
cc: '',
bcc: '',
subject: `${reportData.name} - ${reportData.dateH}`,
attachments: [{
path: reportData.htmlPath
}],
html: `
<h3>${reportData.name}</h3>
<ul>
<li>Env: STG</li>
<li>Type: Smoke</li>
<li>Url: ${reportData.use.url}</li>
<li>Workers: ${config.workers}</li>
<li>Date: ${reportData.dateH}</li>
<li>Duration: ${reportData.durationH}</li>
</ul>
${reportData.summaryTable}
<p>Please check attachment html for detail.</p>
<p>Thanks,</p>
`
}
};
const info = await sendEmail(emailOptions).catch((e) => {
console.error(e);
});
if (info) {
console.log(info);
}
}
}]
]
};
Awsome :+1:
Can we add this on CustomReporter.onEnd method with a zip file as attachment ? Also is it possible to send the same with HTML report, instead of monocart-reporter ?
Thank you for your involvement. This issue was closed due to limited engagement (upvotes/activity), lack of recent activity, and insufficient actionability. To maintain a manageable database, we prioritize issues based on these factors.
If you disagree with this closure, please open a new issue and reference this one. More support or clarity on its necessity may prompt a review. Your understanding and cooperation are appreciated.
@k87perera You should consider using https://github.com/estruyf/playwright-mail-reporter ;)
can you add more features to html reporter in playwright. eg: allure report over view page. and send report as a email functionality. Most of top management like to see consolidate report. allure report is good but it is not a inbuild report due to that we need face data sync issues most of the time