-
Notifications
You must be signed in to change notification settings - Fork 16
[CUS-9590] added action to swipe from left to right etc.. in element. #278
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 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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. Comment |
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: 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 throwNumberFormatExceptionif the offset values are not valid integers. While the genericExceptionhandler 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 throwNumberFormatExceptionwith 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.
dragElementanddropElementare already found on lines 55-56 asdragWebElementanddropWebElement. Reuse those variables instead of callingdriver.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 NoSuchElementExceptionis 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 NoSuchElementExceptionis 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
dragWebElementanddropWebElement, but then re-fetches them on lines 62-64 usingdriver.findElement(...). This is redundant and increases the risk ofStaleElementReferenceExceptionif 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.debugwhile the rest of the file useslogger.infofor logging. Consider usinglogger.infofor consistency, or ensure debug-level logging is intentional for this specific case.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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
getCenterPointandcalculateTargetPointcorrectly 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
NoSuchElementExceptionand 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
getPointInElementhelper 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.NoSuchElementExceptiondoes not exist. Useorg.openqa.selenium.NoSuchElementException. Also,WebDriverimport 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.NoSuchElementExceptiondoes not exist. Useorg.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; |
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.
🛠️ 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.
| 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; |
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.
🛠️ 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.
| 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()); |
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.
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.
| 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.
| 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; |
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.
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.
| 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 { |
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.
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.
| 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()); |
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.
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.
| 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".
| 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"); |
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.
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.
| 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)); | ||
| } | ||
| } |
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.
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.
| 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; | ||
| } |
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.
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.
| 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; |
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.
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.
| 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.
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
✏️ Tip: You can customize this high-level summary in your review settings.