Skip to content

Conversation

@ManojTestsigma
Copy link
Contributor

@ManojTestsigma ManojTestsigma commented Dec 8, 2025

please review this addon and publish as PUBLIC

Addon name : ocr_actions
Addon accont: https://jarvis.testsigma.com/ui/tenants/3072/addons
Jira: https://testsigma.atlassian.net/browse/CUS-9542

fix

used W3C Actions API instead of deprecated TouchAction

Summary by CodeRabbit

  • Refactor

    • Updated touch interaction implementation across Android, iOS, and web OCR testing modules.
    • Removed unused imports and dependencies.
  • Chores

    • Version bumped to 1.1.9.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2025

Walkthrough

Version bump from 1.1.8 to 1.1.9 in pom.xml. Deprecated TouchAction and PointOption APIs replaced with W3C PointerInput and Sequence across Android and iOS OCR classes for coordinate-based tapping. Unused Appium and Selenium imports removed. No changes to public method signatures or functional behavior.

Changes

Cohort / File(s) Summary
Version Update
ocr_actions/pom.xml
Bumped project version from 1.1.8 to 1.1.9
Android OCR API Migration
ocr_actions/src/main/java/com/testsigma/addons/android/OCRTesting.java, OCRTestingdo.java, OCRTestingmouse.java
Replaced deprecated TouchAction/PointOption with W3C PointerInput and Sequence for coordinate-based tapping. Added Duration, Arrays, PointerInput, Sequence imports; removed TouchAction, PointOption, and related unused imports. Behavior preserved.
iOS OCR API Migration
ocr_actions/src/main/java/com/testsigma/addons/ios/OCRTesting.java, OCRTestingdo.java
Replaced deprecated TouchAction/PointOption with W3C PointerInput and Sequence for coordinate-based tapping. Added Duration, Arrays, PointerInput, Sequence imports; removed TouchAction, PointOption, and Android-specific unused imports. Behavior preserved.
Import Cleanup
ocr_actions/src/main/java/com/testsigma/addons/android/OCRTestingStore.java, ocr_actions/src/main/java/com/testsigma/addons/web/OCRTestingdo.java
Removed unused Appium and Selenium imports (By, WebElement, Actions, PerformsTouchActions, TouchAction, PointOption, IOSDriver). No functional code changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify that PointerInput sequence (move → pointer down → pointer up) behavior matches previous TouchAction tap implementation on both Android and iOS drivers
  • Confirm coordinate handling and timing with the new W3C Actions API remain consistent with prior behavior
  • Ensure no edge cases with AndroidDriver.perform() and IOSDriver.perform() execution

Possibly related PRs

Suggested reviewers

  • Ganesh-Testsigma
  • vigneshtestsigma

Poem

🐰 Whisker-twitching with delight,
Old TouchActions fade from sight,
PointerInput, W3C's way,
Modernizing touch today!
🎯 Tap by tap, we leap ahead—
Deprecated APIs, now long dead!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: replacing deprecated TouchAction methods with modern W3C Actions API across multiple files in the ocr_actions addon.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch CUS-9542

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
ocr_actions/src/main/java/com/testsigma/addons/android/OCRTestingmouse.java (1)

98-117: Android mouse-style W3C tap looks good; consider dropping unused InterruptedException

The new W3C PointerInput tap sequence (move → down → up via AndroidDriver.perform(Arrays.asList(tap))) is correct and consistent with the other Android implementations.

Since clickOnCoordinates no longer performs any blocking calls, you can safely remove throws InterruptedException from its signature and any callers, which will simplify usage.

Please confirm there are no remaining callers that rely on InterruptedException in their signatures before removing it.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0000d55 and 2c2b2a6.

