Skip to content

Conversation

@ManojTestsigma
Copy link
Contributor

@ManojTestsigma ManojTestsigma commented Dec 8, 2025

please review this addon and publish as PUBLIC

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

fix

Added Nlp to swipe inside an element.
added existing nlp's to android and ios packages.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added drag-and-drop capabilities to move elements to reference elements across Android, iOS, web, and mobile web platforms
    • Added relative positioning support with configurable offsets (left, right, top, bottom, center) for precise element placement
    • Added swipe gesture capabilities within element boundaries
    • Added drag actions with pause functionality for enhanced control during mobile web interactions

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2025

Walkthrough

This PR adds new drag-and-swipe action classes across multiple platforms (Android, iOS, Mobile Web, Web) for element manipulation using Appium/Selenium Actions. Each action performs drag-to-reference, relative position moves, and swipe-within-element gestures with configurable offsets and directions, including error handling.

Changes

Cohort / File(s) Summary
Android drag actions
drag_actions/src/main/java/com/testsigma/addons/android/DragElementToReference.java, MoveElementRelativeToReference.java, SwipeWithInElement.java
Adds three new Android action classes: DragElementToReference (drags element to reference element), MoveElementRelativeToReference (supports relative positions with x/y offsets), and SwipeWithInElement (swipes within element bounds from one direction to another). All include error handling and helper methods for coordinate calculation.
iOS drag actions
drag_actions/src/main/java/com/testsigma/addons/ios/DragElementToReference.java, MoveElementRelativeToReference.java, SwipeWithInElement.java
Adds three iOS action classes mirroring Android functionality: DragElementToReference, MoveElementRelativeToReference (with relative position and offset support), and SwipeWithInElement (directional swipe within element). Uses IOSDriver with Selenium Actions and includes offset calculation helpers.
Mobile Web drag actions
drag_actions/src/main/java/com/testsigma/addons/mobileWeb/DragElementToReference.java, MoveElementRelativeToReference.java, MoveElementRelativeToReferenceWithPause.java, MoveElementToReferenceWithMultiplePause.java
Adds four mobile web actions: DragElementToReference (basic drag), MoveElementRelativeToReference (relative positioning), MoveElementRelativeToReferenceWithPause (with pause and bounding rect calculations), and MoveElementToReferenceWithMultiplePause (multiple pause points with scroll and center point helpers).
Swipe actions
drag_actions/src/main/java/com/testsigma/addons/mobileWeb/SwipeWithInElement.java, drag_actions/src/main/java/com/testsigma/addons/web/SwipeWithInElement.java
Adds SwipeWithInElement for both mobile web and web platforms to perform directional swipes within element bounds, with point coordinate calculations based on direction (up/down/left/right).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Coordinate calculation logic: Verify calculateXOffset/calculateYOffset implementations are consistent across platforms (Android, iOS, Mobile Web) and correctly handle all relative positions (center, right, left, top, bottom).
  • Swipe point calculations: Review getPointInElement helper methods across platforms to ensure boundary constraints and directional point derivation are accurate.
  • Pause and scroll handling: The MobileWeb actions with pause handling (MoveElementRelativeToReferenceWithPause, MoveElementToReferenceWithMultiplePause) have additional complexity with bounding rect retrieval, scroll logic, and wait mechanisms that warrant careful review.
  • Error handling consistency: Confirm exception handling patterns (NoSuchElementException, MoveTargetOutOfBoundsException) and result status updates are uniform across implementations.
  • Actions sequence correctness: Verify Appium/Selenium Actions sequences (moveToElement, clickAndHold, release) are properly ordered and called for each platform's driver.

Possibly related PRs

Suggested reviewers

  • Ganesh-Testsigma
  • vigneshtestsigma

Poem

🐰 Hop along, drag and swipe with glee,
Across Android, iOS, Web—unified harmony!
Pause and scroll, calculate offsets true,
These elements dance where we bid them to.
From top to bottom, left to right,
Testsigma's reach extends its might!

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 describes the main change: adding swipe actions within elements across multiple platforms, matching the PR's primary objective of introducing swipe functionality.
✨ 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-9590

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: 13

