How do I send an email when the e2e protractor test case fails?
Following Leo's comments.
This is not something you need to solve on the level protractor
. protractor
itself is a browser automation testing framework that simulates user action to test your website.
The usual way to report test bugs by email is to do so on a continuous integration server like jenkins
or bamboo
. The idea is to use a reporter JUnitXmlReporter
jasmine-reporters
to generate a report Junit XML
that jenkins
either bamboo
knows how to read and analyze. Then send your test results by email.
Call JUnitXmlReporter
in your function onprepare()
in the protractor config :
onPrepare: function() {
// The require statement must be down here, since jasmine-reporters
// needs jasmine to be in the global and protractor does not guarantee
// this until inside the onPrepare function.
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmine.JUnitXmlReporter('xmloutput', true, true));
},
source to share