Skip to content

Conversation

@akhil-testsigma
Copy link
Contributor

@akhil-testsigma akhil-testsigma commented Jan 12, 2026

Publish this addon as public

Addon Name: Date Formatter with Suffix
Jarvis Link: https://jarvis.testsigma.com/ui/tenants/3072/addons
Jira : https://testsigma.atlassian.net/browse/CUS-10023
Added class to support suffix in date formats

Summary by CodeRabbit

Release Notes

  • New Features
    • Added date conversion functionality that appends ordinal day suffixes (1st, 2nd, 3rd, 4th, etc.) when formatting dates across Android, iOS, Web, Mobile Web, and REST API platforms.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 12, 2026

📝 Walkthrough

Walkthrough

This PR introduces a new Maven addon module that provides date formatting with ordinal day suffixes (1st, 2nd, 3rd, etc.) across multiple testing platforms. The module includes Maven project configuration, platform-specific action implementations for Android, iOS, Web, Mobile Web, and REST API, and SDK configuration properties.

Changes

Cohort / File(s) Summary
Project Configuration
date_formatter_with_suffix/pom.xml
Maven project descriptor with Java 11 target, dependencies (testsigma-java-sdk, lombok, testing frameworks, selenium/appium clients, jackson), and build plugins (maven-shade-plugin, maven-source-plugin).
Action Implementations
date_formatter_with_suffix/src/main/java/com/testsigma/addons/android/ConvertDateWithSuffixAction.java, date_formatter_with_suffix/src/main/java/com/testsigma/addons/ios/ConvertDateWithSuffixAction.java, date_formatter_with_suffix/src/main/java/com/testsigma/addons/mobileweb/ConvertDateWithSuffixAction.java, date_formatter_with_suffix/src/main/java/com/testsigma/addons/web/ConvertDateWithSuffixAction.java, date_formatter_with_suffix/src/main/java/com/testsigma/addons/restapi/ConvertDateWithSuffixAction.java
Five platform-specific action classes implementing identical logic: parse input date, compute ordinal day suffix (st/nd/rd/th), format output with suffix substitution, store result in runtime variable. Each includes formatWithSuffix() and getDaySuffix() helpers; broad exception handling returns FAILED result.
SDK Configuration
date_formatter_with_suffix/src/main/resources/testsigma-sdk.properties
Single property entry for testsigma-sdk.api.key with JWT token.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • Ganesh-Testsigma
  • vigneshtestsigma

Poem

🐰 Hops through dates with suffix grace,
First and second find their place,
Across five platforms, third and fourth align,
Ordinal magic makes time shine!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding a class to support suffix functionality in date formats across multiple platforms (Android, iOS, web, mobile web, REST API).

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

✨ Finishing touches
  • 📝 Generate docstrings

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @date_formatter_with_suffix/pom.xml:
- Around line 47-58: Update the Maven dependency versions in pom.xml for the
selenium-java and io.appium:artifactId entries by changing the <version> for
selenium-java to 4.39.0 and the <version> for java-client to 10.0.0; after
updating, run the build/tests (mvn verify or mvn test) to catch any
compatibility issues and address any API changes surfaced by the selenium-java
and io.appium:java-client upgrades.

In
@date_formatter_with_suffix/src/main/java/com/testsigma/addons/android/ConvertDateWithSuffixAction.java:
- Line 6: The import com.testsigma.sdk.WebAction is unused in
ConvertDateWithSuffixAction (the class extends AndroidAction), so remove that
unused import statement to clean up copy-paste residue; locate the import line
referencing WebAction in ConvertDateWithSuffixAction and delete it, leaving only
the needed imports for AndroidAction and any other referenced symbols.

In @date_formatter_with_suffix/src/main/resources/testsigma-sdk.properties:
- Line 1: Remove the hardcoded secret value for the property
testsigma-sdk.api.key and replace it with a reference to an environment variable
(e.g., testsigma-sdk.api.key=${TESTSIGMA_API_KEY}) or a placeholder; add a
template file (testsigma-sdk.properties.example) containing the placeholder and
document how to set TESTSIGMA_API_KEY locally, add testsigma-sdk.properties to
.gitignore so secrets are not committed, and if the current key was already
pushed, rotate/revoke it immediately.
🧹 Nitpick comments (6)
date_formatter_with_suffix/pom.xml (1)