🧹 Nitpick comments (9)
drag_actions/src/main/java/com/testsigma/addons/mobileWeb/MoveElementRelativeToReference.java (1)

41-44: Consider explicit handling for invalid numeric input.

Integer.parseInt() can throw NumberFormatException if the offset values are not valid integers. While the generic Exception handler catches this, the error message would not be user-friendly. Consider validating the input explicitly.

+        int xOffset;
+        int yOffset;
+        try {
+            xOffset = Integer.parseInt(xOffsetData.getValue().toString());
+            yOffset = Integer.parseInt(yOffsetData.getValue().toString());
+        } catch (NumberFormatException e) {
+            setErrorMessage("Invalid offset values. xOffset and yOffset must be integers.");
+            return com.testsigma.sdk.Result.FAILED;
+        }
-        int xOffset = Integer.parseInt(xOffsetData.getValue().toString());
-        int yOffset = Integer.parseInt(yOffsetData.getValue().toString());
         logger.info("xOffset: " + xOffset + " yOffset: " + yOffset);
drag_actions/src/main/java/com/testsigma/addons/android/MoveElementRelativeToReference.java (1)

43-44: Consider explicit handling for invalid numeric input.

Same as the mobileWeb version: Integer.parseInt() can throw NumberFormatException with an unclear error message if offset values are invalid.

drag_actions/src/main/java/com/testsigma/addons/mobileWeb/MoveElementRelativeToReferenceWithPause.java (1)

70-72: Redundant element lookups.

dragElement and dropElement are already found on lines 55-56 as dragWebElement and dropWebElement. Reuse those variables instead of calling driver.findElement() again.

