Reputation: 175
I have a problem I would like to send output of a reporter or just results of a test via email I use webdriverio and don't have preference in reporters. How could I do it?
Upvotes: 2
Views: 954
Reputation: 175
The webdriverio v5 come out and previous answer now is not relevant and was a bad practice. Better solution will be: Use json-reporter and fetch data to your email template from json reporter log and send it via nodemailer. To send it automatically after all test execution finished I have added onComplete function which forks child process that parse data and send's email
Upvotes: 0
Reputation: 175
In reporter find the file that's are used to send output, in my case reporter is a spec reporter and file call'd reporter.js you can possibly use something like nodemailer and you need to add your script to before output and just send the output but you need to consider that spec use chalks to color the output so you need to get rid of it I suggest to use library ansi-html. Another option is to save test dump of test results and just send or read a text from the file it can be possibly easier for that i suggest you to look at : How/What is the best way to auto create/save text file version of automated test reporter logs or if you use jenkins i suggest to use plugin for email notification's. P.S if you want to format the epilogue you should change BaseReporter.js if you use webdriverio
Upvotes: 2