Skip to content

[CUS-12422] Added folder and file actions to windows advanced type.#385

Open
ManojTestsigma wants to merge 1 commit intodevfrom
CUS-12422
Open

[CUS-12422] Added folder and file actions to windows advanced type.#385
ManojTestsigma wants to merge 1 commit intodevfrom
CUS-12422

Conversation

@ManojTestsigma
Copy link
Copy Markdown
Contributor

@ManojTestsigma ManojTestsigma commented Apr 29, 2026

please review this addon and publish as PUBLIC

Addon name : Folder and File Actions
Addon accont: https://jarvis.testsigma.com/ui/tenants/2817/addons
Jira: https://testsigma.atlassian.net/browse/CUS-12422

fix

Summary by CodeRabbit

New Features

  • Added file and folder verification actions for web and Windows Advanced test automation platforms
  • File verification capabilities: exact name matching, partial name matching, optional file size validation
  • Available as both conditional (IF) steps and standalone verification actions
  • Folder existence validation with detailed error reporting for failed checks

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

📝 Walkthrough

Walkthrough

A new Maven JAR project folder_and_file_actions (v1.0.2) is introduced with build configuration for Java 11, dependencies on TestSigma SDK, Selenium 4.14.1, Appium Java client 9.0.0, and Jackson. Eight new action classes are added for Web and Windows Advanced platforms to verify file presence and file sizes with optional name substring matching.

Changes

Cohort / File(s) Summary
Maven Build Configuration
pom.xml
Configures Maven JAR project with Java 11 compatibility, TestSigma SDK, Selenium 4.14.1, Appium 9.0.0, Jackson 2.13.0, and shade/source plugins.
Web Action Classes
src/main/java/com/testsigma/addons/web/IfVerifyFileContainingNamePresence.java, IfVerifyFileContainingNamePresenceWithFileSize.java, IfVerifyFileWithNamePresence.java, IfVerifyFileWithNamePresenceWithFileSize.java
Four IF-condition actions that verify file presence in a folder, with optional substring name matching and file size validation. All use FolderUtilities for folder/file checks and return Result.SUCCESS or Result.FAILED.
Windows Advanced IF-Condition Actions
src/main/java/com/testsigma/addons/windowsAdvanced/IfVerifyFileContainingNamePresence.java, IfVerifyFileContainingNamePresenceWithFileSize.java, IfVerifyFileWithNamePresence.java, IfVerifyFileWithNamePresenceWithFileSize.java
Four IF-condition actions mirroring web actions for Windows Advanced platform. Verify folder existence, search for files by exact or substring name matching, and optionally validate file size thresholds.
Windows Advanced Verify Actions
src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileContainingNamePresence.java, VerifyFileContainingNamePresenceWithFileSize.java, VerifyFileWithNamePresence.java, VerifyFileWithNamePresenceWithFileSize.java
Four standard verify actions for Windows Advanced platform with identical logic to IF-condition variants but registered as regular action steps instead of conditional steps.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • Ganesh-Testsigma
  • vigneshtestsigma

Poem

🐰✨ Files, folders, sizes too—
We hop and search 'til we find what's true!
West and Windows both play their part,
Actions precise with a rabbit's smart heart!
Success or fail, the logic is sound,
Eight new friends, every file's found! 🐇📁

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 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 folder and file action classes to the Windows Advanced action type.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch CUS-12422

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

🧹 Nitpick comments (3)
folder_and_file_actions_11365282608597864633118400917122709149/pom.xml (1)

69-81: Harden shade configuration to reduce runtime classpath collisions.

At Lines 69-81, the shade setup is very broad. For an addon carrying Selenium/Appium stacks, consider explicit artifact filtering/relocation strategy to avoid dependency clashes in the host runtime.

Suggested baseline hardening
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
                 <version>3.2.4</version>
                 <executions>
                     <execution>
                         <phase>package</phase>
                         <goals>
                             <goal>shade</goal>
                         </goals>
+                        <configuration>
+                            <createDependencyReducedPom>true</createDependencyReducedPom>
+                            <minimizeJar>true</minimizeJar>
+                        </configuration>
                     </execution>
                 </executions>
             </plugin>

Use this only if your addon runtime doesn’t depend on reflective access to trimmed classes; otherwise keep minimizeJar off and rely on explicit includes/excludes.

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

