This module fully relies on protractor available callbacks and internal functionalities.
It is build from within protractor itself and not relying on any external dependency. All the changes that you need to add in order to integrate this module is located only in one file, the protractor configuration file, ie to summarize :
The module will create an XML file which contains the failed spec(s) filename(s). and will re-run only them, till either we don't have anymore failures or we reached the retry attempt maximum.
The process of retrying is not happening on the fly of a test failure but only after the whole testsuite is run. The failed tests are stored and only those ones are going to be rerun afterwards by creating on the fly a new "failed only" files testsuite.
npm i -g protractor-retry
var retry = require('protractor-retry').retry;
onPrepare: function() {
retry.onPrepare();
}
onCleanUp = function(results) {
retry.onCleanUp(results);
};
It is Mandatory to provide the results
to the retry.onCleanUp function
afterLaunch = function() {
return retry.afterLaunch(NUMBER_OF_RETRIES);
}
It is Mandatory to use return
here
exports.config = {
// rest of your config
onCleanUp: function (results) {
retry.onCleanUp(results);
},
onPrepare: function () {
retry.onPrepare();
},
afterLaunch: function() {
return retry.afterLaunch(2);
}
};
Those 3 examples are actually used for the functional tests coverage of this package. Please take a look at the Travis output to check out the flow of the retries.