-            Point startPoint = getCenterPoint(driver.findElement(dragElement.getBy()));
-            targetPoint = calculateTargetPoint(driver.findElement(dropElement.getBy()),
+            Point startPoint = getCenterPoint(dragWebElement);
+            targetPoint = calculateTargetPoint(dropWebElement,
                     relativePosition, xOffset, yOffset);
drag_actions/src/main/java/com/testsigma/addons/android/DragElementToReference.java (1)

24-26: Clean up placeholder message and redundant throws declaration.

The log message is a placeholder and should be updated. Additionally, throws NoSuchElementException is redundant since the exception is caught internally.

     @Override
-    public com.testsigma.sdk.Result execute() throws NoSuchElementException {
-        logger.info("your awesome code starts here");
+    public com.testsigma.sdk.Result execute() {
+        logger.info("Executing drag element to reference");
         com.testsigma.sdk.Result result = com.testsigma.sdk.Result.SUCCESS;
drag_actions/src/main/java/com/testsigma/addons/mobileWeb/DragElementToReference.java (1)

22-24: Clean up placeholder message and redundant throws declaration.

Same as the Android version: the log message is a placeholder and the throws NoSuchElementException is redundant since the exception is caught internally.

     @Override
-    public com.testsigma.sdk.Result execute() throws NoSuchElementException {
-        logger.info("your awesome code starts here");
+    public com.testsigma.sdk.Result execute() {
+        logger.info("Executing drag element to reference");
         com.testsigma.sdk.Result result = com.testsigma.sdk.Result.SUCCESS;
drag_actions/src/main/java/com/testsigma/addons/ios/DragElementToReference.java (2)

27-27: Replace placeholder logger message with descriptive text.

The message "your awesome code starts here" appears to be a placeholder from a template and should be replaced with a descriptive log message for production code.

Apply this diff:

-        logger.info("your awesome code starts here");
+        logger.info("Starting drag operation from element to reference element");

38-38: Fix grammar in success message.

The message uses present tense "drag" but should use past tense "dragged" since the action has completed.

Apply this diff:

-            setSuccessMessage("Successfully drag the element to reference element reference-element");
+            setSuccessMessage("Successfully dragged the element to reference element");
drag_actions/src/main/java/com/testsigma/addons/mobileWeb/MoveElementToReferenceWithMultiplePause.java (2)

62-64: Reuse previously fetched WebElements to avoid redundant lookups.

The code fetches elements on lines 49-50 as dragWebElement and dropWebElement, but then re-fetches them on lines 62-64 using driver.findElement(...). This is redundant and increases the risk of StaleElementReferenceException if the DOM changes between fetches. Reuse the existing WebElement references.

Apply this diff:

             logger.info("waited for 1 second before calculating drop location");
 
-            Point startPoint = dragActionUtils.getCenterPoint(driver.findElement(dragElement.getBy()));
-            targetPoint = dragActionUtils.calculateTargetPoint(driver.findElement(dropElement.getBy()),
+            Point startPoint = dragActionUtils.getCenterPoint(dragWebElement);
+            targetPoint = dragActionUtils.calculateTargetPoint(dropWebElement,
                     relativePosition, xOffset, yOffset);

76-76: Consider using consistent logger level.

Line 76 uses logger.debug while the rest of the file uses logger.info for logging. Consider using logger.info for consistency, or ensure debug-level logging is intentional for this specific case.

📜 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 2431e93.

📒 Files selected for processing (12)
  • drag_actions/src/main/java/com/testsigma/addons/android/DragElementToReference.java (1 hunks)
  • drag_actions/src/main/java/com/testsigma/addons/android/MoveElementRelativeToReference.java (1 hunks)
  • drag_actions/src/main/java/com/testsigma/addons/android/SwipeWithInElement.java (1 hunks)
  • drag_actions/src/main/java/com/testsigma/addons/ios/DragElementToReference.java (1 hunks)
  • drag_actions/src/main/java/com/testsigma/addons/ios/MoveElementRelativeToReference.java (1 hunks)
  • drag_actions/src/main/java/com/testsigma/addons/ios/SwipeWithInElement.java (1 hunks)
  • drag_actions/src/main/java/com/testsigma/addons/mobileWeb/DragElementToReference.java (1 hunks)
  • drag_actions/src/main/java/com/testsigma/addons/mobileWeb/MoveElementRelativeToReference.java (1 hunks)
  • drag_actions/src/main/java/com/testsigma/addons/mobileWeb/MoveElementRelativeToReferenceWithPause.java (1 hunks)
  • drag_actions/src/main/java/com/testsigma/addons/mobileWeb/MoveElementToReferenceWithMultiplePause.java (1 hunks)
  • drag_actions/src/main/java/com/testsigma/addons/mobileWeb/SwipeWithInElement.java (1 hunks)
  • drag_actions/src/main/java/com/testsigma/addons/web/SwipeWithInElement.java (1 hunks)
🔇 Additional comments (9)
drag_actions/src/main/java/com/testsigma/addons/mobileWeb/MoveElementRelativeToReference.java (1)

77-107: LGTM!

The helper methods for calculating offsets based on relative position are well-structured and handle all allowed position values correctly.

drag_actions/src/main/java/com/testsigma/addons/mobileWeb/MoveElementRelativeToReferenceWithPause.java (1)

96-134: LGTM!

The helper methods getCenterPoint and calculateTargetPoint correctly compute coordinates using bounding client rect, and appropriately throw an exception for invalid relative positions.

drag_actions/src/main/java/com/testsigma/addons/android/DragElementToReference.java (1)

28-46: LGTM!

The drag-and-drop implementation using Selenium Actions is correct, and error handling appropriately catches and reports both NoSuchElementException and generic exceptions.

drag_actions/src/main/java/com/testsigma/addons/mobileWeb/DragElementToReference.java (1)

26-44: LGTM!

The implementation correctly uses Selenium Actions for the mobileWeb platform with appropriate error handling.

drag_actions/src/main/java/com/testsigma/addons/android/SwipeWithInElement.java (2)

67-86: LGTM!

The getPointInElement helper correctly computes coordinates within element bounds for all four directions with appropriate padding (10px) from the edges.


12-16: Wrong exception import will cause compilation failure.

java.util.NoSuchElementException does not exist. Use org.openqa.selenium.NoSuchElementException. Also, WebDriver import is unused.

 import io.appium.java_client.android.AndroidDriver;
 import org.openqa.selenium.Point;
-import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;

-import java.util.NoSuchElementException;
+import org.openqa.selenium.NoSuchElementException;

Likely an incorrect or invalid review comment.

drag_actions/src/main/java/com/testsigma/addons/ios/MoveElementRelativeToReference.java (1)

80-110: LGTM!

The offset calculation helpers correctly compute target positions relative to the reference element for all supported positions (center, right, left, top, bottom).

drag_actions/src/main/java/com/testsigma/addons/mobileWeb/SwipeWithInElement.java (2)

29-62: LGTM!

The execute method correctly handles the swipe gesture flow: locates the element, computes start/end points based on directions, performs the swipe action, and properly handles exceptions.


14-14: Wrong exception import will cause compilation failure.

java.util.NoSuchElementException does not exist. Use org.openqa.selenium.NoSuchElementException.

-import java.util.NoSuchElementException;
+import org.openqa.selenium.NoSuchElementException;

Likely an incorrect or invalid review comment.


import com.testsigma.sdk.AndroidAction;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.WebAction;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Remove unused import.

WebAction is imported but not used. This class extends AndroidAction.

-import com.testsigma.sdk.WebAction;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import com.testsigma.sdk.WebAction;
🤖 Prompt for AI Agents
In
drag_actions/src/main/java/com/testsigma/addons/android/DragElementToReference.java
around line 5, remove the unused import statement for
com.testsigma.sdk.WebAction since this class extends AndroidAction and does not
reference WebAction; simply delete that import to clean up unused imports and
ensure no compile impacts.


import com.testsigma.sdk.AndroidAction;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.WebAction;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Remove unused import.

WebAction is imported but not used. This class extends AndroidAction.

-import com.testsigma.sdk.WebAction;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import com.testsigma.sdk.WebAction;
🤖 Prompt for AI Agents
In
drag_actions/src/main/java/com/testsigma/addons/android/MoveElementRelativeToReference.java
around line 6, the import statement for com.testsigma.sdk.WebAction is unused
(this class extends AndroidAction); remove that import line and
reformat/organize the remaining imports to avoid unused-import warnings.

logger.info(ExceptionUtils.getStackTrace(e));
result = com.testsigma.sdk.Result.FAILED;
} catch (MoveTargetOutOfBoundsException e) {
setErrorMessage("Target location" + targetXOffset +"," + targetYOffset +"is out of bounds: " + e.getMessage());
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Missing space in error message.

Same formatting issue as the mobileWeb version.

-            setErrorMessage("Target location" + targetXOffset +"," + targetYOffset +"is out of bounds: " + e.getMessage());
+            setErrorMessage("Target location " + targetXOffset + "," + targetYOffset + " is out of bounds: " + e.getMessage());
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
setErrorMessage("Target location" + targetXOffset +"," + targetYOffset +"is out of bounds: " + e.getMessage());
setErrorMessage("Target location " + targetXOffset + "," + targetYOffset + " is out of bounds: " + e.getMessage());
🤖 Prompt for AI Agents
In
drag_actions/src/main/java/com/testsigma/addons/android/MoveElementRelativeToReference.java
around line 71, the error message concatenation lacks spaces resulting in
"Target location10,20is out of bounds..."; update the string concatenation to
include spaces and a comma: build the message as "Target location " +
targetXOffset + ", " + targetYOffset + " is out of bounds: " + e.getMessage() so
spacing matches the mobileWeb version and the message reads correctly.

Comment on lines +3 to +8
import com.testsigma.sdk.AndroidAction;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.IOSAction;
import com.testsigma.sdk.annotation.Action;
import com.testsigma.sdk.annotation.Element;
import io.appium.java_client.android.AndroidDriver;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused Android imports from iOS class.

The file imports AndroidAction (line 3) and AndroidDriver (line 8), which are not used in this iOS-specific action class. These appear to be copy-paste artifacts from an Android implementation.

Apply this diff to remove the unused imports:

-import com.testsigma.sdk.AndroidAction;
 import com.testsigma.sdk.ApplicationType;
 import com.testsigma.sdk.IOSAction;
 import com.testsigma.sdk.annotation.Action;
 import com.testsigma.sdk.annotation.Element;
-import io.appium.java_client.android.AndroidDriver;
 import io.appium.java_client.ios.IOSDriver;

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
drag_actions/src/main/java/com/testsigma/addons/ios/DragElementToReference.java
around lines 3 to 8, remove the unused Android-specific imports (import
com.testsigma.sdk.AndroidAction; and import
io.appium.java_client.android.AndroidDriver;) which are copy-paste artifacts;
keep only the iOS-relevant imports (e.g., IOSAction, ApplicationType, annotation
imports) so the class compiles without unused import warnings.

Comment on lines +4 to +21
import com.testsigma.sdk.AndroidAction;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.annotation.Action;
import com.testsigma.sdk.annotation.Element;
import com.testsigma.sdk.annotation.TestData;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.ios.IOSDriver;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.interactions.MoveTargetOutOfBoundsException;

@Action(actionText = "Drag element elementLocator to the relativePosition of the referenceElement with " +
"offset x: xOffset , y: yOffset",
applicationType = ApplicationType.ANDROID,
useCustomScreenshot = false)
public class MoveElementRelativeToReference extends AndroidAction {
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: iOS action incorrectly extends AndroidAction and uses wrong ApplicationType.

This class is in the ios package and uses IOSDriver, but extends AndroidAction and declares ApplicationType.ANDROID. It should extend IOSAction and use ApplicationType.IOS.

-import com.testsigma.sdk.AndroidAction;
+import com.testsigma.sdk.IOSAction;
 import com.testsigma.sdk.ApplicationType;
 import com.testsigma.sdk.annotation.Action;
 import com.testsigma.sdk.annotation.Element;
 import com.testsigma.sdk.annotation.TestData;
-import io.appium.java_client.android.AndroidDriver;
 import io.appium.java_client.ios.IOSDriver;
 import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.openqa.selenium.NoSuchElementException;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.interactions.MoveTargetOutOfBoundsException;

 @Action(actionText = "Drag element elementLocator to the relativePosition of the referenceElement with " +
         "offset x: xOffset , y: yOffset",
-        applicationType = ApplicationType.ANDROID,
+        applicationType = ApplicationType.IOS,
         useCustomScreenshot = false)
-public class MoveElementRelativeToReference extends AndroidAction {
+public class MoveElementRelativeToReference extends IOSAction {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import com.testsigma.sdk.AndroidAction;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.annotation.Action;
import com.testsigma.sdk.annotation.Element;
import com.testsigma.sdk.annotation.TestData;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.ios.IOSDriver;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.interactions.MoveTargetOutOfBoundsException;
@Action(actionText = "Drag element elementLocator to the relativePosition of the referenceElement with " +
"offset x: xOffset , y: yOffset",
applicationType = ApplicationType.ANDROID,
useCustomScreenshot = false)
public class MoveElementRelativeToReference extends AndroidAction {
import com.testsigma.sdk.IOSAction;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.annotation.Action;
import com.testsigma.sdk.annotation.Element;
import com.testsigma.sdk.annotation.TestData;
import io.appium.java_client.ios.IOSDriver;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.interactions.MoveTargetOutOfBoundsException;
@Action(actionText = "Drag element elementLocator to the relativePosition of the referenceElement with " +
"offset x: xOffset , y: yOffset",
applicationType = ApplicationType.IOS,
useCustomScreenshot = false)
public class MoveElementRelativeToReference extends IOSAction {
🤖 Prompt for AI Agents
In
drag_actions/src/main/java/com/testsigma/addons/ios/MoveElementRelativeToReference.java
around lines 4 to 21, the class incorrectly extends AndroidAction and declares
ApplicationType.ANDROID despite being an iOS action; change the import and base
class from com.testsigma.sdk.AndroidAction to com.testsigma.sdk.IOSAction,
update the @Action annotation to use applicationType = ApplicationType.IOS, and
adjust any other Android-specific imports/usages to their iOS equivalents so the
class correctly targets iOS.

logger.info(ExceptionUtils.getStackTrace(e));
result = com.testsigma.sdk.Result.FAILED;
} catch (MoveTargetOutOfBoundsException e) {
setErrorMessage("Target location" + targetXOffset +"," + targetYOffset +"is out of bounds: " + e.getMessage());
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Missing space in error message.

The error message is missing a space before "is out of bounds".

-            setErrorMessage("Target location" + targetXOffset +"," + targetYOffset +"is out of bounds: " + e.getMessage());
+            setErrorMessage("Target location " + targetXOffset + "," + targetYOffset + " is out of bounds: " + e.getMessage());
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
setErrorMessage("Target location" + targetXOffset +"," + targetYOffset +"is out of bounds: " + e.getMessage());
setErrorMessage("Target location " + targetXOffset + "," + targetYOffset + " is out of bounds: " + e.getMessage());
🤖 Prompt for AI Agents
In
drag_actions/src/main/java/com/testsigma/addons/mobileWeb/MoveElementRelativeToReference.java
around line 67, the concatenated error message lacks spaces ("Target location" +
targetXOffset +"," + targetYOffset +"is..."); update the string concatenation to
include spaces so it reads like "Target location " + targetXOffset + ", " +
targetYOffset + " is out of bounds: " + e.getMessage(), ensuring a space after
"Target location", after the comma, and before "is".

Comment on lines +61 to +68
try {
this.restStepWait(1);
} catch (Exception e) {
logger.info("Error occurred while waiting for element " + ExceptionUtils.getStackTrace(e));
setErrorMessage("Error occurred while waiting for element " + ExceptionUtils.getStackTrace(e));
result = com.testsigma.sdk.Result.FAILED;
}
logger.info("waited for 1 second before calculating drop location");
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Execution continues after wait failure which may cause unreliable results.

When restStepWait fails, the result is set to FAILED but execution continues to perform the drag operation. Consider returning early or restructuring the error handling.

             try {
                 this.restStepWait(1);
             } catch (Exception e) {
                 logger.info("Error occurred while waiting for element " + ExceptionUtils.getStackTrace(e));
                 setErrorMessage("Error occurred while waiting for element " + ExceptionUtils.getStackTrace(e));
-                result = com.testsigma.sdk.Result.FAILED;
+                return com.testsigma.sdk.Result.FAILED;
             }
             logger.info("waited for 1 second before calculating drop location");
🤖 Prompt for AI Agents
In
drag_actions/src/main/java/com/testsigma/addons/mobileWeb/MoveElementRelativeToReferenceWithPause.java
around lines 61 to 68, the catch block sets result to FAILED but execution
continues (causing unreliable behavior); update error handling so that on
exception you either return immediately (or throw) after setting the error
message and result to prevent further drag logic from running, ensuring no
subsequent calculations or actions occur when restStepWait fails.

Comment on lines +176 to +184
private void restStepWait(Integer waitInSeconds) {
synchronized (this) {
try {
this.wait((waitInSeconds * 1000) - 10);
} catch (Exception e) {
logger.info(ExceptionUtils.getStackTrace(e));
setErrorMessage("Unable to minimize window. Error: " + ExceptionUtils.getStackTrace(e));
}
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Misleading error message in restStepWait.

The error message references "minimize window" which appears to be a copy-paste error from a different method.

     private void restStepWait(Integer waitInSeconds) {
         synchronized (this) {
             try {
                 this.wait((waitInSeconds * 1000) - 10);
             } catch (Exception e) {
                 logger.info(ExceptionUtils.getStackTrace(e));
-                setErrorMessage("Unable to minimize window. Error: " + ExceptionUtils.getStackTrace(e));
+                setErrorMessage("Error during wait: " + e.getMessage());
             }
         }
     }
🤖 Prompt for AI Agents
In
drag_actions/src/main/java/com/testsigma/addons/mobileWeb/MoveElementRelativeToReferenceWithPause.java
around lines 176-184, the catch block in restStepWait logs and sets an error
message that incorrectly says "Unable to minimize window" (copy-paste error);
update the error text to accurately reflect the wait operation (e.g., "Unable to
wait for X seconds" or "Error during restStepWait") and include relevant details
such as waitInSeconds and the exception message/stacktrace in the
setErrorMessage call so the log and error message correctly describe the
failure.

Comment on lines +53 to +59
try {
dragActionUtils.restStepWait(1);
} catch (Exception e) {
logger.info("Error occurred while waiting for element " + ExceptionUtils.getStackTrace(e));
setErrorMessage("Error occurred while waiting for element " + ExceptionUtils.getStackTrace(e));
result = com.testsigma.sdk.Result.FAILED;
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Return immediately after marking result as FAILED.

After setting the result to FAILED (line 58), the code continues execution instead of returning. This means the drag-and-drop operation will still be attempted even though the wait failed, which could lead to unexpected behavior or misleading error messages.

Apply this diff to return immediately after failure:

             try {
                 dragActionUtils.restStepWait(1);
             } catch (Exception e) {
                 logger.info("Error occurred while waiting for element " + ExceptionUtils.getStackTrace(e));
                 setErrorMessage("Error occurred while waiting for element " + ExceptionUtils.getStackTrace(e));
-                result = com.testsigma.sdk.Result.FAILED;
+                return com.testsigma.sdk.Result.FAILED;
             }
🤖 Prompt for AI Agents
In
drag_actions/src/main/java/com/testsigma/addons/mobileWeb/MoveElementToReferenceWithMultiplePause.java
around lines 53 to 59, after catching the exception and setting result =
com.testsigma.sdk.Result.FAILED (and setting the error message), return
immediately to stop further execution of the step; change control flow so the
method exits right after marking failure (e.g., return the FAILED result) to
prevent the drag-and-drop from being attempted when the wait failed.

Comment on lines +4 to +16
import com.testsigma.sdk.AndroidAction;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.WebAction;
import com.testsigma.sdk.annotation.Action;
import com.testsigma.sdk.annotation.Element;
import com.testsigma.sdk.annotation.TestData;
import io.appium.java_client.ios.IOSDriver;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

import java.util.NoSuchElementException;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Wrong exception import and unused imports.

The java.util.NoSuchElementException does not exist—use org.openqa.selenium.NoSuchElementException. Also, AndroidAction and IOSDriver are unused imports.

-import com.testsigma.sdk.AndroidAction;
 import com.testsigma.sdk.ApplicationType;
 import com.testsigma.sdk.Result;
 import com.testsigma.sdk.WebAction;
 import com.testsigma.sdk.annotation.Action;
 import com.testsigma.sdk.annotation.Element;
 import com.testsigma.sdk.annotation.TestData;
-import io.appium.java_client.ios.IOSDriver;
 import org.openqa.selenium.Point;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;

-import java.util.NoSuchElementException;
+import org.openqa.selenium.NoSuchElementException;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import com.testsigma.sdk.AndroidAction;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.WebAction;
import com.testsigma.sdk.annotation.Action;
import com.testsigma.sdk.annotation.Element;
import com.testsigma.sdk.annotation.TestData;
import io.appium.java_client.ios.IOSDriver;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import java.util.NoSuchElementException;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.WebAction;
import com.testsigma.sdk.annotation.Action;
import com.testsigma.sdk.annotation.Element;
import com.testsigma.sdk.annotation.TestData;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.NoSuchElementException;
🤖 Prompt for AI Agents
In drag_actions/src/main/java/com/testsigma/addons/web/SwipeWithInElement.java
around lines 4 to 16, replace the incorrect import
java.util.NoSuchElementException with org.openqa.selenium.NoSuchElementException
and remove the unused imports AndroidAction and
io.appium.java_client.ios.IOSDriver (and any other unused imports if present);
ensure the remaining imports are organized and the class compiles without
unused-import warnings.

@ManojTestsigma ManojTestsigma merged commit 9a4c050 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