36-46: JUnit uses milestone release; TestNG missing test scope.

  • junit-jupiter-api version 5.8.0-M1 is a milestone/pre-release version. Consider using a stable release (e.g., 5.10.x or 5.11.x).
  • testng dependency lacks <scope>test</scope>, so it will be bundled into the shaded JAR unnecessarily.
Suggested fix
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
             <version>6.14.3</version>
+            <scope>test</scope>
         </dependency>
date_formatter_with_suffix/src/main/java/com/testsigma/addons/restapi/ConvertDateWithSuffixAction.java (2)

6-6: Remove unused import.

WebAction is imported but never used. This class extends RestApiAction.

Suggested fix
 import com.testsigma.sdk.RestApiAction;
 import com.testsigma.sdk.Result;
-import com.testsigma.sdk.WebAction;
 import com.testsigma.sdk.annotation.Action;

91-111: Consider extracting shared date formatting logic to a common utility.

The formatWithSuffix and getDaySuffix methods are duplicated across all five platform implementations (Android, iOS, Web, MobileWeb, REST API). Extracting these to a shared utility class would reduce duplication and centralize maintenance.

Example shared utility
// In a new file: com/testsigma/addons/common/DateSuffixFormatter.java
package com.testsigma.addons.common;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public final class DateSuffixFormatter {

    private DateSuffixFormatter() {}

    public static String formatWithSuffix(LocalDate date, String format) {
        int day = date.getDayOfMonth();
        String suffix = getDaySuffix(day);
        String resolvedFormat = format.contains("<suffix>")
                ? format.replace("<suffix>", "'" + suffix + "'")
                : format;
        return date.format(DateTimeFormatter.ofPattern(resolvedFormat));
    }

    public static String getDaySuffix(int day) {
        if (day >= 11 && day <= 13) return "th";
        switch (day % 10) {
            case 1: return "st";
            case 2: return "nd";
            case 3: return "rd";
            default: return "th";
        }
    }
}
date_formatter_with_suffix/src/main/java/com/testsigma/addons/ios/ConvertDateWithSuffixAction.java (1)

6-6: Remove unused import.

WebAction is imported but never used. This class extends IOSAction.

Suggested fix
 import com.testsigma.sdk.IOSAction;
 import com.testsigma.sdk.Result;
-import com.testsigma.sdk.WebAction;
 import com.testsigma.sdk.annotation.Action;
date_formatter_with_suffix/src/main/java/com/testsigma/addons/mobileweb/ConvertDateWithSuffixAction.java (1)

54-57: Consider adding null checks for input values.

If any of dateVal.getValue(), inputFormat.getValue(), or options.getValue() returns null, calling .toString() will throw a NullPointerException. While the catch block handles it, the error message would be less descriptive for users.

💡 Proposed defensive check
      String inputDate = dateVal.getValue().toString();
      String inputPattern = inputFormat.getValue().toString();
      String outputPattern = options.getValue().toString();
+
+     if (inputDate.isEmpty() || inputPattern.isEmpty() || outputPattern.isEmpty()) {
+       setErrorMessage("Date value, input format, and output format must not be empty");
+       return Result.FAILED;
+     }
date_formatter_with_suffix/src/main/java/com/testsigma/addons/android/ConvertDateWithSuffixAction.java (1)

91-111: Consider extracting shared utility methods to reduce duplication.

The formatWithSuffix and getDaySuffix helper methods are duplicated across all five platform implementations (Android, iOS, Web, MobileWeb, REST API). Extracting these to a shared utility class would improve maintainability and reduce the risk of divergent behavior if changes are needed later.

💡 Example shared utility
// In a new file: com/testsigma/addons/common/DateSuffixUtil.java
package com.testsigma.addons.common;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public final class DateSuffixUtil {
    private DateSuffixUtil() {}
    
    public static String formatWithSuffix(LocalDate date, String format) {
        int day = date.getDayOfMonth();
        String suffix = getDaySuffix(day);
        String resolvedFormat = format.contains("<suffix>")
                ? format.replace("<suffix>", "'" + suffix + "'")
                : format;
        return date.format(DateTimeFormatter.ofPattern(resolvedFormat));
    }
    
    public static String getDaySuffix(int day) {
        if (day >= 11 && day <= 13) return "th";
        switch (day % 10) {
            case 1: return "st";
            case 2: return "nd";
            case 3: return "rd";
            default: return "th";
        }
    }
}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c3f495 and 6630b3f.

