swissmanu / protractor-screenshot-reporter

Reporter for Protractor. Asks Selenium for a screenshot after every test case and stores it along with test case details.
https://github.com/swissmanu/protractor-screenshot-reporter
MIT License
65 stars 21 forks source link

Skip file screen shot if current image equals last #8

Closed elgalu closed 10 years ago

elgalu commented 10 years ago

Thanks for the screen shot reporter @swissmanu is very handy :)

My tests runs are big and generate 100's of png MB per day!

I was thinking about integrating http://huddle.github.io/Resemble.js/ to avoid saving the same image twice by using the server-side fork of resemble.js

What do you think about this feature? We may need to wrap the onComplete callback in a webdriver promise to make the scheduler wait for it before moving on.

swissmanu commented 10 years ago

this sounds like a cool enhancement @elgalu!

the "architecture" (to call it so ;) ) of the current implementation would need some refactoring to register multiple handlers after a screenshot was taken. maybe even the current meta data generation could be implemented using such a handler.

i'll add your suggestion as a possible future feature. maybe you have some spare time to invest? personally, i'm quite busy at the moment.

elgalu commented 10 years ago

I'm glad you liked the idea, for now i realized that the following conditional satisfy my requirement for most cases:

if (lastBase64png !== currentPng) {
    lastBase64png = currentPng; // store a reference to last saved png
    util.storeScreenShot(currentPng, screenShotPath);
    screenShotFile = baseName + '.png';
} else {
    screenShotFile = 'screen shot skipped because equals last one.';
}

So maybe Resemble.js is overkill, feel free to close this issue!

swissmanu commented 10 years ago

cool you solved your requirement.

i'm gonna keep these thoughts in mind... maybe i can improve the reporters code anyway to make it more flexible in future.