-
Notifications
You must be signed in to change notification settings - Fork 16
[TE-29059] Nlp's to compare if two images are dissimilar. #207
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
Conversation
WalkthroughThis update introduces new "dissimilar image verification" actions for Android, iOS, and Web platforms, each implemented as a new Java class. These classes compare two images using an external visual testing API and determine if they are dissimilar, with some variants supporting a similarity threshold. The Maven project version is incremented. Changes
Sequence Diagram(s)sequenceDiagram
participant TestStep
participant VerifyIfImagesAreDissimilar
participant VisualTestingAPI
participant S3Uploader
TestStep->>VerifyIfImagesAreDissimilar: execute()
VerifyIfImagesAreDissimilar->>VerifyIfImagesAreDissimilar: Convert image inputs to files
VerifyIfImagesAreDissimilar->>VisualTestingAPI: POST images for comparison
VisualTestingAPI-->>VerifyIfImagesAreDissimilar: similarity %, diff coordinates
alt Images are dissimilar
VerifyIfImagesAreDissimilar->>S3Uploader: Upload actual image screenshot
VerifyIfImagesAreDissimilar-->>TestStep: Success with similarity %
else Images are identical (or above threshold)
VerifyIfImagesAreDissimilar->>VerifyIfImagesAreDissimilar: Generate combined diff image
VerifyIfImagesAreDissimilar->>S3Uploader: Upload combined image
VerifyIfImagesAreDissimilar-->>TestStep: Failure with error message
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
🔭 Outside diff range comments (1)
image_visual_testing/pom.xml (1)
79-79: Critical: Upgrade jackson-databind to 2.19.2The project currently pins jackson-databind at 2.12.3, which is affected by several high-severity vulnerabilities (CVE-2022-42003, CVE-2022-42004, PRISMA-2021-0213). While the 2.12 branch is no longer maintained beyond 2.12.17.1, you should move to the latest stable release (2.19.2 as of August 2025) to ensure all known issues are resolved.
• File: image_visual_testing/pom.xml
Line: 79
Action: Update the<version>elementSuggested change:
- <version>2.12.3</version> <!-- Make sure to use the latest version --> + <version>2.19.2</version> <!-- Upgraded to address CVE-2022-42003, CVE-2022-42004 & PRISMA-2021-0213 -->
♻️ Duplicate comments (1)
image_visual_testing/src/main/java/com/testsigma/addons/web/VerifyIfImagesAreDissimilar.java (1)
1-248: Significant code duplication across platform implementations.This class is nearly identical to the Android and iOS versions. As mentioned in the iOS review, extracting common logic into a shared base class or utility would significantly improve maintainability.
🧹 Nitpick comments (6)
image_visual_testing/src/main/java/com/testsigma/addons/android/VerifyIfImagesAreDissimilar.java (4)
100-101: Remove unnecessary null initialization.The variable is immediately assigned a value, so the null initialization is redundant.
-File combinedImage = null; -combinedImage = File.createTempFile("combined", ".png"); +File combinedImage = File.createTempFile("combined", ".png");
168-168: Fix typo in error message.There's a double space in the error message.
-setErrorMessage("Visual testing failed error occurred internally"); +setErrorMessage("Visual testing failed, error occurred internally");
180-180: Rename misleading parameter.The parameter name
actualDirImagesuggests it's a directory, but it's actually a File representing an image.-private Result uploadScreenshot(boolean compareResult, File actualDirImage, BufferedImage combined, +private Result uploadScreenshot(boolean compareResult, File actualImageFile, BufferedImage combined,
202-204: Remove commented code.Dead code should be removed rather than commented out.
-// String message = "Comparison failed because visual testing detected identical images," + -// " check step screenshot for visual results"; -// errorMessageBuilder.append(message);image_visual_testing/src/main/java/com/testsigma/addons/web/VerifyIfTwoImagesAreDissimilar.java (1)
207-209: Remove commented code.Dead code should be removed rather than commented out.
-// String message = "Comparison failed because visual testing detected too much similarity," + -// " check step screenshot for visual results"; -// errorMessageBuilder.append(message);image_visual_testing/src/main/java/com/testsigma/addons/web/VerifyIfImagesAreDissimilar.java (1)
201-203: Remove commented code.Dead code should be removed.
-// String message = "Comparison failed because visual testing detected identical images," + -// " check step screenshot for visual results"; -// errorMessageBuilder.append(message);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
image_visual_testing/pom.xml(1 hunks)image_visual_testing/src/main/java/com/testsigma/addons/android/VerifyIfImagesAreDissimilar.java(1 hunks)image_visual_testing/src/main/java/com/testsigma/addons/ios/VerifyIfImagesAreDissimilar.java(1 hunks)image_visual_testing/src/main/java/com/testsigma/addons/web/VerifyIfImagesAreDissimilar.java(1 hunks)image_visual_testing/src/main/java/com/testsigma/addons/web/VerifyIfTwoImagesAreDissimilar.java(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: ManojTestsigma
PR: testsigmahq/testsigma-addons#202
File: mailbox_actions/src/main/java/com/testsigma/addons/web/test/GetMailBoxContentBasedOnFilter.java:57-66
Timestamp: 2025-08-05T09:16:20.370Z
Learning: In the GetMailBoxContentBasedOnFilter addon, the logging of email subjects, content, and sender information is intentionally kept for debugging purposes, particularly to handle cases with empty subjects. The user ManojTestsigma prefers this approach for debugging the mailbox filtering functionality.
🔇 Additional comments (1)
image_visual_testing/pom.xml (1)
9-9: Version bump looks good.The version increment from 1.0.4 to 1.0.5 appropriately reflects the addition of new visual testing actions.
JIra
https://testsigma.atlassian.net/browse/TE-29059
Addon name: Image Visual Testing
Addon account: [email protected]
Jarvis Link: https://jarvis.testsigma.com/ui/tenants/2817/users
fix
added Nlps to check if two images are dissimilar.
Summary by CodeRabbit
New Features
Chores