2

I am working with Protractor. Have written a few test cases using protractor and can generate HTML reports as well. Now I want to send/share my html reports to the email addresses after running protractor test cases. Is it possible to send test case report to some email address(es) using protractor? Please let me know.

Thanks in advance!

3 Answers3

0

Protractor don't provide this stuff.

You can use grunt to launch your protractor e2e tests using grunt-protractor-runner and then send the test results using grunt-email-builder.

gontard
  • 28,720
  • 11
  • 94
  • 117
0
  1. Install nodemailer package using command npm install nodemailer
  2. Import nodemailer in your protractor config var nodemailer = require('nodemailer');
  3. Now add following code in your config :

    var nodemailer = require('nodemailer');

    onComplete: function () {
        return new Promise(function (fulfill, reject) {
          var transporter = nodemailer.createTransport({
            host: 'smtp.gmail.com',
            port: 465,
            secure: true,
            auth: {
              user: 'abc@gmail.com',
              pass: '12346788'
            }
          });
          var mailOptions = {
            from: 'abc@gmail.com',
            to: 'xyz@gmail.com',
            subject: 'Test_Report',
            text: 'Test_Report of app',
            attachments: [{
              'path': 'Test_Report/htmlReport.html',
            }]
          };
          transporter.sendMail(mailOptions, function (error, info) {
            if (error) {
              reject(err);
              return console.log(error);
            }
            console.log('Mail sent: ' + info.response);
            fulfill(info);
          });
        });
    }
    
0

Node mailer is the correct option.But when we open after attached mail is not shows the content clear.like only tags are shows.its because the format is not supported remotely attached files.we need to get the junit report then attach with customized report then we can send it to stackholders.but the report part we can send it using java code only

Karthi C
  • 31
  • 6