Skip to content

Commit

Permalink
fix(plugin): workaround for early calling of addExpectationResult
Browse files Browse the repository at this point in the history
  • Loading branch information
azachar committed Nov 28, 2016
1 parent 82aa6f3 commit 0556e4c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,18 @@ protractorUtil.takeScreenshotOnExpectDone = function(context) {

var makeScreenshotsFromEachBrowsers = false;
var makeAsciiLog = false;
if (passed) {
protractorUtil.test.passedExpectations.push(expectation);
makeScreenshotsFromEachBrowsers = context.config.screenshotOnExpect === 'failure+success';
makeAsciiLog = context.config.imageToAscii === 'failure+success';
if (protractorUtil.test) {
if (passed) {
protractorUtil.test.passedExpectations.push(expectation);
makeScreenshotsFromEachBrowsers = context.config.screenshotOnExpect === 'failure+success';
makeAsciiLog = context.config.imageToAscii === 'failure+success';
} else {
protractorUtil.test.failedExpectations.push(expectation);
makeScreenshotsFromEachBrowsers = context.config.screenshotOnExpect === 'failure+success' || context.config.screenshotOnExpect === 'failure';
makeAsciiLog = context.config.imageToAscii === 'failure+success' || context.config.imageToAscii === 'failure';
}
} else {
protractorUtil.test.failedExpectations.push(expectation);
makeScreenshotsFromEachBrowsers = context.config.screenshotOnExpect === 'failure+success' || context.config.screenshotOnExpect === 'failure';
makeAsciiLog = context.config.imageToAscii === 'failure+success' || context.config.imageToAscii === 'failure';
console.warn('Calling addExpectationResult before specStarted!');
}
if (makeScreenshotsFromEachBrowsers) {
protractorUtil.takeScreenshot(context, function(filename, browserName, finalFile, browserInstance) {
Expand Down

0 comments on commit 0556e4c

Please sign in to comment.