Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.testsigma.addons</groupId>
<artifactId>folder_and_file_actions</artifactId>
<version>1.0.2</version>
<packaging>jar</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<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.

<testsigma.addon.maven.plugin>1.0.0</testsigma.addon.maven.plugin>
<maven.source.plugin.version>3.2.1</maven.source.plugin.version>
<lombok.version>1.18.30</lombok.version>

</properties>

<dependencies>
<dependency>
<groupId>com.testsigma</groupId>
<artifactId>testsigma-java-sdk</artifactId>
<version>${testsigma.sdk.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
</dependency>
Comment on lines +42 to +46
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.

<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.14.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>9.0.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.13.0</version>
</dependency>

</dependencies>
<build>
<finalName>folder_and_file_actions</finalName>
<plugins>
<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>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven.source.plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.testsigma.addons.web;

import com.testsigma.addons.web.folderutil.FolderUtilities;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.StepActionType;
import com.testsigma.sdk.WebAction;
import com.testsigma.sdk.annotation.Action;
import com.testsigma.sdk.annotation.TestData;
import lombok.Data;
import org.openqa.selenium.NoSuchElementException;

import java.io.File;

@Data
@Action(actionText = "Verify that the folder Folder-Path has a file with name containing File-Name",
description = "Verifies whether the folder has any file containing the given name (use in if condition step)",
applicationType = ApplicationType.WEB,
actionType = StepActionType.IF_CONDITION,
displayName = "If: Verify folder has file containing name",
useCustomScreenshot = false)
public class IfVerifyFileContainingNamePresence extends WebAction {

@TestData(reference = "Folder-Path")
private com.testsigma.sdk.TestData folderPath_;

@TestData(reference = "File-Name")
private com.testsigma.sdk.TestData fileName_;

@Override
public Result execute() throws NoSuchElementException {
logger.info("Initiating execution...");
Result result = Result.SUCCESS;
String folderPath = folderPath_.getValue().toString();
String fileName = fileName_.getValue().toString();

logger.info("Given folder path : " + folderPath);
logger.info("Given file name : " + fileName);

FolderUtilities util = new FolderUtilities();
if (util.folderCheck(folderPath)) {
File file = util.searchFile(new File(folderPath), fileName, false, logger);
if (file != null) {
setSuccessMessage(String.format("Successfully verified that file exists containing the name %s in " +
"the folder path %s", fileName, folderPath));
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.NO_FILE_CONTAINS_ERROR_MSG, fileName, folderPath));
}
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
}
logger.info("Execution completed");
return result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.testsigma.addons.web;

import com.testsigma.addons.web.folderutil.FolderUtilities;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.StepActionType;
import com.testsigma.sdk.WebAction;
import com.testsigma.sdk.annotation.Action;
import com.testsigma.sdk.annotation.TestData;
import lombok.Data;
import org.openqa.selenium.NoSuchElementException;

import java.io.File;

@Data
@Action(actionText = "Verify that the folder Folder-Path has a file with name containing File-Name and the size of " +
"the file is greater than test-data KB",
description = "Verifies whether the folder has any file containing the given name and its size exceeds the " +
"given input (use in if condition step)",
applicationType = ApplicationType.WEB,
actionType = StepActionType.IF_CONDITION,
displayName = "If: Verify folder has file containing name and size",
useCustomScreenshot = false)
public class IfVerifyFileContainingNamePresenceWithFileSize extends WebAction {

@TestData(reference = "Folder-Path")
private com.testsigma.sdk.TestData folderPath_;

@TestData(reference = "File-Name")
private com.testsigma.sdk.TestData fileName_;

@TestData(reference = "test-data")
private com.testsigma.sdk.TestData size_;

@Override
public Result execute() throws NoSuchElementException {
logger.info("Initiating execution...");
Result result = Result.SUCCESS;
String folderPath = folderPath_.getValue().toString();
String fileName = fileName_.getValue().toString();
long size = Long.parseLong(size_.getValue().toString());

logger.info("Given folder path : " + folderPath);
logger.info("Given file name : " + fileName);
logger.info("Given size value : " + size);

FolderUtilities util = new FolderUtilities();
if (util.folderCheck(folderPath)) {
File file = util.searchFile(new File(folderPath), fileName, false, logger);
if (file != null) {
long fileSize = file.length() / 1000;
if (file.length() > (size * 1000)) {
setSuccessMessage(String.format("Successfully verified that file exists containing name %s in" +
" the folder path %s and it's size %s KB is greater than %s KB",
fileName, folderPath, fileSize, size));
} else {
result = Result.FAILED;
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));
}
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.NO_FILE_CONTAINS_ERROR_MSG, fileName, folderPath));
}
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
}
logger.info("Execution completed");
return result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.testsigma.addons.web;

