looks-same
looks-same copied to clipboard
Add equal feedback in createDiff.
It would be great to know if the images are equal or not when creating diff.
looksSame.createDiff({ ... }, function (error, equal) { ... });
Hello.
Can you please describe a use case of this feature?
It is assumed that you need compare images at first and than if they have difference call createDiff
method.
Example:
looksSame('ref.png', 'curr.png', (err, equal) => {
if (!equal) {
looksSame.createDiff({...}, () => {...})
}
})
Yes sure. I need to create a diff image regardless if it has differences or not. I use it for e2e tests and there are scenarios with steps where each step should be visible and additionally I want to show which steps have some difference.
Okay, you can do it like I described above:
looksSame('ref.png', 'curr.png', (err, equal) => {
looksSame.createDiff({...}, () => {...});
console.log(`Images are equal: ${equal}`);
})
Is it suitable for you?
Thanks for the answer. Unfortunately it's not the option I need - it simply takes more time to compare images and generate diff. In this case it will take longer than expected. I have loads of scenarios and images to compare.
Ok, I understand you. We are currently busy with other tasks so the PR is welcome. By the way, this is not difficult to do.
@DudaGod Hello. I have created a Pull Request regarding this issue, could you please take a look at it? https://github.com/gemini-testing/looks-same/pull/94
@DudaGod Hello. I have created a Pull Request regarding this issue, could you please take a look at it?
Hello. Did you try to use lookSame
with option createDiffImage: true
? In this case the execution speed should be the same as when calling createDiff
.
You can use it like:
const {equal} = await looksSame('image1.png', 'image2.png', {createDiffImage: true});