Skip to content

feat/CUS-11086-Added class to clear the input field using backspace#353

Merged
akhil-testsigma merged 1 commit into
devfrom
feat/CUS-11086-Added-class-to-clear-the-input-field-using-backspace
Mar 6, 2026
Merged

feat/CUS-11086-Added class to clear the input field using backspace#353
akhil-testsigma merged 1 commit into
devfrom
feat/CUS-11086-Added-class-to-clear-the-input-field-using-backspace

Conversation

@akhil-testsigma
Copy link
Copy Markdown
Contributor

@akhil-testsigma akhil-testsigma commented Mar 5, 2026

Publish this addon as PUBLIC

Addon Name: Clear Input Field Using Backspace
Jarvis Link: https://jarvis.testsigma.com/ui/tenants/2817/addons
Jira : https://testsigma.atlassian.net/browse/CUS-11086
Added class to clear the input field using backspace

Summary by CodeRabbit

  • New Features
    • Added a new action to clear input fields using backspace keystrokes, supporting both web and mobile platforms.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

A new Maven Java project is introduced that provides custom Testsigma action classes for clearing input fields using backspace keystrokes. The project includes separate implementations for web and mobile web environments, along with standard build configuration and dependencies on Selenium, TestNG, and Testsigma SDK.

Changes

Cohort / File(s) Summary
Maven Project Configuration
clear_input_field_using_backspace/pom.xml
Defines project coordinates, build properties (encoding, Java version), dependencies (Testsigma SDK, Selenium, TestNG, Lombok, Jackson, Commons Lang), and plugins (maven-shade, maven-source) for packaging and source artifact generation.
Web Action Classes
clear_input_field_using_backspace/src/main/java/com/testsigma/addons/web/ClearUsingBackspace.java, clear_input_field_using_backspace/src/main/java/com/testsigma/addons/mobileweb/ClearUsingBackspace.java
Two similar WebAction classes that clear input field text by clicking the element, moving cursor to end, reading current value, and iterating backspace keys. Both include logging, success/failure result handling, and exception capture with stack trace.
SDK Configuration
clear_input_field_using_backspace/src/main/resources/testsigma-sdk.properties
Single property file defining the testsigma-sdk.api.key configuration value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • vigneshtestsigma
  • Ganesh-Testsigma

Poem

A rabbit hops through the code with glee,
Backspaces dancing, input fields freed! 🐰
Clear as a carrot, twice for each kind,
Web and mobile—no text left behind! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 a class to clear input fields using backspace across web and mobile-web implementations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/CUS-11086-Added-class-to-clear-the-input-field-using-backspace

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
Copy Markdown

@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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@clear_input_field_using_backspace/src/main/java/com/testsigma/addons/web/ClearUsingBackspace.java`:
- Around line 53-54: The code in ClearUsingBackspace currently prints the full
stack trace and raw exception message; replace those with non-sensitive,
user-friendly messages: change logger.warn("Failed to clear the input field: " +
ExceptionUtils.getStackTrace(e)) to a generic warn like logger.warn("Failed to
clear the input field") and, if you need the exception for debugging, log the
stacktrace at debug level (e.g., logger.debug("clear failure", e)). Replace
setErrorMessage("Failed to clear the input field due to: " +
ExceptionUtils.getMessage(e)) with a generic user-facing message such as
setErrorMessage("Failed to clear the input field.") and optionally include a
short, non-sensitive error code or e.getClass().getSimpleName() if you need
minimal diagnostic info.
- Around line 48-50: The code in ClearUsingBackspace sets result to SUCCESS
(using logger, setSuccessMessage, and result) without verifying the field was
actually cleared; modify the clear routine in the ClearUsingBackspace class to
read the field value after sending backspaces (e.g., via
element.getAttribute("value") or element.getText()), perform a short retry loop
with a few small waits to allow JS to update, and only set result =
com.testsigma.sdk.Result.SUCCESS and call setSuccessMessage(...) if the
post-condition shows an empty value; otherwise set an appropriate failure
result/message.

In
`@clear_input_field_using_backspace/src/main/resources/testsigma-sdk.properties`:
- Line 1: The committed file contains a plaintext SDK API key under the property
testsigma-sdk.api.key; remove this secret from the repository immediately,
rotate the exposed key in the provider, purge it from git history (e.g., git
filter-repo or BFG), and replace the hardcoded entry with a secure runtime
lookup (e.g., read testsigma API key from an environment variable or injected
secret manager value and reference that variable name where
testsigma-sdk.api.key was used). Ensure any code that referenced
testsigma-sdk.api.key is updated to read from the new secure source and add the
property name (or env var) to the project's .gitignore and secrets documentation
so future commits do not reintroduce secrets.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bfc94b11-e853-4321-aebb-896764ae437f

📥 Commits

Reviewing files that changed from the base of the PR and between 7be2387 and 4ff3c86.

📒 Files selected for processing (4)
  • clear_input_field_using_backspace/pom.xml
  • clear_input_field_using_backspace/src/main/java/com/testsigma/addons/mobileweb/ClearUsingBackspace.java
  • clear_input_field_using_backspace/src/main/java/com/testsigma/addons/web/ClearUsingBackspace.java
  • clear_input_field_using_backspace/src/main/resources/testsigma-sdk.properties

Comment on lines +48 to +50
logger.info("Successfully cleared the input field using backspace");
setSuccessMessage("Successfully cleared the input field using backspace");
result = com.testsigma.sdk.Result.SUCCESS;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Verify the field is actually empty before returning SUCCESS.

Line 48-Line 50 marks success without validating the clear operation outcome. If key events are ignored/intercepted, this can return a false positive.

✅ Proposed post-condition check
       if (text != null) {
         for (int i = 0; i < text.length(); i++) {
           webElement.sendKeys(Keys.BACK_SPACE);
         }
       }
+
+      String remaining = webElement.getAttribute("value");
+      if (remaining != null && !remaining.isEmpty()) {
+        setErrorMessage("Unable to clear the input field completely.");
+        return com.testsigma.sdk.Result.FAILED;
+      }
 
       logger.info("Successfully cleared the input field using backspace");
       setSuccessMessage("Successfully cleared the input field using backspace");
       result = com.testsigma.sdk.Result.SUCCESS;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@clear_input_field_using_backspace/src/main/java/com/testsigma/addons/web/ClearUsingBackspace.java`