📒 Files selected for processing (8)
  • ocr_actions/pom.xml (1 hunks)
  • ocr_actions/src/main/java/com/testsigma/addons/android/OCRTesting.java (2 hunks)
  • ocr_actions/src/main/java/com/testsigma/addons/android/OCRTestingStore.java (0 hunks)
  • ocr_actions/src/main/java/com/testsigma/addons/android/OCRTestingdo.java (2 hunks)
  • ocr_actions/src/main/java/com/testsigma/addons/android/OCRTestingmouse.java (2 hunks)
  • ocr_actions/src/main/java/com/testsigma/addons/ios/OCRTesting.java (2 hunks)
  • ocr_actions/src/main/java/com/testsigma/addons/ios/OCRTestingdo.java (2 hunks)
  • ocr_actions/src/main/java/com/testsigma/addons/web/OCRTestingdo.java (0 hunks)
💤 Files with no reviewable changes (2)
  • ocr_actions/src/main/java/com/testsigma/addons/android/OCRTestingStore.java
  • ocr_actions/src/main/java/com/testsigma/addons/web/OCRTestingdo.java
🔇 Additional comments (5)
ocr_actions/pom.xml (1)

9-9: Version bump looks consistent with non-breaking internals change

Incrementing ocr_actions to 1.1.9 for the TouchAction→W3C migration is appropriate; no other POM changes affect consumers.

ocr_actions/src/main/java/com/testsigma/addons/android/OCRTesting.java (1)

108-114: W3C actions-based tap implementation for Android looks correct

The new PointerInput/Sequence tap (move → down → up, then AndroidDriver.perform(Arrays.asList(tap))) is a clean replacement for the deprecated TouchAction tap and keeps behavior aligned with the old coordinate click.

Please run a quick smoke test on a real Android device/emulator to confirm taps still register correctly across different screen densities.

ocr_actions/src/main/java/com/testsigma/addons/ios/OCRTesting.java (1)

104-110: iOS W3C actions tap sequence is consistent and correct

The PointerInput/Sequence tap (viewport move → pointerDown → pointerUp, executed via IOSDriver.perform(Arrays.asList(tap))) is a valid W3C replacement for the deprecated TouchAction-based tap and matches the Android implementation.

Please validate this on at least one real iOS device/simulator to ensure the tap is recognized reliably by the app under test.

ocr_actions/src/main/java/com/testsigma/addons/ios/OCRTestingdo.java (1)

51-58: Guard against empty OCR matches before dereferencing first element

The new W3C PointerInput/Sequence tap for iOS looks good and matches the other implementations. However, OCRTextPoint textPoint = TextCompare.get(0); will throw IndexOutOfBoundsException if TextCompare is empty (no OCR match), bypassing the existing if (textPoint == null) handling.

Add an explicit empty-check before dereferencing:

-            OCRTextPoint textPoint = TextCompare.get(0);
+            if (TextCompare.isEmpty()) {
+                result = Result.FAILED;
+                setErrorMessage("Not found");
+                return result;
+            }
+            OCRTextPoint textPoint = TextCompare.get(0);

Also applies to lines 91-97.

ocr_actions/src/main/java/com/testsigma/addons/android/OCRTestingdo.java (1)

54-62: Use W3C tap is fine; also handle case where no OCR match is found

The Android W3C PointerInput/Sequence tap in clickOnCoordinates follows the standard W3C Actions specification (pointerMove → pointerDown → pointerUp) and is correctly aligned with other classes.

As in the iOS variant, OCRTextPoint textPoint = TextCompare.get(0); will throw IndexOutOfBoundsException if TextCompare is empty, bypassing your "Not found" error message. Explicit validation before get() is the recommended pattern.

A guard check would make this more robust:

-            OCRTextPoint textPoint = TextCompare.get(0);
+            if (TextCompare.isEmpty()) {
+                result = Result.FAILED;
+                setErrorMessage("Not found");
+                return result;
+            }
+            OCRTextPoint textPoint = TextCompare.get(0);

Please test a flow where the given text is not present in the screenshot to confirm it now fails gracefully instead of raising IndexOutOfBoundsException.

Also applies to: 95-101

@ManojTestsigma ManojTestsigma merged commit fc2729b into dev Dec 9, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants