-
Notifications
You must be signed in to change notification settings - Fork 16
feat/CUS-10023-Added class to support suffix in date formats #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat/CUS-10023-Added class to support suffix in date formats #299
Conversation
📝 WalkthroughWalkthroughThis 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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. Comment |
There was a problem hiding this 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-apiversion5.8.0-M1is a milestone/pre-release version. Consider using a stable release (e.g.,5.10.xor5.11.x).testngdependency 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.
WebActionis imported but never used. This class extendsRestApiAction.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
formatWithSuffixandgetDaySuffixmethods 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.
WebActionis imported but never used. This class extendsIOSAction.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(), oroptions.getValue()returnsnull, calling.toString()will throw aNullPointerException. 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
formatWithSuffixandgetDaySuffixhelper 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
📒 Files selected for processing (7)
date_formatter_with_suffix/pom.xmldate_formatter_with_suffix/src/main/java/com/testsigma/addons/android/ConvertDateWithSuffixAction.javadate_formatter_with_suffix/src/main/java/com/testsigma/addons/ios/ConvertDateWithSuffixAction.javadate_formatter_with_suffix/src/main/java/com/testsigma/addons/mobileweb/ConvertDateWithSuffixAction.javadate_formatter_with_suffix/src/main/java/com/testsigma/addons/restapi/ConvertDateWithSuffixAction.javadate_formatter_with_suffix/src/main/java/com/testsigma/addons/web/ConvertDateWithSuffixAction.javadate_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
getDaySuffixmethod 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
DateTimeFormatterliteral 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.ANDROIDand the class properly extendsAndroidAction.
| <!-- 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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
- Use environment variables:
testsigma-sdk.api.key=${TESTSIGMA_API_KEY} - Use a placeholder value and document that developers should set it locally
- Add this file to
.gitignoreand provide a.properties.exampletemplate
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.
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
✏️ Tip: You can customize this high-level summary in your review settings.