around lines 48 - 50, The code in ClearUsingBackspace sets result to SUCCESS
(using logger, setSuccessMessage, and result) without verifying the field was
actually cleared; modify the clear routine in the ClearUsingBackspace class to
read the field value after sending backspaces (e.g., via
element.getAttribute("value") or element.getText()), perform a short retry loop
with a few small waits to allow JS to update, and only set result =
com.testsigma.sdk.Result.SUCCESS and call setSuccessMessage(...) if the
post-condition shows an empty value; otherwise set an appropriate failure
result/message.

Comment on lines +53 to +54
logger.warn("Failed to clear the input field: " + ExceptionUtils.getStackTrace(e));
setErrorMessage("Failed to clear the input field due to: " + ExceptionUtils.getMessage(e));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Avoid exposing internal exception details in logs/error messages.

Line 53-Line 54 logs full stack trace text and propagates raw exception details to user-visible error messaging.

🛡️ Proposed safer error handling
-      logger.warn("Failed to clear the input field: " + ExceptionUtils.getStackTrace(e));
-      setErrorMessage("Failed to clear the input field due to: " + ExceptionUtils.getMessage(e));
+      logger.warn("Failed to clear the input field", e);
+      setErrorMessage("Failed to clear the input field.");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@clear_input_field_using_backspace/src/main/java/com/testsigma/addons/web/ClearUsingBackspace.java`
around lines 53 - 54, The code in ClearUsingBackspace currently prints the full
stack trace and raw exception message; replace those with non-sensitive,
user-friendly messages: change logger.warn("Failed to clear the input field: " +
ExceptionUtils.getStackTrace(e)) to a generic warn like logger.warn("Failed to
clear the input field") and, if you need the exception for debugging, log the
stacktrace at debug level (e.g., logger.debug("clear failure", e)). Replace
setErrorMessage("Failed to clear the input field due to: " +
ExceptionUtils.getMessage(e)) with a generic user-facing message such as
setErrorMessage("Failed to clear the input field.") and optionally include a
short, non-sensitive error code or e.getClass().getSimpleName() if you need
minimal diagnostic info.

@@ -0,0 +1 @@
testsigma-sdk.api.key=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyMjMyMmM2Ni04NWYzLWIyN2UtN2FiOS0zM2U2M2Q4OWM1MGIiLCJ1bmlxdWVJZCI6IjYwMjgiLCJpZGVudGl0eUFjY291bnRVVUlkIjoiNDMifQ.rIHf0f0LSHgKeSgRC-HgRl8tvQHXiBPQbzj1-7XyFb1nvhen_SxrZBwFak4E3Kf1OX4kcavut0mnULWHk-5pBw No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Remove committed SDK API key from source control immediately.

Line 1 contains a real credential in plaintext. This is a direct secret exposure risk and should be treated as a blocker: rotate the key, remove it from git history, and load it from a secure runtime secret source.

🔐 Proposed safe replacement
-testsigma-sdk.api.key=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyMjMyMmM2Ni04NWYzLWIyN2UtN2FiOS0zM2U2M2Q4OWM1MGIiLCJ1bmlxdWVJZCI6IjYwMjgiLCJpZGVudGl0eUFjY291bnRVVUlkIjoiNDMifQ.rIHf0f0LSHgKeSgRC-HgRl8tvQHXiBPQbzj1-7XyFb1nvhen_SxrZBwFak4E3Kf1OX4kcavut0mnULWHk-5pBw
+testsigma-sdk.api.key=${TESTSIGMA_SDK_API_KEY}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@clear_input_field_using_backspace/src/main/resources/testsigma-sdk.properties`
at line 1, The committed file contains a plaintext SDK API key under the
property testsigma-sdk.api.key; remove this secret from the repository
immediately, rotate the exposed key in the provider, purge it from git history
(e.g., git filter-repo or BFG), and replace the hardcoded entry with a secure
runtime lookup (e.g., read testsigma API key from an environment variable or
injected secret manager value and reference that variable name where
testsigma-sdk.api.key was used). Ensure any code that referenced
testsigma-sdk.api.key is updated to read from the new secure source and add the
property name (or env var) to the project's .gitignore and secrets documentation
so future commits do not reintroduce secrets.

@akhil-testsigma akhil-testsigma merged commit 48ca770 into dev Mar 6, 2026
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.

2 participants