📒 Files selected for processing (7)
  • date_formatter_with_suffix/pom.xml
  • date_formatter_with_suffix/src/main/java/com/testsigma/addons/android/ConvertDateWithSuffixAction.java
  • date_formatter_with_suffix/src/main/java/com/testsigma/addons/ios/ConvertDateWithSuffixAction.java
  • date_formatter_with_suffix/src/main/java/com/testsigma/addons/mobileweb/ConvertDateWithSuffixAction.java
  • date_formatter_with_suffix/src/main/java/com/testsigma/addons/restapi/ConvertDateWithSuffixAction.java
  • date_formatter_with_suffix/src/main/java/com/testsigma/addons/web/ConvertDateWithSuffixAction.java
  • date_formatter_with_suffix/src/main/resources/testsigma-sdk.properties
🔇 Additional comments (7)
date_formatter_with_suffix/src/main/java/com/testsigma/addons/web/ConvertDateWithSuffixAction.java (1)

48-88: Implementation looks correct.

The date parsing, suffix formatting, and runtime variable storage logic are well-structured. Error handling appropriately catches exceptions and returns a meaningful error message.

date_formatter_with_suffix/src/main/java/com/testsigma/addons/ios/ConvertDateWithSuffixAction.java (1)

103-110: Day suffix logic is correct.

The getDaySuffix method correctly handles edge cases:

  • Days 11, 12, 13 → "th" (eleventh, twelfth, thirteenth)
  • Days ending in 1 (except 11) → "st"
  • Days ending in 2 (except 12) → "nd"
  • Days ending in 3 (except 13) → "rd"
  • All others → "th"
date_formatter_with_suffix/src/main/java/com/testsigma/addons/mobileweb/ConvertDateWithSuffixAction.java (4)

1-14: LGTM!

Package declaration and imports are correctly structured for a mobile web action implementation.


15-47: LGTM!

The action annotation and field declarations correctly configure the mobile web action with appropriate test data bindings and runtime variable support.


90-100: LGTM!

The suffix replacement logic correctly wraps the ordinal suffix in single quotes for DateTimeFormatter literal text handling.


102-110: LGTM!

The ordinal suffix logic correctly handles the English special cases for 11th, 12th, and 13th.

date_formatter_with_suffix/src/main/java/com/testsigma/addons/android/ConvertDateWithSuffixAction.java (1)

16-48: LGTM!

The action annotation correctly configures ApplicationType.ANDROID and the class properly extends AndroidAction.

Comment on lines +47 to +58
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.33.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>9.4.0</version>
</dependency>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify Selenium and Appium java-client versions exist on Maven Central

echo "Checking Selenium 4.33.0..."
curl -s "https://search.maven.org/solrsearch/select?q=g:org.seleniumhq.selenium+AND+a:selenium-java+AND+v:4.33.0&rows=1&wt=json" | jq '.response.numFound'

echo "Checking Appium java-client 9.4.0..."
curl -s "https://search.maven.org/solrsearch/select?q=g:io.appium+AND+a:java-client+AND+v:9.4.0&rows=1&wt=json" | jq '.response.numFound'

echo "Latest Selenium version..."
curl -s "https://search.maven.org/solrsearch/select?q=g:org.seleniumhq.selenium+AND+a:selenium-java&rows=1&wt=json" | jq -r '.response.docs[0].latestVersion'

echo "Latest Appium java-client version..."
curl -s "https://search.maven.org/solrsearch/select?q=g:io.appium+AND+a:java-client&rows=1&wt=json" | jq -r '.response.docs[0].latestVersion'

Repository: testsigmahq/testsigma-addons

Length of output: 200


🌐 Web query:

Selenium 4.33.0 Maven Central release date

💡 Result:

Selenium 4.33.0 was published to Maven Central on May 23, 2025. [1][2]

Sources:

  • Maven Central artifact listing for selenium-java 4.33.0 (files timestamped 2025-05-23). [1]
  • Selenium blog release announcement (May 25, 2025). [2]

🌐 Web query:

Appium java-client 9.4.0 Maven Central release date

💡 Result:

Appium java-client 9.4.0 was published to Maven Central on January 21, 2025. [1][2]

Sources:
[1] Maven Central (repo1.maven.org) listing for io.appium:java-client:9.4.0.
[2] MVNRepository entry for io.appium:java-client:9.4.0 (date: Jan 21, 2025).


🌐 Web query:

latest Selenium 4 version Maven 2025