In `@folder_and_file_actions_11365282608597864633118400917122709149/pom.xml`
around lines 69 - 81, The maven-shade-plugin configuration is too broad and can
cause runtime classpath collisions; update the plugin block for artifactId
maven-shade-plugin (version 3.2.4) to add a conservative shading strategy:
enable explicit relocations for known conflicting packages (e.g.,
selenium/appium group packages), add filters/includes/excludes to limit which
dependencies are packaged, and consider setting minimizeJar only if you don't
rely on reflective/trimmed classes; modify the <executions> -> <execution> for
the shade goal to include <relocations> and <filters> entries and adjust
minimizeJar accordingly to harden the shaded artifact.
folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileWithNamePresenceWithFileSize.java (1)

33-67: Consider extracting shared file-size verification logic.

This method duplicates near-identical logic present in multiple actions, and the same messaging bug appeared in more than one class. A shared helper would reduce drift risk.

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

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileWithNamePresenceWithFileSize.java`
around lines 33 - 67, The execute() method in
VerifyFileWithNamePresenceWithFileSize duplicates file-size verification and
message construction logic found in other actions; extract that repeated logic
into a shared helper (e.g., a new method in FolderUtilities or a utility class)
that accepts parameters (File file, long expectedSizeKB, String fileName, String
folderPath, Logger logger) and returns a result object or boolean plus canonical
success/error messages; update VerifyFileWithNamePresenceWithFileSize.execute()
to call this helper (replace the inline size calculation, comparison using
file.length()/1000 and message formatting, and branching on pass/fail) and reuse
the same helper from other classes to centralize the comparison and fix the
messaging bug.
folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileContainingNamePresenceWithFileSize.java (1)

3-3: Avoid cross-platform package coupling for FolderUtilities.

windowsAdvanced code importing com.testsigma.addons.web.folderutil.FolderUtilities makes module boundaries harder to maintain. Consider moving shared file/folder helpers to a neutral package (for example, com.testsigma.addons.common.folderutil).

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

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileContainingNamePresenceWithFileSize.java`
at line 3, The VerifyFileContainingNamePresenceWithFileSize class currently
imports FolderUtilities from com.testsigma.addons.web.folderutil which couples a
Windows-specific addon to a web package; refactor by moving the FolderUtilities
helper to a neutral package (e.g., com.testsigma.addons.common.folderutil),
update the import in VerifyFileContainingNamePresenceWithFileSize to import
com.testsigma.addons.common.folderutil.FolderUtilities, and update any
references, package declarations and module/resource entries affected (including
the FolderUtilities class file location and its package statement) so all
callers use the new neutral package.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@folder_and_file_actions_11365282608597864633118400917122709149/pom.xml`:
- Around line 42-46: The TestNG dependency org.testng:testng is currently left
at default (compile) scope and will be packaged into the shaded addon JAR;
change the dependency declaration for groupId org.testng and artifactId testng
(version 6.14.3) to use test scope by adding a <scope>test</scope> element so
the test framework is excluded from the runtime artifact.
- Line 17: The pom declares outdated or milestone dependency versions (property
junit.jupiter.version and dependencies junit-jupiter-api, testng, selenium-java,
java-client, jackson-annotations); update junit.jupiter.version and the specific
dependency entries (junit-jupiter-api, testng, selenium-java, java-client,
jackson-annotations) to current stable releases (e.g., junit 6.0.3, testng
7.12.0, selenium 4.43.0, java-client 10.1.1, jackson-annotations 2.18.6) or your
approved versions, run a full build/test cycle to ensure compatibility, and
cross-check the updated versions against known security advisories before
publishing.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/web/IfVerifyFileWithNamePresenceWithFileSize.java`:
- Around line 59-62: In the null-file branch inside class
IfVerifyFileWithNamePresenceWithFileSize where you currently set result =
Result.FAILED and call setErrorMessage(String.format(util.FOLDER_NOT_FOUND,
folderPath)), replace the misleading util.FOLDER_NOT_FOUND usage with the
correct file-not-found constant (util.FILE_NOT_FOUND) and format the message
with the missing file identifier (e.g., fileName or the full file path) so
setErrorMessage reports the missing file; keep the Result.FAILED and
setErrorMessage call but swap the constant and argument to reference the file
rather than the folder.
- Line 41: The parse of size_ in IfVerifyFileWithNamePresenceWithFileSize can
throw NumberFormatException or accept negative values; wrap the
Long.parseLong(size_.getValue().toString()) call in a try/catch that catches
NumberFormatException, log/set a clear error message and return a FAILED result
from the action, and after parsing explicitly check if size < 0 and likewise set
an error and return FAILED; update the method that contains the parse (the
execution flow around the size_ variable) to use the validated long value only
after these checks.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/IfVerifyFileWithNamePresenceWithFileSize.java`:
- Around line 59-62: The code in IfVerifyFileWithNamePresenceWithFileSize
incorrectly sets the error message to util.FOLDER_NOT_FOUND after confirming the
folder exists; change the error path where result is set to Result.FAILED to use
the file-missing template instead by replacing util.FOLDER_NOT_FOUND with
util.FILE_NOT_FOUND in the setErrorMessage call (keep setting result =
Result.FAILED and leave surrounding logic unchanged).
- Line 41: The direct call to Long.parseLong(size_.getValue().toString()) in
IfVerifyFileWithNamePresenceWithFileSize can throw NumberFormatException or
accept negative values; wrap the parse in a try/catch and validate the parsed
value: catch NumberFormatException and return Result.FAILED with a clear
validation message (e.g., "Invalid file size: must be a non-negative integer"),
and if the parsed long is negative also return Result.FAILED with a message
rejecting negative KB; keep references to the existing variable size_ and the
parse call (Long.parseLong) so the change is localized to that
parsing/validation block inside the class's action method.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileContainingNamePresenceWithFileSize.java`:
- Around line 56-57: Update the user-facing error string in
VerifyFileContainingNamePresenceWithFileSize where setErrorMessage(...) is
called: replace the grammatically incorrect message ("The files exists with
containing name ...") with a clear sentence that references fileName,
folderPath, fileSize and size variables (for example: "A file containing '%s'
exists in folder '%s' but its size %s KB is not greater than %s KB"); ensure you
only change the message text in the setErrorMessage(String.format(...)) call so
the format specifiers and variables (fileName, folderPath, fileSize, size)
remain correct.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileWithNamePresenceWithFileSize.java`:
- Around line 57-60: In the file-not-found branch inside
VerifyFileWithNamePresenceWithFileSize, replace the incorrect
util.FOLDER_NOT_FOUND error message with the file-missing constant
util.NO_FILE_EXISTS_ERROR_MSG (and include the target file identifier, e.g.,
fileName or expected file path variable) so setErrorMessage(...) reports the
missing file rather than a missing folder; update the setErrorMessage call in
that else branch to use util.NO_FILE_EXISTS_ERROR_MSG and format it with the
file identifier.
- Line 39: The code directly calls Long.parseLong on size_.getValue() and
assumes it's a valid non-negative number; wrap the parse in a try/catch to catch
NumberFormatException and also validate that the parsed long (the variable size)
is >= 0, and if either check fails set the step/result to FAILED with a clear
message (e.g., "Invalid test-data size: '<value>'" or "Negative size not
allowed: <value>") and return early; update the logic in class
VerifyFileWithNamePresenceWithFileSize around the
Long.parseLong(size_.getValue().toString()) usage so invalid or negative inputs
produce a controlled FAILED result instead of throwing.

---

Nitpick comments:
In `@folder_and_file_actions_11365282608597864633118400917122709149/pom.xml`:
- Around line 69-81: The maven-shade-plugin configuration is too broad and can
cause runtime classpath collisions; update the plugin block for artifactId
maven-shade-plugin (version 3.2.4) to add a conservative shading strategy:
enable explicit relocations for known conflicting packages (e.g.,
selenium/appium group packages), add filters/includes/excludes to limit which
dependencies are packaged, and consider setting minimizeJar only if you don't
rely on reflective/trimmed classes; modify the <executions> -> <execution> for
the shade goal to include <relocations> and <filters> entries and adjust
minimizeJar accordingly to harden the shaded artifact.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileContainingNamePresenceWithFileSize.java`:
- Line 3: The VerifyFileContainingNamePresenceWithFileSize class currently
imports FolderUtilities from com.testsigma.addons.web.folderutil which couples a
Windows-specific addon to a web package; refactor by moving the FolderUtilities
helper to a neutral package (e.g., com.testsigma.addons.common.folderutil),
update the import in VerifyFileContainingNamePresenceWithFileSize to import
com.testsigma.addons.common.folderutil.FolderUtilities, and update any
references, package declarations and module/resource entries affected (including
the FolderUtilities class file location and its package statement) so all
callers use the new neutral package.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileWithNamePresenceWithFileSize.java`:
- Around line 33-67: The execute() method in
VerifyFileWithNamePresenceWithFileSize duplicates file-size verification and
message construction logic found in other actions; extract that repeated logic
into a shared helper (e.g., a new method in FolderUtilities or a utility class)
that accepts parameters (File file, long expectedSizeKB, String fileName, String
folderPath, Logger logger) and returns a result object or boolean plus canonical
success/error messages; update VerifyFileWithNamePresenceWithFileSize.execute()
to call this helper (replace the inline size calculation, comparison using
file.length()/1000 and message formatting, and branching on pass/fail) and reuse
the same helper from other classes to centralize the comparison and fix the
messaging bug.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9102f54d-8c5d-4c87-98c6-9deb72926409

📥 Commits

Reviewing files that changed from the base of the PR and between b42105a and 38bbc59.

📒 Files selected for processing (13)
  • folder_and_file_actions_11365282608597864633118400917122709149/pom.xml
  • folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/web/IfVerifyFileContainingNamePresence.java
  • folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/web/IfVerifyFileContainingNamePresenceWithFileSize.java
  • folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/web/IfVerifyFileWithNamePresence.java
  • folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/web/IfVerifyFileWithNamePresenceWithFileSize.java
  • folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/IfVerifyFileContainingNamePresence.java
  • folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/IfVerifyFileContainingNamePresenceWithFileSize.java
  • folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/IfVerifyFileWithNamePresence.java
  • folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/IfVerifyFileWithNamePresenceWithFileSize.java
  • folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileContainingNamePresence.java
  • folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileContainingNamePresenceWithFileSize.java
  • folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileWithNamePresence.java
  • folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileWithNamePresenceWithFileSize.java

<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<testsigma.sdk.version>1.2.24_cloud</testsigma.sdk.version>
<junit.jupiter.version>5.8.0-M1</junit.jupiter.version>
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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Checking latest versions on Maven Central..."
for ga in \
  "org.junit.jupiter:junit-jupiter-api" \
  "org.testng:testng" \
  "org.seleniumhq.selenium:selenium-java" \
  "io.appium:java-client" \
  "com.fasterxml.jackson.core:jackson-annotations" \
  "org.apache.maven.plugins:maven-shade-plugin"
do
  g="${ga%%:*}"
  a="${ga##*:}"
  q="https://search.maven.org/solrsearch/select?q=g:%22${g}%22+AND+a:%22${a}%22&rows=1&wt=json"
  latest=$(curl -s "$q" | jq -r '.response.docs[0].latestVersion // "N/A"')
  echo "${ga} -> latest: ${latest}"
done

echo
echo "Checking OSV advisories for currently pinned coordinates..."
python - <<'PY'
import json, urllib.request
deps = [
  ("org.junit.jupiter", "junit-jupiter-api", "5.8.0-M1"),
  ("org.testng", "testng", "6.14.3"),
  ("org.seleniumhq.selenium", "selenium-java", "4.14.1"),
  ("io.appium", "java-client", "9.0.0"),
  ("com.fasterxml.jackson.core", "jackson-annotations", "2.13.0"),
]
url = "https://api.osv.dev/v1/query"
for g,a,v in deps:
    body = {
      "package": {"ecosystem":"Maven","name":f"{g}:{a}"},
      "version": v
    }
    req = urllib.request.Request(url, data=json.dumps(body).encode(), headers={"Content-Type":"application/json"})
    with urllib.request.urlopen(req) as r:
        data = json.loads(r.read().decode())
    vulns = data.get("vulns", [])
    print(f"{g}:{a}:{v} -> vulnerabilities: {len(vulns)}")
    for vv in vulns[:3]:
        print("  -", vv.get("id"), vv.get("summary","")[:120])
PY

Repository: testsigmahq/testsigma-addons

Length of output: 1796


🏁 Script executed:

git ls-files | grep -E 'pom\.xml$' | head -20

Repository: testsigmahq/testsigma-addons

Length of output: 1888


🌐 Web query:

Latest stable version of JUnit Jupiter (org.junit.jupiter:junit-jupiter-api)

💡 Result:

The latest stable version of org.junit.jupiter:junit-jupiter-api is 6.0.3, released on February 15, 2026.

Citations:


🌐 Web query:

Latest stable version of TestNG (org.testng:testng)

💡 Result:

The latest stable version of TestNG (org.testng:testng) is 7.12.0.

Citations:


🌐 Web query:

Latest stable version of Selenium (org.seleniumhq.selenium:selenium-java)

💡 Result:

The latest stable version of org.seleniumhq.selenium:selenium-java is 4.43.0, released on April 10, 2026.

Citations:


🌐 Web query:

Latest stable version of Appium (io.appium:java-client)

💡 Result:

The latest stable version of io.appium:java-client is 10.1.1.

Citations:


🌐 Web query:

Latest stable version of Jackson Annotations (com.fasterxml.jackson.core:jackson-annotations)

💡 Result:

The latest stable version of Jackson Annotations (com.fasterxml.jackson.core:jackson-annotations) is 2.18.6.

Citations:


Update pinned dependency versions before publishing as PUBLIC.

The version 5.8.0-M1 at line 17 is a JUnit Jupiter milestone build, not a stable release. Additionally, versions at lines 17, 45, 62, and 72 are significantly outdated:

  • junit-jupiter-api:5.8.0-M1 → latest: 6.0.3 (stable)
  • testng:6.14.3 → latest: 7.12.0
  • selenium-java:4.14.1 → latest: 4.43.0
  • java-client:9.0.0 → latest: 10.1.1
  • jackson-annotations:2.13.0 → latest: 2.18.6

Update to current stable versions and verify against known advisories before release.

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

In `@folder_and_file_actions_11365282608597864633118400917122709149/pom.xml` at
line 17, The pom declares outdated or milestone dependency versions (property
junit.jupiter.version and dependencies junit-jupiter-api, testng, selenium-java,
java-client, jackson-annotations); update junit.jupiter.version and the specific
dependency entries (junit-jupiter-api, testng, selenium-java, java-client,
jackson-annotations) to current stable releases (e.g., junit 6.0.3, testng
7.12.0, selenium 4.43.0, java-client 10.1.1, jackson-annotations 2.18.6) or your
approved versions, run a full build/test cycle to ensure compatibility, and
cross-check the updated versions against known security advisories before
publishing.

Comment on lines +42 to +46
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
</dependency>
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

Set TestNG to test scope to avoid shipping test framework in the addon JAR.

At Line 42, org.testng:testng is compile scope by default. With shading enabled, this can be bundled into the runtime artifact and increase conflict risk unnecessarily.

Suggested fix
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
             <version>6.14.3</version>
+            <scope>test</scope>
         </dependency>
📝 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
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@folder_and_file_actions_11365282608597864633118400917122709149/pom.xml`
around lines 42 - 46, The TestNG dependency org.testng:testng is currently left
at default (compile) scope and will be packaged into the shaded addon JAR;
change the dependency declaration for groupId org.testng and artifactId testng
(version 6.14.3) to use test scope by adding a <scope>test</scope> element so
the test framework is excluded from the runtime artifact.

Result result = Result.SUCCESS;
String folderPath = folderPath_.getValue().toString();
String fileName = fileName_.getValue().toString();
long size = Long.parseLong(size_.getValue().toString());
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

Handle invalid size input safely.

Line 41 can throw NumberFormatException and terminate the action instead of returning a controlled FAILED result. Also reject negative sizes explicitly.

Proposed fix
-        long size = Long.parseLong(size_.getValue().toString());
+        long size;
+        try {
+            size = Long.parseLong(String.valueOf(size_.getValue()).trim());
+            if (size < 0) {
+                setErrorMessage("Given size must be a non-negative number in KB");
+                return Result.FAILED;
+            }
+        } catch (RuntimeException e) {
+            setErrorMessage("Given size must be a non-negative number in KB");
+            return Result.FAILED;
+        }
📝 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
long size = Long.parseLong(size_.getValue().toString());
long size;
try {
size = Long.parseLong(String.valueOf(size_.getValue()).trim());
if (size < 0) {
setErrorMessage("Given size must be a non-negative number in KB");
return Result.FAILED;
}
} catch (RuntimeException e) {
setErrorMessage("Given size must be a non-negative number in KB");
return Result.FAILED;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/web/IfVerifyFileWithNamePresenceWithFileSize.java`
at line 41, The parse of size_ in IfVerifyFileWithNamePresenceWithFileSize can
throw NumberFormatException or accept negative values; wrap the
Long.parseLong(size_.getValue().toString()) call in a try/catch that catches
NumberFormatException, log/set a clear error message and return a FAILED result
from the action, and after parsing explicitly check if size < 0 and likewise set
an error and return FAILED; update the method that contains the parse (the
execution flow around the size_ variable) to use the validated long value only
after these checks.

Comment on lines +59 to +62
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
}
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

Use the correct file-not-found error in the null-file branch.

At Line 59, this branch means the folder exists but file lookup failed; using FOLDER_NOT_FOUND is misleading.

Proposed fix
-            } else {
-                result = Result.FAILED;
-                setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
-            }
+            } else {
+                result = Result.FAILED;
+                setErrorMessage(String.format(util.NO_FILE_EXISTS_ERROR_MSG, fileName, folderPath));
+            }
📝 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
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
}
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.NO_FILE_EXISTS_ERROR_MSG, fileName, folderPath));
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/web/IfVerifyFileWithNamePresenceWithFileSize.java`
around lines 59 - 62, In the null-file branch inside class
IfVerifyFileWithNamePresenceWithFileSize where you currently set result =
Result.FAILED and call setErrorMessage(String.format(util.FOLDER_NOT_FOUND,
folderPath)), replace the misleading util.FOLDER_NOT_FOUND usage with the
correct file-not-found constant (util.FILE_NOT_FOUND) and format the message
with the missing file identifier (e.g., fileName or the full file path) so
setErrorMessage reports the missing file; keep the Result.FAILED and
setErrorMessage call but swap the constant and argument to reference the file
rather than the folder.

Result result = Result.SUCCESS;
String folderPath = folderPath_.getValue().toString();
String fileName = fileName_.getValue().toString();
long size = Long.parseLong(size_.getValue().toString());
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

Guard size parsing and invalid values.

Line 41 can throw on non-numeric input and bypass normal action failure messaging. Return Result.FAILED with a validation message instead (and reject negative KB).

Proposed fix
-        long size = Long.parseLong(size_.getValue().toString());
+        long size;
+        try {
+            size = Long.parseLong(String.valueOf(size_.getValue()).trim());
+            if (size < 0) {
+                setErrorMessage("Given size must be a non-negative number in KB");
+                return Result.FAILED;
+            }
+        } catch (RuntimeException e) {
+            setErrorMessage("Given size must be a non-negative number in KB");
+            return Result.FAILED;
+        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/IfVerifyFileWithNamePresenceWithFileSize.java`
at line 41, The direct call to Long.parseLong(size_.getValue().toString()) in
IfVerifyFileWithNamePresenceWithFileSize can throw NumberFormatException or
accept negative values; wrap the parse in a try/catch and validate the parsed
value: catch NumberFormatException and return Result.FAILED with a clear
validation message (e.g., "Invalid file size: must be a non-negative integer"),
and if the parsed long is negative also return Result.FAILED with a message
rejecting negative KB; keep references to the existing variable size_ and the
parse call (Long.parseLong) so the change is localized to that
parsing/validation block inside the class's action method.

Comment on lines +59 to +62
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
}
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

Fix incorrect error template for missing file case.

At Line 59, folder existence is already confirmed (Line 47), so this should report file-not-found, not folder-not-found.

Proposed fix
-            } else {
-                result = Result.FAILED;
-                setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
-            }
+            } else {
+                result = Result.FAILED;
+                setErrorMessage(String.format(util.NO_FILE_EXISTS_ERROR_MSG, fileName, folderPath));
+            }
📝 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
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
}
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.NO_FILE_EXISTS_ERROR_MSG, fileName, folderPath));
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/IfVerifyFileWithNamePresenceWithFileSize.java`
around lines 59 - 62, The code in IfVerifyFileWithNamePresenceWithFileSize
incorrectly sets the error message to util.FOLDER_NOT_FOUND after confirming the
folder exists; change the error path where result is set to Result.FAILED to use
the file-missing template instead by replacing util.FOLDER_NOT_FOUND with
util.FILE_NOT_FOUND in the setErrorMessage call (keep setting result =
Result.FAILED and leave surrounding logic unchanged).

Comment on lines +56 to +57
setErrorMessage(String.format("The files exists with containing name %s in the folder path %s and its" +
" size %s KB is not greater than %s KB", fileName, folderPath, fileSize, size));
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

Fix user-facing message grammar.

Error text has typos (“files exists”, “with containing”). This appears in step results and should be corrected for clarity.

Proposed wording
-                    setErrorMessage(String.format("The files exists with containing name %s in the folder path %s and its" +
-                            " size %s KB is not greater than %s KB", fileName, folderPath, fileSize, size));
+                    setErrorMessage(String.format("A file containing name %s exists in folder path %s, but its size %s KB is not greater than %s KB",
+                            fileName, folderPath, fileSize, size));
📝 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(String.format("The files exists with containing name %s in the folder path %s and its" +
" size %s KB is not greater than %s KB", fileName, folderPath, fileSize, size));
setErrorMessage(String.format("A file containing name %s exists in folder path %s, but its size %s KB is not greater than %s KB",
fileName, folderPath, fileSize, size));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileContainingNamePresenceWithFileSize.java`
around lines 56 - 57, Update the user-facing error string in
VerifyFileContainingNamePresenceWithFileSize where setErrorMessage(...) is
called: replace the grammatically incorrect message ("The files exists with
containing name ...") with a clear sentence that references fileName,
folderPath, fileSize and size variables (for example: "A file containing '%s'
exists in folder '%s' but its size %s KB is not greater than %s KB"); ensure you
only change the message text in the setErrorMessage(String.format(...)) call so
the format specifiers and variables (fileName, folderPath, fileSize, size)
remain correct.

Result result = Result.SUCCESS;
String folderPath = folderPath_.getValue().toString();
String fileName = fileName_.getValue().toString();
long size = Long.parseLong(size_.getValue().toString());
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

Validate test-data size before use.

Line 39 currently assumes valid numeric input; invalid/negative values should produce controlled FAILED with a clear message instead of runtime failure.

Proposed fix
-        long size = Long.parseLong(size_.getValue().toString());
+        long size;
+        try {
+            size = Long.parseLong(String.valueOf(size_.getValue()).trim());
+            if (size < 0) {
+                setErrorMessage("Given size must be a non-negative number in KB");
+                return Result.FAILED;
+            }
+        } catch (RuntimeException e) {
+            setErrorMessage("Given size must be a non-negative number in KB");
+            return Result.FAILED;
+        }
📝 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
long size = Long.parseLong(size_.getValue().toString());
long size;
try {
size = Long.parseLong(String.valueOf(size_.getValue()).trim());
if (size < 0) {
setErrorMessage("Given size must be a non-negative number in KB");
return Result.FAILED;
}
} catch (RuntimeException e) {
setErrorMessage("Given size must be a non-negative number in KB");
return Result.FAILED;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileWithNamePresenceWithFileSize.java`
at line 39, The code directly calls Long.parseLong on size_.getValue() and
assumes it's a valid non-negative number; wrap the parse in a try/catch to catch
NumberFormatException and also validate that the parsed long (the variable size)
is >= 0, and if either check fails set the step/result to FAILED with a clear
message (e.g., "Invalid test-data size: '<value>'" or "Negative size not
allowed: <value>") and return early; update the logic in class
VerifyFileWithNamePresenceWithFileSize around the
Long.parseLong(size_.getValue().toString()) usage so invalid or negative inputs
produce a controlled FAILED result instead of throwing.

Comment on lines +57 to +60
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
}
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

Incorrect failure reason in file-not-found branch.

At Line 57, this branch should report missing file (NO_FILE_EXISTS_ERROR_MSG) since folder existence was already confirmed at Line 45.

Proposed fix
-            } else {
-                result = Result.FAILED;
-                setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
-            }
+            } else {
+                result = Result.FAILED;
+                setErrorMessage(String.format(util.NO_FILE_EXISTS_ERROR_MSG, fileName, folderPath));
+            }
📝 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
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
}
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.NO_FILE_EXISTS_ERROR_MSG, fileName, folderPath));
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@folder_and_file_actions_11365282608597864633118400917122709149/src/main/java/com/testsigma/addons/windowsAdvanced/VerifyFileWithNamePresenceWithFileSize.java`
around lines 57 - 60, In the file-not-found branch inside
VerifyFileWithNamePresenceWithFileSize, replace the incorrect
util.FOLDER_NOT_FOUND error message with the file-missing constant
util.NO_FILE_EXISTS_ERROR_MSG (and include the target file identifier, e.g.,
fileName or expected file path variable) so setErrorMessage(...) reports the
missing file rather than a missing folder; update the setErrorMessage call in
that else branch to use util.NO_FILE_EXISTS_ERROR_MSG and format it with the
file identifier.

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