zinserjan / wdio-visual-regression-service

Visual regression service for WebdriverIO.
MIT License
102 stars 39 forks source link

Reference image updated after each run causes git change #32

Closed albertogasparin closed 7 years ago

albertogasparin commented 7 years ago

Every time I run my test suite, git sees my reference images as being changed even if there were no errors. Looks like this line is causing the issue:

await fs.outputFile(referencePath, base64Screenshot, 'base64');

You are rewriting the reference file even if the test is passing. May I ask you why? Should reference images be fixed unless you explicitly delete and regenerate them?

Because something (the antialiasing?) is making invisible changes and git flags the new image as different even with a 1 byte off.

zinserjan commented 7 years ago

A really good question. I have no idea why I did this, there is no real reason for this. I just thought if the changes are in tolerance it's ok to update the reference images. Never thought about a scenario that store images in git.

I'll discuss this with my colleagues tomorrow. Maybe they have a reason for this :)

zinserjan commented 7 years ago

Sorry for the delay, forgot to answer...

There is really no reason to override the base screenshots. It's just a mistake in the implementation, don't know what I thought :laughing:

I would be happy to accept a PR for this, if you want to speed up this fix.