💡 Result:

Latest Selenium 4 stable (as of Jan 12, 2026) is 4.39.0. [1][2]

Maven dependency:

org.seleniumhq.selenium
selenium-java
4.39.0

Sources: Selenium downloads page [1]; Maven Central (org.seleniumhq.selenium:selenium-java 4.39.0) [2].


🌐 Web query:

latest Appium java-client version 2025

💡 Result:

The latest Appium java-client release is 10.0.0 (published to Maven Central on August 13, 2025). [1][2]

Maven coordinate:

  • io.appium:java-client:10.0.0. [2]

Sources:
[1] Appium Java Client releases (GitHub).
[2] Maven Central — io.appium/java-client/10.0.0.


Update dependencies to current stable versions.

Selenium 4.33.0 and Appium java-client 9.4.0 exist on Maven Central but are outdated. Consider upgrading:

  • Selenium to 4.39.0 (current as of January 2026; 6 versions ahead)
  • Appium java-client to 10.0.0 (latest major release from August 2025)
🤖 Prompt for AI Agents
In @date_formatter_with_suffix/pom.xml around lines 47 - 58, Update the Maven
dependency versions in pom.xml for the selenium-java and io.appium:artifactId
entries by changing the <version> for selenium-java to 4.39.0 and the <version>
for java-client to 10.0.0; after updating, run the build/tests (mvn verify or
mvn test) to catch any compatibility issues and address any API changes surfaced
by the selenium-java and io.appium:java-client upgrades.

import com.testsigma.sdk.AndroidAction;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.WebAction;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused import.

WebAction is imported but not used—this class extends AndroidAction. This appears to be copy-paste residue from another platform implementation.

🧹 Proposed fix
 import com.testsigma.sdk.AndroidAction;
 import com.testsigma.sdk.ApplicationType;
 import com.testsigma.sdk.Result;
-import com.testsigma.sdk.WebAction;
 import com.testsigma.sdk.annotation.Action;
📝 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
import com.testsigma.sdk.WebAction;
import com.testsigma.sdk.AndroidAction;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.annotation.Action;
🤖 Prompt for AI Agents
In
@date_formatter_with_suffix/src/main/java/com/testsigma/addons/android/ConvertDateWithSuffixAction.java
at line 6, The import com.testsigma.sdk.WebAction is unused in
ConvertDateWithSuffixAction (the class extends AndroidAction), so remove that
unused import statement to clean up copy-paste residue; locate the import line
referencing WebAction in ConvertDateWithSuffixAction and delete it, leaving only
the needed imports for AndroidAction and any other referenced symbols.

@@ -0,0 +1 @@
testsigma-sdk.api.key=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyMjMyMmM2Ni04NWYzLWIyN2UtN2FiOS0zM2U2M2Q4OWM1MGIiLCJ1bmlxdWVJZCI6IjU4NDQiLCJpZGVudGl0eUFjY291bnRVVUlkIjoiNDMifQ.FpxIrv3q9SUkFvmMBR9wnmjrG1NCDp3pDeB6w2E_TCCtM2SxV9PNHwTdELZCzyNRRLIbODcyEewzU0YhDGGCyw No newline at end of file
Copy link

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 hardcoded API key from source control.

Committing secrets (API keys, tokens, passwords) to version control is a serious security risk. If this repository is or becomes public, or if the commit history is ever exposed, this key could be compromised.

Recommended approaches:

  1. Use environment variables: testsigma-sdk.api.key=${TESTSIGMA_API_KEY}
  2. Use a placeholder value and document that developers should set it locally
  3. Add this file to .gitignore and provide a .properties.example template

If this key has already been pushed to a remote repository, consider rotating it immediately.

🤖 Prompt for AI Agents
In @date_formatter_with_suffix/src/main/resources/testsigma-sdk.properties at
line 1, Remove the hardcoded secret value for the property testsigma-sdk.api.key
and replace it with a reference to an environment variable (e.g.,
testsigma-sdk.api.key=${TESTSIGMA_API_KEY}) or a placeholder; add a template
file (testsigma-sdk.properties.example) containing the placeholder and document
how to set TESTSIGMA_API_KEY locally, add testsigma-sdk.properties to .gitignore
so secrets are not committed, and if the current key was already pushed,
rotate/revoke it immediately.

@akhil-testsigma akhil-testsigma merged commit 2112143 into dev Jan 13, 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.

3 participants