import com.testsigma.addons.web.folderutil.FolderUtilities;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.StepActionType;
import com.testsigma.sdk.WebAction;
import com.testsigma.sdk.annotation.Action;
import com.testsigma.sdk.annotation.TestData;
import lombok.Data;
import org.openqa.selenium.NoSuchElementException;

import java.io.File;

@Data
@Action(actionText = "Verify that the folder Folder-Path has a file with name File-Name",
description = "Verifies whether the folder has a file with given name (use in if condition step)",
applicationType = ApplicationType.WEB,
actionType = StepActionType.IF_CONDITION,
displayName = "If: Verify folder has file with exact name",
useCustomScreenshot = false)
public class IfVerifyFileWithNamePresence extends WebAction {

@TestData(reference = "Folder-Path")
private com.testsigma.sdk.TestData folderPath_;

@TestData(reference = "File-Name")
private com.testsigma.sdk.TestData fileName_;

@Override
public Result execute() throws NoSuchElementException {
logger.info("Initiating execution...");
Result result = Result.SUCCESS;
String folderPath = folderPath_.getValue().toString();
String fileName = fileName_.getValue().toString();

logger.info("Given folder path : " + folderPath);
logger.info("Given file name : " + fileName);

FolderUtilities util = new FolderUtilities();
if (util.folderCheck(folderPath)) {
File file = util.searchFile(new File(folderPath), fileName, true, logger);
if (file != null) {
setSuccessMessage(String.format("Successfully verified that file exists with name %s in the folder " +
"path %s", fileName, folderPath));
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.NO_FILE_EXISTS_ERROR_MSG, fileName, folderPath));
}
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
}
logger.info("Execution completed");
return result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.testsigma.addons.web;

import com.testsigma.addons.web.folderutil.FolderUtilities;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.StepActionType;
import com.testsigma.sdk.WebAction;
import com.testsigma.sdk.annotation.Action;
import com.testsigma.sdk.annotation.TestData;
import lombok.Data;
import org.openqa.selenium.NoSuchElementException;

import java.io.File;

@Data
@Action(actionText = "Verify that the folder Folder-Path has a file with name File-Name and the size of the file is" +
" greater than test-data KB",
description = "Verifies whether the folder has a file with given name and its size exceeds the given input" +
" (use in if condition step)",
applicationType = ApplicationType.WEB,
actionType = StepActionType.IF_CONDITION,
displayName = "If: Verify folder has file with exact name and size",
useCustomScreenshot = false)
public class IfVerifyFileWithNamePresenceWithFileSize extends WebAction {

@TestData(reference = "Folder-Path")
private com.testsigma.sdk.TestData folderPath_;

@TestData(reference = "File-Name")
private com.testsigma.sdk.TestData fileName_;

@TestData(reference = "test-data")
private com.testsigma.sdk.TestData size_;

@Override
public Result execute() throws NoSuchElementException {
logger.info("Initiating execution...");
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.


logger.info("Given folder path : " + folderPath);
logger.info("Given file name : " + fileName);

FolderUtilities util = new FolderUtilities();
if (util.folderCheck(folderPath)) {
File file = util.searchFile(new File(folderPath), fileName, true, logger);
if (file != null) {
long fileSize = file.length() / 1000;
if (file.length() > (size * 1000)) {
setSuccessMessage(String.format("Successfully verified that file exists with name %s in the folder " +
"path %s and it's size %s KB is greater than %s KB", fileName, folderPath, fileSize, size));
} else {
result = Result.FAILED;
setErrorMessage(String.format("The files exists with name %s in the folder path %s and its size " +
" %s KB is not greater than %s KB", fileName, folderPath, fileSize, size));
}
} else {
result = Result.FAILED;
setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
}
Comment on lines +59 to +62
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.

} else {
result = Result.FAILED;
setErrorMessage(String.format(util.FOLDER_NOT_FOUND, folderPath));
}
logger.info("Execution completed");
return result;
}
}
Loading