Open drptbl opened 9 years ago
I've confirmed it's a problem with this code:
// html reporter (protractor-jasmine2-html-reporter)
jasmine.getEnv().addReporter(
new HtmlScreenshotReporter({
dest: '.tmp/htmltestreports',
filename: 'report.html',
ignoreSkippedSpecs: false,
captureOnlyFailedSpecs: false,
reportOnlyFailedSpecs: false
}));
after commenting this, I've got no errors. but still atleast I'm able to use Junit reporter without any problems.
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
consolidateAll: false,
savePath: '.tmp/junittestreports'
}));
// add jasmine spec reporter
jasmine.getEnv().addReporter(new SpecReporter({
displayStacktrace: 'summary', // display stacktrace for each failed assertion, values: (all|specs|summary|none)
displayFailuresSummary: true, // display summary of all failures after execution
displayPendingSummary: true, // display summary of all pending specs after execution
displaySuccessfulSpec: true, // display each successful spec
displayFailedSpec: true, // display each failed spec
displayPendingSpec: true, // display each pending spec
displaySpecDuration: true, // display each spec duration
displaySuiteNumber: true, // display each suite number (hierarchical)
colors: {
success: 'green',
failure: 'red',
pending: 'yellow'
},
prefixes: {
success: '✓ ',
failure: '✗ ',
pending: '* '
},
}));
so it's related to other plugins making screenshots or something like that? any way to fix? or not possible?
It seems you might have run into this issue of the jasmine2-screenshot-reporter. It relates to protractor not (always) waiting for jasmine reporters to finish what they're doing.
If we remove the vr.cleanup() call in the afterLaunch callback, everything indeed works fine. However, if I replace the vr.cleanup() call with something random that causes protractor/jasmine to wait for a promise to resolve, the error pops up again. Even if the promise resolves after a very short time:
afterLaunch: function (exitCode) {
//return vr.cleanup(exitCode);
// run npm install q before running this code
var q = require('q');
var deferred = q.defer();
setTimeout(deferred.resolve, 1);
return deferred.promise;
},
..whereas returning an already resolved promise immediately does not trigger the error:
afterLaunch: function (exitCode) {
//return vr.cleanup(exitCode);
// run npm install q before running this code
var q = require('q');
var deferred = q.defer();
deferred.resolve();
return deferred.promise;
},
So I think the error occurs because there is a delayed execution done in afterLaunch (something visualreview-protractor does), which triggers the screenshot-reporter/protractor issue. So while this issue is, in this case, triggered by visualreview-protractor, it's cause is actually somewhere between screenshot-reporter and protractor.
There are some workarounds mentioned in the related protractor discussion, perhaps these might work for you.
Was this resolved?
I'm going to look into it over the weekend and write down the result :+1:
Marking the issue invalid for now. Lets see how the situation develops over at jasmine2-screenshot-reporter issue.
Hello. I'm using VisualReview with Protractor and it's plugin. After everything is set-up like in a guide, even if my VisualReview works good, it takes screenshots and everything - after all specs are run I'm getting an error in console. I don't know if it has any impact on my tests (looks like not), but still would love to fix it.
repository: https://github.com/drptbl/protractortesting/
I've commented the lines with visualreview code and error is gone so it's related to visualreview for sure.
any suggestions? maybe some bad interactions with jasmine2-html-screenshot-reporter which makes screenshots too? would be great to fix this.
Regards, drptbl.