protractor-jasmine2-screenshot-reporter icon indicating copy to clipboard operation
protractor-jasmine2-screenshot-reporter copied to clipboard

Is it possible to preserve screenshots while making a new report?

Open ronniegane opened this issue 8 years ago • 1 comments

I'd like to be able to have screenshots for all specs, and only overwrite the screenshot if I run that spec, so that I always have a library of the most recent screenshots for every spec.

cleanDestination = false achieves this, but also makes the report.html grow by just appending new reports to it, rather than overwriting. So the report will get very large and cluttered over time.

cleanDestination = true means I get a new report each time, but all your screenshots are deleted if you want to run just one spec instead of the whole suite.

I managed to get things working how I wanted by replacing the call to fs.appendFile on line 336 of index.js with fs.writeFile. Seems to work as intended although I haven't looked into all the consequences yet. Maybe this could be an option in a future update?

ronniegane avatar Apr 22 '16 04:04 ronniegane

This sounds like something that would be easier to do by orchestration, e.g. you would set cleanDestination to false, and remove the report manually prior to running protractor (similarly this can be done in various task runners e.g. gulp).

rm target/report.html && protractor protractor.conf

That said, how do you keep the filenames consistent across runs, do you use a custom pathBuilder function?

mlison avatar Jul 01 '16 10:07 mlison