Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display image filename/filepath in exceptions #106

Open
sergiu-mezei-aera opened this issue Oct 12, 2022 · 2 comments
Open

Display image filename/filepath in exceptions #106

sergiu-mezei-aera opened this issue Oct 12, 2022 · 2 comments

Comments

@sergiu-mezei-aera
Copy link

sergiu-mezei-aera commented Oct 12, 2022

Hi guys,

We're using shutterbug to do multiple image comparisons inside a test method and we're using Allure reports for the reporting part.
I would like to suggest an improvement: displaying the image filename/filepath inside the exceptions thrown rather than just the "image1"/"image2" hardcoded strings or at least any image path information (like the resulting diff image path). This would help us to easily debug and fix tests because we know which images are affected.

For example:
We get an exception like this:
Images dimensions mismatch: image1 - 300x753; image2 - 300x754 com.assertthat.selenium_shutterbug.utils.image.UnableToCompareImagesException: Images dimensions mismatch: image1 - 300x753; image2 - 300x754 at com.assertthat.selenium_shutterbug.utils.image.ImageProcessor.imagesAreEqualsWithDiff(ImageProcessor.java:140) at com.assertthat.selenium_shutterbug.core.Snapshot.equalsWithDiff(Snapshot.java:325) at utils.ImageCompare.compareWebElement(ImageCompare.java:133) at ui_tests.ui_builder_tests.TableComponentTest6.goToNextNodeRowSelectionTrueTest(TableComponentTest6.java:102) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Thanks in advance!

@glibas
Copy link
Member

glibas commented Oct 13, 2022

Hi @sergiu-mezei-aera ,

Could you please share the snippet of code which you use to do the comparison? Do you read both images from the disk first?

@sergiu-mezei-aera
Copy link
Author

sergiu-mezei-aera commented Oct 14, 2022

Hi @glibas,

I read the expected image (BufferedImage) from the disk and the image we compare with is a UI capture (snapshot).

saveSnapshot(actual, imageName + "-actual", actualScreenShotFolder);

boolean result = actual.equalsWithDiff(expected, diffFolder + imageName, deviation);

The exception comes from the equalsWithDiff() method, but we need more info of the image1/2 names to be clearer for debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants