Skip to content

Cus 11221 - #357

Merged
ManojTestsigma merged 5 commits into
devfrom
CUS-11221
Mar 17, 2026
Merged

ManojTestsigma merged 5 commits into
devfrom
CUS-11221

Conversation

@ManojTestsigma

@ManojTestsigma ManojTestsigma commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

please review this addon and publish as PUBLIC

Addon name : mouseover_actions
Addon accont: https://jarvis.testsigma.com/ui/tenants/2817/addons
Jira: https://testsigma.atlassian.net/browse/CUS-11221

fix

Mouse overs on the given target text based on occurence position..

Summary by CodeRabbit

  • New Features

    • Added mouse-over actions for web and mobile-web platforms to interact with text detected via OCR, including support for targeting specific text occurrences.
  • Bug Fixes

    • Improved Base64 decoding to better handle URL-safe and standard encoding formats with automatic fallback detection.
  • Chores

    • Updated project version to 1.0.3.
    • Added Apache Commons Lang 3 dependency.

@coderabbitai

coderabbitai Bot commented Mar 17, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR enhances the base64_converter module with updated annotations and refined URL-safe Base64 decoding logic featuring automatic detection and fallback mechanisms. It introduces a new mouseover_actions module providing OCR-based mouse-over functionality for web and mobile-web platforms, including text detection at specific occurrences.

Changes

Cohort / File(s) Summary
Base64 Converter Updates
base64_converter/pom.xml, base64_converter/src/main/java/com/testsigma/addons/generators/Base64Converter.java, base64_converter/src/main/java/com/testsigma/addons/generators/DecodeStringToBase64.java
Version bumped to 1.0.3, commons-lang3 dependency added. Annotation displayNames and descriptions updated for clarity. DecodeStringToBase64 introduces robust decoding with URL-safe detection, standard/URL-safe format switching, and fallback logic with logging.
MouseOver Actions Module Configuration
mouseover_actions/pom.xml, mouseover_actions/src/main/resources/testsigma-sdk.properties
New Maven module with POM configuration including testsigma-sdk, lombok, Selenium, Appium, Jackson, and commons-lang3 dependencies. Shade plugin configured for dependency packaging.
MouseOver Web Actions
mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnText.java, mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnTextAtOccurrence.java
Two new WebAction classes implementing OCR-based text detection and mouse-over functionality. MouseOverOnText finds the first occurrence; MouseOverOnTextAtOccurrence targets the Nth occurrence. Both include coordinate calculation, error handling, and detailed logging.
MouseOver Mobile-Web Actions
mouseover_actions/src/main/java/com/testsigma/addons/mobileweb/MouseOverOnText.java, mouseover_actions/src/main/java/com/testsigma/addons/mobileweb/MouseOverOnTextAtOccurrence.java
Two new WebAction classes mirroring web implementations for MOBILE_WEB platform. Identical OCR-based text detection and mouse-over logic with platform-specific metadata and same validation, coordinate, and error handling patterns.

Sequence Diagram

sequenceDiagram
    participant User
    participant OCRAction as MouseOver Action
    participant WebDriver
    participant OCR
    participant SeleniumActions as Selenium Actions

    User->>OCRAction: Trigger mouse-over on text (with/without occurrence)
    OCRAction->>WebDriver: Capture screenshot
    WebDriver-->>OCRAction: Screenshot image
    OCRAction->>OCR: Run OCR on screenshot
    OCR-->>OCRAction: List of OCRTextPoints (text regions)
    OCRAction->>OCRAction: Find matching text point<br/>(exact/case-insensitive/contains)
    alt Text found
        OCRAction->>OCRAction: Calculate center coordinates<br/>of text bounding box
        OCRAction->>SeleniumActions: Move mouse to coordinates
        SeleniumActions->>WebDriver: Execute mouse action
        WebDriver-->>SeleniumActions: Action complete
        SeleniumActions-->>OCRAction: Success
        OCRAction-->>User: SUCCESS
    else Text not found
        OCRAction-->>User: FAILED (text not found)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • vigneshtestsigma
  • Ganesh-Testsigma

Poem

🐰 A rabbit's delight in this changeset fine,
Base64 decoders now work by design,
With OCR eyes peering at text on the screen,
Mouse-over actions where words once have been,
Web and mobile both dancing in sync—hop hooray! 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Title check ❓ Inconclusive The pull request title 'Cus 11221' is vague and non-descriptive, consisting only of a reference to a Jira ticket without conveying any meaningful information about the changeset's purpose or primary change. Update the title to describe the main functionality added (e.g., 'Add mouse-over actions for text detection via OCR') rather than relying solely on a ticket reference.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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
  • Commit unit tests in branch CUS-11221
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can scan for known vulnerabilities in your dependencies using OSV Scanner.

OSV Scanner will automatically detect and report security vulnerabilities in your project's dependencies. No additional configuration is required.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (3)
mouseover_actions/src/main/java/com/testsigma/addons/mobileweb/MouseOverOnTextAtOccurrence.java (1)

84-94: Redundant condition in text matching.

The condition text.equals(tp.getText()) || text.equalsIgnoreCase(tp.getText()) is redundant. If equals() returns true, equalsIgnoreCase() will also return true. Simplify to just use equalsIgnoreCase().

♻️ Suggested fix
     private OCRTextPoint findTextPointAtOccurrence(List<OCRTextPoint> textPoints, String text, int targetOccurrence) {
         if (textPoints == null) return null;
         int currentOccurrence = 0;
         for (OCRTextPoint tp : textPoints) {
-            if (text.equals(tp.getText()) || text.equalsIgnoreCase(tp.getText())) {
+            if (text.equalsIgnoreCase(tp.getText())) {
                 currentOccurrence++;
                 if (currentOccurrence == targetOccurrence) return tp;
             }
         }
         return null;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@mouseover_actions/src/main/java/com/testsigma/addons/mobileweb/MouseOverOnTextAtOccurrence.java`
around lines 84 - 94, The loop in findTextPointAtOccurrence redundantly checks
text.equals(tp.getText()) || text.equalsIgnoreCase(tp.getText()); replace that
compound check with a single case-insensitive comparison (use
text.equalsIgnoreCase(tp.getText())) to simplify the logic and avoid redundancy,
keeping the rest of the method (null check for textPoints, occurrence counting
and return behavior) unchanged.
mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnText.java (1)

1-89: Consider extracting shared logic to reduce duplication.

The MouseOverOnText implementations for WEB and MOBILE_WEB are nearly identical, differing only in applicationType. Consider extracting the shared logic (screenshot capture, OCR processing, coordinate calculation, and helper methods) into a common base class or utility to reduce maintenance burden and ensure consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnText.java`
around lines 1 - 89, The WEB and MOBILE_WEB action classes duplicate the same
OCR+mouse-over logic; extract the shared behavior into a common base class or
utility and have both action classes delegate to it. Move the screenshot
capture, OCR extraction and parsing, coordinate calculation, and helper methods
(currently in execute(), findTextPoint(), logAvailableTextPoints()) into a new
abstract class or helper (e.g.,
AbstractMouseOverOnText.performMouseOver(targetText, driver, ocr) or instance
methods findTextPoint(...) and logAvailableTextPoints(...) there), keep only
Action-specific annotations and applicationType in the concrete MouseOverOnText
and MOBILE_WEB classes, and have their execute() call the shared method and
translate results into setSuccessMessage/setErrorMessage as needed.
mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnTextAtOccurrence.java (1)

84-94: Simplify redundant matching condition.

The condition text.equals(tp.getText()) || text.equalsIgnoreCase(tp.getText()) is redundant. If equals() returns true, equalsIgnoreCase() will also return true, so the effective behavior is just case-insensitive matching. Additionally, countMatches (line 100) uses only equalsIgnoreCase, creating inconsistency.

♻️ Proposed simplification
     private OCRTextPoint findTextPointAtOccurrence(List<OCRTextPoint> textPoints, String text, int targetOccurrence) {
         if (textPoints == null) return null;
         int currentOccurrence = 0;
         for (OCRTextPoint tp : textPoints) {
-            if (text.equals(tp.getText()) || text.equalsIgnoreCase(tp.getText())) {
+            if (text.equalsIgnoreCase(tp.getText())) {
                 currentOccurrence++;
                 if (currentOccurrence == targetOccurrence) return tp;
             }
         }
         return null;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnTextAtOccurrence.java`
around lines 84 - 94, The matching in findTextPointAtOccurrence uses a redundant
check (text.equals(...) || text.equalsIgnoreCase(...)) and is inconsistent with
countMatches which uses equalsIgnoreCase; change findTextPointAtOccurrence to
perform a single case-insensitive comparison (use equalsIgnoreCase) between text
and tp.getText() so both methods consistently use case-insensitive matching;
update only the comparison in the findTextPointAtOccurrence method to use
equalsIgnoreCase on the same operands (preserve null-safety if needed).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@base64_converter/src/main/java/com/testsigma/addons/generators/DecodeStringToBase64.java`:
- Around line 10-12: Rename the class DecodeStringToBase64 to
DecodeBase64ToString and update the
`@com.testsigma.sdk.annotation.TestDataFunction` annotation on that class to use
displayName = "Decode the input base64 string to plain text" and description =
"Decodes the input base64 string to plain text"; ensure any references to the
old class name (e.g., in tests or registration code) are updated to the new
class name DecodeBase64ToString so the runtime picks up the corrected name and
description.

In
`@mouseover_actions/src/main/java/com/testsigma/addons/mobileweb/MouseOverOnText.java`:
- Around line 56-57: The Actions call in MouseOverOnText (and similarly in
MouseOverOnTextAtOccurrence) uses a non-existent method moveToLocation; replace
it with a valid Selenium Actions API such as moveByOffset or moveToElement with
offsets: obtain the target WebElement (or reference origin) and call
Actions.moveToElement(element, xOffset, yOffset).perform() or
Actions.moveByOffset(x, y).perform() as appropriate, ensuring you compute
offsets from a known element or the current pointer before performing the
action; update the code in class MouseOverOnText to use the correct Actions
method and adjust any coordinate calculations accordingly.
- Around line 68-80: The findTextPoint method can NPE when tp.getText() is null;
update the method (findTextPoint) to null-check tp.getText() before calling
equals/equalsIgnoreCase/toLowerCase or otherwise compare safely (e.g., retrieve
String txt = tp.getText(); if (txt == null) continue; then use
txt.equals(targetText), txt.equalsIgnoreCase(targetText), and
txt.toLowerCase().contains(targetText.toLowerCase())) so all comparisons skip
null text values.

In
`@mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnText.java`:
- Around line 56-57: The call to Actions.moveToLocation is invalid and will
throw at runtime; replace it in MouseOverOnText.java where you create Actions
actions = new Actions(driver) by using a valid Actions API such as
moveByOffset(x, y) or moveToElement(targetElement, xOffset, yOffset) (depending
on whether you have an element to target) and then call perform(); ensure you
import and use org.openqa.selenium.interactions.Actions and pass the correct
offsets or element reference instead of moveToLocation.

In
`@mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnTextAtOccurrence.java`:
- Around line 49-53: The call to ocr.extractTextFromImage(ocrImage) may return
null and cause a NullPointerException when logger.info uses textPoints.size();
update the flow in MouseOverOnTextAtOccurrence (around variables screenshot,
ocrImage, textPoints) to null-guard the result of OCR.extractTextFromImage:
check if textPoints is null and replace it with Collections.emptyList() (or
handle the null case explicitly), then log using the safe list size and proceed
so downstream code never dereferences a null textPoints.

In `@mouseover_actions/src/main/resources/testsigma-sdk.properties`:
- Line 1: The committed API secret value for the property key
testsigma-sdk.api.key must be removed from source control; delete the secret
from this file and replace its usage by loading the key from a secure source
(e.g., environment variable or secrets manager) where your runtime reads
process.env.TESTSIGMA_SDK_API_KEY (or equivalent) instead of the file, add this
properties file to .gitignore so it isn't committed, and notify ops/security to
rotate the leaked key immediately if it is real; ensure any code that referenced
testsigma-sdk.api.key is updated to read the new secure configuration source.

---

Nitpick comments:
In
`@mouseover_actions/src/main/java/com/testsigma/addons/mobileweb/MouseOverOnTextAtOccurrence.java`:
- Around line 84-94: The loop in findTextPointAtOccurrence redundantly checks
text.equals(tp.getText()) || text.equalsIgnoreCase(tp.getText()); replace that
compound check with a single case-insensitive comparison (use
text.equalsIgnoreCase(tp.getText())) to simplify the logic and avoid redundancy,
keeping the rest of the method (null check for textPoints, occurrence counting
and return behavior) unchanged.

In
`@mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnText.java`:
- Around line 1-89: The WEB and MOBILE_WEB action classes duplicate the same
OCR+mouse-over logic; extract the shared behavior into a common base class or
utility and have both action classes delegate to it. Move the screenshot
capture, OCR extraction and parsing, coordinate calculation, and helper methods
(currently in execute(), findTextPoint(), logAvailableTextPoints()) into a new
abstract class or helper (e.g.,
AbstractMouseOverOnText.performMouseOver(targetText, driver, ocr) or instance
methods findTextPoint(...) and logAvailableTextPoints(...) there), keep only
Action-specific annotations and applicationType in the concrete MouseOverOnText
and MOBILE_WEB classes, and have their execute() call the shared method and
translate results into setSuccessMessage/setErrorMessage as needed.

In
`@mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnTextAtOccurrence.java`:
- Around line 84-94: The matching in findTextPointAtOccurrence uses a redundant
check (text.equals(...) || text.equalsIgnoreCase(...)) and is inconsistent with
countMatches which uses equalsIgnoreCase; change findTextPointAtOccurrence to
perform a single case-insensitive comparison (use equalsIgnoreCase) between text
and tp.getText() so both methods consistently use case-insensitive matching;
update only the comparison in the findTextPointAtOccurrence method to use
equalsIgnoreCase on the same operands (preserve null-safety if needed).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c777a35f-58b9-43d9-9465-7d3b56dba72a

📥 Commits

Reviewing files that changed from the base of the PR and between 636cb07 and f5bfae5.

📒 Files selected for processing (9)
  • base64_converter/pom.xml
  • base64_converter/src/main/java/com/testsigma/addons/generators/Base64Converter.java
  • base64_converter/src/main/java/com/testsigma/addons/generators/DecodeStringToBase64.java
  • mouseover_actions/pom.xml
  • mouseover_actions/src/main/java/com/testsigma/addons/mobileweb/MouseOverOnText.java
  • mouseover_actions/src/main/java/com/testsigma/addons/mobileweb/MouseOverOnTextAtOccurrence.java
  • mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnText.java
  • mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnTextAtOccurrence.java
  • mouseover_actions/src/main/resources/testsigma-sdk.properties

Comment on lines +10 to 12
@com.testsigma.sdk.annotation.TestDataFunction(displayName = "Decode the input string to base64",
description = "Decodes the input string to base64")
public class DecodeStringToBase64 extends TestDataFunction {

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

Misleading class name and description.

The class name DecodeStringToBase64 and description "Decode the input string to base64" are backwards. This function decodes from Base64, not to Base64. Consider renaming to DecodeBase64ToString and updating the description to "Decodes the input base64 string to plain text."

📝 Suggested annotation fix
-@com.testsigma.sdk.annotation.TestDataFunction(displayName = "Decode the input string to base64",
-        description = "Decodes the input string to base64")
-public class DecodeStringToBase64 extends TestDataFunction {
+@com.testsigma.sdk.annotation.TestDataFunction(displayName = "Decode the input base64 string to plain text",
+        description = "Decodes the input base64 string to plain text")
+public class DecodeBase64ToString extends TestDataFunction {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@base64_converter/src/main/java/com/testsigma/addons/generators/DecodeStringToBase64.java`
around lines 10 - 12, Rename the class DecodeStringToBase64 to
DecodeBase64ToString and update the
`@com.testsigma.sdk.annotation.TestDataFunction` annotation on that class to use
displayName = "Decode the input base64 string to plain text" and description =
"Decodes the input base64 string to plain text"; ensure any references to the
old class name (e.g., in tests or registration code) are updated to the new
class name DecodeBase64ToString so the runtime picks up the corrected name and
description.

Comment on lines +56 to +57
Actions actions = new Actions(driver);
actions.moveToLocation(x, y).perform();

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

moveToLocation is not a standard Selenium Actions method.

Same issue as in MouseOverOnTextAtOccurrence - this method does not exist in Selenium's Actions class and will fail at runtime.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@mouseover_actions/src/main/java/com/testsigma/addons/mobileweb/MouseOverOnText.java`
around lines 56 - 57, The Actions call in MouseOverOnText (and similarly in
MouseOverOnTextAtOccurrence) uses a non-existent method moveToLocation; replace
it with a valid Selenium Actions API such as moveByOffset or moveToElement with
offsets: obtain the target WebElement (or reference origin) and call
Actions.moveToElement(element, xOffset, yOffset).perform() or
Actions.moveByOffset(x, y).perform() as appropriate, ensuring you compute
offsets from a known element or the current pointer before performing the
action; update the code in class MouseOverOnText to use the correct Actions
method and adjust any coordinate calculations accordingly.

Comment on lines +68 to +80
private OCRTextPoint findTextPoint(List<OCRTextPoint> textPoints, String targetText) {
if (textPoints == null) return null;
for (OCRTextPoint tp : textPoints) {
if (targetText.equals(tp.getText())) return tp;
}
for (OCRTextPoint tp : textPoints) {
if (targetText.equalsIgnoreCase(tp.getText())) return tp;
}
for (OCRTextPoint tp : textPoints) {
if (tp.getText().toLowerCase().contains(targetText.toLowerCase())) return tp;
}
return null;
}

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 | 🟡 Minor

Potential NPE if OCR returns null text.

The findTextPoint method does not guard against tp.getText() being null. If OCR returns a text point with null text, this will throw a NullPointerException on line 77 when calling tp.getText().toLowerCase().

🛡️ Suggested null guard
     private OCRTextPoint findTextPoint(List<OCRTextPoint> textPoints, String targetText) {
         if (textPoints == null) return null;
         for (OCRTextPoint tp : textPoints) {
+            if (tp.getText() == null) continue;
             if (targetText.equals(tp.getText())) return tp;
         }
         for (OCRTextPoint tp : textPoints) {
+            if (tp.getText() == null) continue;
             if (targetText.equalsIgnoreCase(tp.getText())) return tp;
         }
         for (OCRTextPoint tp : textPoints) {
+            if (tp.getText() == null) continue;
             if (tp.getText().toLowerCase().contains(targetText.toLowerCase())) return tp;
         }
         return null;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@mouseover_actions/src/main/java/com/testsigma/addons/mobileweb/MouseOverOnText.java`
around lines 68 - 80, The findTextPoint method can NPE when tp.getText() is
null; update the method (findTextPoint) to null-check tp.getText() before
calling equals/equalsIgnoreCase/toLowerCase or otherwise compare safely (e.g.,
retrieve String txt = tp.getText(); if (txt == null) continue; then use
txt.equals(targetText), txt.equalsIgnoreCase(targetText), and
txt.toLowerCase().contains(targetText.toLowerCase())) so all comparisons skip
null text values.

Comment on lines +56 to +57
Actions actions = new Actions(driver);
actions.moveToLocation(x, y).perform();

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

moveToLocation is not a standard Selenium Actions method.

Same issue as in the mobile web variants - this method does not exist and will cause runtime failure.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnText.java`
around lines 56 - 57, The call to Actions.moveToLocation is invalid and will
throw at runtime; replace it in MouseOverOnText.java where you create Actions
actions = new Actions(driver) by using a valid Actions API such as
moveByOffset(x, y) or moveToElement(targetElement, xOffset, yOffset) (depending
on whether you have an element to target) and then call perform(); ensure you
import and use org.openqa.selenium.interactions.Actions and pass the correct
offsets or element reference instead of moveToLocation.

Comment on lines +49 to +53
File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
OCRImage ocrImage = new OCRImage();
ocrImage.setOcrImageFile(screenshot);
List<OCRTextPoint> textPoints = ocr.extractTextFromImage(ocrImage);
logger.info("Extracted " + textPoints.size() + " text points from screenshot");

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 | 🟡 Minor

Potential NullPointerException if OCR returns null.

If ocr.extractTextFromImage() returns null, line 53 will throw NPE when calling textPoints.size(). The helper methods have null guards, but the main flow fails before reaching them.

🛡️ Proposed fix to add null check
         File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
         OCRImage ocrImage = new OCRImage();
         ocrImage.setOcrImageFile(screenshot);
         List<OCRTextPoint> textPoints = ocr.extractTextFromImage(ocrImage);
+        if (textPoints == null) {
+            setErrorMessage("OCR extraction returned no results");
+            return Result.FAILED;
+        }
         logger.info("Extracted " + textPoints.size() + " text points from screenshot");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@mouseover_actions/src/main/java/com/testsigma/addons/web/MouseOverOnTextAtOccurrence.java`
around lines 49 - 53, The call to ocr.extractTextFromImage(ocrImage) may return
null and cause a NullPointerException when logger.info uses textPoints.size();
update the flow in MouseOverOnTextAtOccurrence (around variables screenshot,
ocrImage, textPoints) to null-guard the result of OCR.extractTextFromImage:
check if textPoints is null and replace it with Collections.emptyList() (or
handle the null case explicitly), then log using the safe list size and proceed
so downstream code never dereferences a null textPoints.

@@ -0,0 +1 @@
testsigma-sdk.api.key=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyNDBkMjhiNS0xNmUwLThlNmYtOWQ0ZS05MjYxMGNiZTcyYzciLCJ1bmlxdWVJZCI6IjYwODEiLCJpZGVudGl0eUFjY291bnRVVUlkIjoiMzUifQ.7_DxrELh3EoBszb2A3GC_EoKr5hPXIK9lqBudKbr4nT3r2lPmnyXqpckh3dfUUA2gPk3f8f_sN2-FtCbx7xQ7A 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

Critical: Remove API key from source control.

Committing API keys or secrets to version control is a security risk. This key will persist in git history even if removed later. Use environment variables or a secrets manager instead, and add this file to .gitignore.

If this key is real, rotate it immediately after removing from the repository.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@mouseover_actions/src/main/resources/testsigma-sdk.properties` at line 1, The
committed API secret value for the property key testsigma-sdk.api.key must be
removed from source control; delete the secret from this file and replace its
usage by loading the key from a secure source (e.g., environment variable or
secrets manager) where your runtime reads process.env.TESTSIGMA_SDK_API_KEY (or
equivalent) instead of the file, add this properties file to .gitignore so it
isn't committed, and notify ops/security to rotate the leaked key immediately if
it is real; ensure any code that referenced testsigma-sdk.api.key is updated to
read the new secure configuration source.

@ManojTestsigma
ManojTestsigma merged commit d70cd73 into dev Mar 17, 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