Skip to content

Conversation

@BhuvanaShreeBS
Copy link

@BhuvanaShreeBS BhuvanaShreeBS commented Dec 2, 2025

Improved Admin UI Automation with Enhanced ExtentReport Logging

Summary by CodeRabbit

  • New Features

    • Centralized test reporting with per-test entries, step-level messages, failure screenshots, known-issue tracking, and optional report upload.
  • Tests

    • New test listeners and known-issue auto-skip; many UI tests now emit descriptive per-step logs, improved synchronization, and richer assertions.
  • Chores

    • Standardized test setup/teardown and helper utilities; CI test container rebuilt on Alpine; reporting library version upgraded.

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

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
@coderabbitai
Copy link

coderabbitai bot commented Dec 2, 2025

Walkthrough

Adds a centralized ExtentReports manager and TestNG listeners for per-test reporting and known‑issue skipping, extends Commons with descriptive overloads and wait/log utilities, updates BaseClass setup/teardown to integrate reporting and screenshots, updates many UI tests to use descriptive actions, and switches the Docker base image.

Changes

Cohort / File(s) Change Summary
Reporting infra
\uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java``
New class: centralized ExtentReports manager with ThreadLocal ExtentTest, step/locator logging, HTML-escaped locator output, base64 screenshot attachments, pass/fail/skip/knownIssue counters, git/system info collection, optional S3/MinIO push, and report path management.
Test listeners & runner
\.../AdminTestListener.java`, `.../KnownIssueListener.java`, `.../TestRunner.java`, `uitest-admin/src/main/resources/testngFile/testng.xml``
Added AdminTestListener (ITestListener) for per-test lifecycle and finalization; KnownIssueListener (IInvokedMethodListener) to skip tests listed in TestRunner.knownIssues; TestRunner loads Known_Issues.txt into a public knownIssues map; testng.xml registers the listeners.
Base test harness
\uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java``
setUp signature now accepts Method and initializes reporting; tearDown accepts ITestResult, captures failure screenshots (base64) and attaches to report; uses Duration-based waits, explicit login/language handling, and ensures driver cleanup.
Commons helpers
\uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java``
Large API augmentation: added descriptive-message overloads for click/enter/filter/dropdown/calendar/create/edit/activate/deactivate/decommission/etc.; introduced enterSensitive, wait utilities (getWait, waitForElementClickable/Visible, waitForPageLoad), locator formatting and logStep helpers; delegating overloads preserve backward compatibility.
UI tests
\uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/... `<br>`BlockListTest.java`, `BulkUploadTest.java`, `CenterTest.java`, `CenterTypeTest.java`, `DeviceSpecificationTest.java`, `DeviceTest.java`, `DeviceTypesTest.java`, `DocumentCategoriesTest.java`, `DocumentTypes.java`, `DynamicFieldTest.java`, `HolidaysTest.java`, `MachineSpecificationTest.java`, `MachineTest.java`, `MachineTypesTest.java`, `TemplateTest.java``
Tests updated to call Commons descriptive overloads for UI interactions (click, enter, dropdown, calendar, create, filter, edit, activate, deactivate); added descriptive messages and improved explicit waits; core test sequences preserved.
Emailable report
\uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java``
Extended to detect/aggregate/display Known Issues, added known-issue totals and per-test known-issue data, adjusted generation/rename logic to include known-issue counts and optional S3 push; exposed getters for known-issue counts.
Known issues resource
\uitest-admin/src/main/resources/config/Known_Issues.txt``
New placeholder file for listing known test case names with bug IDs to be skipped at runtime.
Container image
\uitest-admin/Dockerfile``
Base switched to eclipse-temurin:21-jre-alpine; replaced apt with apk installs; added chromium & chromedriver, kubectl, non‑root user creation, adjusted workdir, permissions, ownership, and entrypoint.
Build config
\uitest-admin/pom.xml``
Bumped extentreports dependency from 5.0.9 to 5.1.2.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant TestNG
    participant KnownIssueListener
    participant AdminTestListener
    participant BaseClass
    participant TestCase
    participant Commons
    participant AdminExtentReportManager
    participant S3[(S3/MinIO)]

    TestNG->>KnownIssueListener: beforeInvocation(method)
    KnownIssueListener-->>TestNG: throws SkipException if listed

    TestNG->>AdminTestListener: onStart(suite)
    AdminTestListener->>AdminExtentReportManager: initReport()

    TestNG->>BaseClass: setUp(testMethod)
    BaseClass->>AdminExtentReportManager: createTest(testName)

    TestNG->>TestCase: run `@Test`
    TestCase->>Commons: performAction(locator/value, "description")
    Commons->>AdminExtentReportManager: logStepWithLocator(description, locatorHtml)

    alt failure
        TestCase->>BaseClass: tearDown(result)
        BaseClass->>AdminExtentReportManager: attachScreenshotFromBase64(base64, title)
        BaseClass->>AdminExtentReportManager: incrementFailed()
    else success
        BaseClass->>AdminExtentReportManager: incrementPassed()
    end

    AdminTestListener->>AdminExtentReportManager: flushReport()
    AdminExtentReportManager->>S3: pushReportToS3(reportFilePath) (optional)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~55 minutes

  • Files warranting focused review:
    • AdminExtentReportManager.java — thread-safety, HTML-escaping, git/S3 interactions, attachment handling.
    • Commons.java — many new overloads, wait/calendar logic, and backward-compatibility delegations.
    • BaseClass.java — signature changes, teardown screenshot capture/attachment, driver lifecycle implications.
    • EmailableReport.java & TestRunner.java — known-issues integration, totals calculation, report rename logic.
    • Representative UI tests (e.g., BulkUploadTest.java, CenterTest.java) — verify descriptive calls and waits did not alter assertions/timing.

Possibly related PRs

Suggested reviewers

  • ase-101
  • mohanachandran-s

Poem

"I hopped through code with tiny feet,
Each click now whispers a message sweet,
I tuck screenshots in a cozy nest,
Skip known hiccups — rest is best,
A rabbit cheers — tests pass in a beat!"

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.93% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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 accurately describes the main change: enhanced ExtentReport logging for Admin UI automation reporting, matching the core focus of the PR.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

🧹 Nitpick comments (7)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)

44-48: AdminTestListener is only registered for the programmatic suite path

Here the listener is added only when ConfigManager.gettestcases() is non-empty. For runs that use XML suite files (else branch), AdminTestListener will not be attached unless the XML also declares it. If you want consistent reporting across both paths, consider also registering the listener in the XML-based flow (e.g., via runner.addListener(new AdminTestListener()) or equivalent XML configuration).

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)

36-232: Extent report manager looks solid; only minor robustness tweaks are optional

The lazy, synchronized initialization, ThreadLocal ExtentTest, and git-info fallbacks are all well-structured and should behave correctly under normal and parallel TestNG runs. If you ever need to run these tests from different working directories or CI agents, you might consider (optionally) making reportPath configurable and ensuring the test-output directory exists before creating the ExtentSparkReporter, but that’s a nice-to-have rather than a blocker.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DocumentCategoriesTest.java (1)

28-39: Consider consolidating name + description edits to avoid layered save flows

Here you call Commons.edit(driver(), data + 1/2, By.id("name"), ...), and then separately Commons.enter on description followed by Commons.create. Since Commons.edit already encapsulates click‑ellipsis → edit → enter new value → create → confirm, layering another manual enter + create on top can be a bit opaque and may result in multiple save/confirm cycles for the same record.

If the UI really requires updating both name and description in one pass, consider introducing a small helper (e.g., editCategoryNameAndDescription(...)) inside Commons that performs all the necessary field updates and a single save/confirm sequence. That would make the intent clearer and reduce coupling to the exact button/confirm sequence in the UI.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java (1)

38-42: Consider logging the exception details in the catch block.

While Reporter.log captures that the zone dropdown is unavailable, logging the exception details could help diagnose unexpected failures.

Apply this diff to add exception logging:

 try {
     Commons.dropdown(driver(), By.id("zone"), "Selected Zone");
 } catch (Exception e) {
     Reporter.log("Zone dropdown not available", true);
+    Reporter.log("Exception: " + e.getMessage(), true);
 }
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (1)

32-35: Consider logging exception details for better diagnostics.

The empty catch block silently swallows exceptions, which could make debugging harder if unexpected errors occur.

Apply this diff to add exception logging:

 try {
     Commons.dropdown(driver(), By.id("zone"), "Selected Zone");
 } catch (Exception e) {
+    Reporter.log("Zone dropdown not available or failed: " + e.getMessage(), true);
 }
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DynamicFieldTest.java (1)

24-25: Clarify string concatenation intent for edit values.

data + 1 and data + 2 perform string concatenation (e.g., "20251202051210""202512020512101"). This creates unique values but may be confusing. Consider using more explicit suffixes like data + "_v1" or documenting the intent.

-		Commons.edit(driver(), data + 1, By.id("code"), "Editing Dynamic Field Code");
+		Commons.edit(driver(), data + "_v1", By.id("code"), "Editing Dynamic Field Code");
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)

444-460: Inconsistent sleep usage - use Commons.wait() instead of Thread.sleep().

The calendar(String date, String locale, String description) method uses Thread.sleep(500) directly (lines 444, 449, 455, 460), while the other calendar overload uses Commons.wait(500). For consistency and proper exception handling, use Commons.wait() throughout.

 			Commons.click(driver(), By.xpath("//*[@class='mat-datepicker-toggle']//button"), "Opened the datepicker");
-			Thread.sleep(500);
+			wait(500);

 			Commons.click(driver(), By.xpath("//*[@class='mat-calendar-arrow']"),
 					"Expanded year/month selector in datepicker");
-			Thread.sleep(500);
+			wait(500);

 			String yearText = convertDigits(String.valueOf(year), locale);
 			Commons.click(driver(), By.xpath("//*[normalize-space(text())='" + yearText + "']"),
 					"Selected year: " + yearText);
-			Thread.sleep(500);
+			wait(500);

 			List<WebElement> months = driver().findElements(By.xpath("//*[@class='mat-calendar-body-cell-content']"));
 			months.get(month - 1).click();
-			Thread.sleep(500);
+			wait(500);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d7c30a and e3859fd.

📒 Files selected for processing (20)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/BlockListTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/CenterTypeTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DeviceSpecificationTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTypesTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DocumentCategoriesTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DocumentTypes.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DynamicFieldTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/HolidaysTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineSpecificationTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTypesTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/TemplateTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (6 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (2 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (14)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java (1)
  • BaseTestCaseFunc (30-230)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DocumentCategoriesTest.java (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)
  • BaseClass (27-198)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (21-490)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DocumentTypes.java (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)
  • BaseClass (27-198)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (21-490)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)
  • AdminExtentReportManager (21-233)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (21-490)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/TemplateTest.java (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (21-490)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (21-490)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DynamicFieldTest.java (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (21-490)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/BlockListTest.java (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (21-490)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (21-490)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)
  • TestRunner (19-204)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Screenshot.java (1)
  • Screenshot (17-33)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTypesTest.java (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)
  • BaseClass (27-198)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (21-490)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineSpecificationTest.java (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)
  • BaseClass (27-198)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (21-490)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DeviceSpecificationTest.java (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)
  • BaseClass (27-198)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (21-490)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)
  • AdminExtentReportManager (21-233)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Screenshot.java (1)
  • Screenshot (17-33)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (21-490)
🔇 Additional comments (19)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DocumentTypes.java (1)

10-37: CRUD flow unchanged; Commons logging integration looks good

This test now delegates all interactions to the descriptive Commons helpers while preserving the existing CRUD sequence (create → filter → edit → activate → edit → deactivate). The step messages are clear and should render nicely in the new Extent report.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTypesTest.java (1)

9-35: Machine types test is cleanly instrumented for reporting

The CRUD steps are unchanged and now consistently go through Commons with clear descriptions (navigation, create, filter, edits, activate/deactivate). This aligns with the new reporting pattern and doesn’t introduce functional risk.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/TemplateTest.java (1)

9-40: Template CRUD test now provides detailed, step-level logging

The test still follows the same CRUD sequence but now uses the descriptive Commons overloads for clicks, inputs, and dropdown selections. This should improve traceability in the Extent report without changing behavior.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/CenterTypeTest.java (1)

11-35: CenterType CRUD test is consistent and well-described

The refactor to Commons with descriptive messages keeps the original CRUD logic intact while making each step explicit in the report (navigation, create, two edit passes, activate/deactivate). Looks good.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/HolidaysTest.java (1)

13-37: LGTM! Enhanced logging improves test observability.

The descriptive messages added to all Commons method calls provide clear, step-by-step documentation of test actions. This aligns well with the PR's objective of improving reporting for Admin UI automation.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTypesTest.java (1)

13-39: LGTM! Descriptive messages enhance test traceability.

The added descriptive messages provide clear context for each UI interaction, making test reports more informative and easier to debug.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DeviceSpecificationTest.java (1)

13-38: LGTM! Clear and consistent logging enhancement.

The descriptive messages follow a consistent pattern across the test suite and provide valuable context for each test step.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java (1)

17-43: LGTM! Comprehensive logging for device CRUD operations.

The descriptive messages cover all device management operations (create, filter, edit, activate, deactivate, decommission) with clear, actionable descriptions.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java (1)

20-78: LGTM! Comprehensive center configuration with enhanced logging.

The test now includes detailed logging for all center configuration steps, including hierarchy levels, service selections, and exceptional holiday handling. The defensive try-catch for the optional zone dropdown is a good practice.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineSpecificationTest.java (1)

13-38: LGTM! Clear machine specification test logging.

The descriptive messages provide excellent traceability for machine specification CRUD operations.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (1)

16-53: LGTM! Comprehensive machine CRUD test with locale-aware calendar handling.

The test includes detailed logging for all machine management operations, with proper locale handling for date selection. The defensive try-catch for the optional zone dropdown is appropriate.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java (1)

21-58: LGTM! Enhanced bulk upload flow with iterative operation testing.

The refactored test now systematically validates all three operations (Insert, Update, Delete) through a clean loop structure. The enhanced logging provides clear context for each step, and the assertion improvements make test results more readable.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (2)

146-153: LGTM - Cleanup order is correct.

The finally block properly ensures driver cleanup and report flushing regardless of test outcome. The order (flush before remove) correctly persists data before clearing the ThreadLocal.


49-51: This review comment is based on code that does not exist in the current codebase. The setUp() method does not have a Method testMethod parameter, does not call AdminExtentReportManager.initReport(), and does not contain the code snippet shown. Lines 49-51 actually contain OS detection logic for Docker setup, not report initialization. The AdminExtentReportManager class is not imported or used anywhere in this file.

Likely an incorrect or invalid review comment.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/DynamicFieldTest.java (1)

11-34: LGTM - Test enhanced with descriptive logging.

The CRUD test flow is clear, and the descriptive messages provide good traceability in the ExtentReport. The action sequence (create → filter → edit → activate → edit → deactivate) covers the expected lifecycle operations.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/BlockListTest.java (1)

12-43: LGTM - Test structure with descriptive logging is clear.

Apart from the filter mismatch noted above, the test flow is well-structured with clear descriptive messages for each action. The second edit/filter cycle (lines 37-39) correctly matches the edited value.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (3)

33-46: LGTM - Helper methods for logging are well-implemented.

The logStep and getLocator helper methods provide clean abstraction for logging. The null check in getLocator (line 38) prevents NPE, and the locator formatting is readable.


48-69: LGTM - Filter methods with description delegation.

The filter method correctly logs the description with filter value, and the no-argument overload properly delegates to the description-enabled version with a default message.


220-248: LGTM - Activate/Deactivate methods are well-structured.

Both methods properly log the action description via AdminExtentReportManager.logStep(), handle confirmation popups conditionally, and delegate from no-description overloads correctly.

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 0

♻️ Duplicate comments (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)

127-132: Incorrect fallback in enter() - JavaScript click instead of setValue.

The generic exception handler uses executor.executeScript("arguments[0].click();", ...) which clicks the element instead of entering text. This will leave the field empty on failure.

 		} catch (Exception e) {
 			Reporter.log("<p><img src='data:image/png;base64," + Screenshot.ClickScreenshot(driver)
 					+ "' width='900' height='450'/></p>");
+			logger.error("Enter failed: " + e.getMessage());
 			JavascriptExecutor executor = (JavascriptExecutor) driver;
-			executor.executeScript("arguments[0].click();", driver.findElement(by));
+			executor.executeScript("arguments[0].value = arguments[1];", driver.findElement(by), value);
 		}
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)

92-118: Login steps are logged before test entry is created.

The Commons.click and Commons.enter calls for login (lines 92-102) execute before AdminExtentReportManager.createTest() (line 116). Since getTest() returns null at that point, these login steps won't appear in the ExtentReport for the test.

Move test creation earlier, right after initReport():

 	public void setUp(Method testMethod) throws Exception {
 		AdminExtentReportManager.initReport();
+
+		String className = this.getClass().getSimpleName();
+		String methodName = testMethod.getName();
+		String lang = "unknown";
+		try {
+			lang = ConfigManager.getloginlang();
+		} catch (Exception ignored) {
+		}
+		String cleanName = className + " | " + methodName + " | Language: " + lang;
+		AdminExtentReportManager.createTest(cleanName);
+		AdminExtentReportManager.logStep("Setup started for " + cleanName);

 		Reporter.log("BaseClass setup started", true);
 		// ... rest of setup including login steps ...
-
-		if (AdminExtentReportManager.getTest() == null) {
-			// ... test creation code ...
-		}
+		AdminExtentReportManager.logStep("Setup complete for " + cleanName);
 	}
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1)

36-64: Duplicate test status reporting with BaseClass.tearDown.

Both AdminTestListener (here) and BaseClass.tearDown log pass/fail/skip status and call test.pass(), test.fail(), or test.skip(). This will produce duplicate entries in the ExtentReport.

Consolidate status reporting in one place. Since BaseClass.tearDown already handles screenshot capture on failure, consider:

  1. Keeping status logging only in BaseClass.tearDown and removing it from the listener, or
  2. Keeping it only in the listener and removing the status calls from BaseClass.tearDown

Option 2 is cleaner since listeners are the intended TestNG mechanism for status handling:

// In BaseClass.tearDown, remove the status logging:
-			} else if (result != null && result.getStatus() == ITestResult.SUCCESS) {
-			    ExtentTest test = AdminExtentReportManager.getTest();
-			    if (test != null) {
-			        test.pass("✅ Test Passed: " + result.getName());
-			    }
-			} else if (result != null && result.getStatus() == ITestResult.SKIP) {
-			    ExtentTest test = AdminExtentReportManager.getTest();
-			    if (test != null) {
-			        test.skip("⚠️ Test Skipped: " + result.getName());
-			    }
-			}
+			}
// Keep only the FAILURE branch for screenshot capture, but remove the test.fail() calls
🧹 Nitpick comments (4)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (2)

58-64: Exception fallback in filter() only clicks element.

The catch block's JS fallback clicks the by element, but at this point in the flow, the operation has already partially failed (Filter button clicked, data entered). The fallback doesn't complete the filter operation meaningfully.

Consider logging the failure more explicitly and potentially retrying the full filter sequence, or simply propagating the exception after logging.


444-460: Inconsistent wait method usage.

The locale-aware calendar method uses Thread.sleep(500) directly (lines 444, 449, 455, 460) while the other calendar overload uses Commons.wait(500). For consistency and proper exception handling, use Commons.wait(500) throughout.

-			Thread.sleep(500);
+			Commons.wait(500);
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1)

66-69: Consider removing per-test flush in BaseClass.

onFinish correctly flushes the report at suite completion. However, BaseClass.tearDown also calls flushReport() after each test (line 157 in BaseClass). Flushing once at suite end is more efficient.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)

81-81: Deprecated implicit wait API.

implicitlyWait(long, TimeUnit) is deprecated in Selenium 4. Use implicitlyWait(Duration.ofSeconds(20)) instead.

+import java.time.Duration;
 ...
-		driver().manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
+		driver().manage().timeouts().implicitlyWait(Duration.ofSeconds(20));
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79e3077 and 4d17a61.

📒 Files selected for processing (3)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (6 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)
  • AdminExtentReportManager (21-233)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)
  • AdminExtentReportManager (21-233)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Screenshot.java (1)
  • Screenshot (17-33)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)
  • BaseClass (27-204)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)
  • AdminExtentReportManager (21-233)
🔇 Additional comments (8)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (4)

33-46: Well-structured logging helpers.

The logStep and getLocator helpers cleanly abstract locator formatting and step logging. Good use of null-safe handling in getLocator.


139-157: Dropdown method with first-item selection.

The method correctly logs the step, handles the aria-owns attribute parsing, and selects the first option. The exception fallback pattern is consistent with other methods.


250-276: Edit workflow with enhanced logging.

The edit method properly logs each step with descriptive messages. The assertion at line 256-257 validates the existing value differs from new data before editing.


220-248: Well-implemented deactivate/activate workflows.

Both methods properly log steps with descriptive messages, handle conditional popups, and have clean overload delegation patterns.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (2)

19-22: Report initialization on suite start.

The onStart method properly initializes the ExtentReport at the beginning of the test context. This is the correct lifecycle hook for suite-level initialization.


24-34: Test creation with parameterized name support.

Good handling of parameterized tests by appending parameter values to the test name for better report clarity.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (2)

141-151: Null checks added for SUCCESS and SKIP branches.

The null guards for AdminExtentReportManager.getTest() in the SUCCESS (lines 142-145) and SKIP (lines 147-150) branches address the past review concern about potential NPEs.

Note: As mentioned in the AdminTestListener review, this status reporting duplicates the listener's behavior. Consider consolidating to one location.


152-159: Robust cleanup in finally block.

The finally block ensures driver cleanup and test removal regardless of test outcome. The null check before quit is good defensive programming.

Consider removing flushReport() here since AdminTestListener.onFinish handles suite-level flushing, which is more efficient than per-test flushing.

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 1

♻️ Duplicate comments (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)

127-132: Bug: JavaScript fallback clicks instead of entering text.

The generic exception handler still uses arguments[0].click() instead of setting the element's value. This was flagged in a previous review and should be addressed.

 		} catch (Exception e) {
 			Reporter.log("<p><img src='data:image/png;base64," + Screenshot.ClickScreenshot(driver)
 					+ "' width='900' height='450'/></p>");
+			logger.error("Enter failed: " + e.getMessage());
 			JavascriptExecutor executor = (JavascriptExecutor) driver;
-			executor.executeScript("arguments[0].click();", driver.findElement(by));
+			executor.executeScript("arguments[0].value = arguments[1];", driver.findElement(by), value);
 		}
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)

93-119: Login steps are logged before test entry is created.

Commons.click and Commons.enter calls for login (lines 93-103) execute before AdminExtentReportManager.createTest() at line 117. Since getTest() returns null at that point, these login steps won't appear in the ExtentReport. Move createTest() earlier, right after initReport().

 	public void setUp(Method testMethod) throws Exception {
 		AdminExtentReportManager.initReport();

+		String className = this.getClass().getSimpleName();
+		String methodName = testMethod.getName();
+		String lang = "unknown";
+		try {
+			lang = ConfigManager.getloginlang();
+		} catch (Exception ignored) {
+		}
+		String cleanName = className + " | " + methodName + " | Language: " + lang;
+		AdminExtentReportManager.createTest(cleanName);
+		AdminExtentReportManager.logStep("Setup started for " + cleanName);
+
 		Reporter.log("BaseClass setup started", true);
 		// ... driver setup ...
 
 		Commons.click(driver(), By.xpath("//*[@id='kc-locale-dropdown']"), "Clicked on language dropdown");
 		// ... login steps ...
 
-		if (AdminExtentReportManager.getTest() == null) {
-			// ... test creation logic ...
-		}
+		AdminExtentReportManager.logStep("Setup complete");
 	}
🧹 Nitpick comments (5)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (4)

58-64: Questionable exception recovery: clicking filter input after failure.

The catch block executes a JavaScript click on the filter input element (by), which doesn't logically recover from a failed filter operation. This appears to be copy-pasted fallback code that may mask the actual failure rather than properly handling it. Consider logging the error and rethrowing, or implementing meaningful recovery logic.

 		catch (Exception e) {
 			Reporter.log("<p><img src='data:image/png;base64," + Screenshot.ClickScreenshot(driver)
 					+ "' width='900' height='450'/></p>");
-			logger.info(e.getMessage());
-			JavascriptExecutor executor = (JavascriptExecutor) driver;
-			executor.executeScript("arguments[0].click();", driver.findElement(by));
+			logger.error("Filter operation failed: " + e.getMessage());
+			throw new RuntimeException("Filter operation failed", e);
 		}

171-175: Inconsistent error handling: missing screenshot capture.

Unlike dropdown(driver, by, description) at line 151, this overload and others (dropdowncenter, dropdown with By value) don't capture screenshots on failure. For consistent debugging, align error handling across all dropdown variants.


422-424: Minor inconsistency: month selection bypasses logging wrapper.

Month selection uses raw WebElement.click() instead of Commons.click(), missing the step logging and error handling. Consider wrapping this for consistency:

-			List<WebElement> cli = driver().findElements(By.xpath("//*[@class='mat-calendar-body-cell-content']"));
-			cli.get(month - 1).click();
+			List<WebElement> months = driver().findElements(By.xpath("//*[@class='mat-calendar-body-cell-content']"));
+			WebElement monthElement = months.get(month - 1);
+			monthElement.click();
+			AdminExtentReportManager.logStep("Selected month index: " + month);

394-410: Fragile date parsing without format validation.

The date parsing assumes MM/DD/YYYY format and uses complex substring operations. Malformed input could cause StringIndexOutOfBoundsException or incorrect date selection. Consider using DateTimeFormatter for safer parsing:

// Example safer approach:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
LocalDate parsedDate = LocalDate.parse(date, formatter);
int month = parsedDate.getMonthValue();
int day = parsedDate.getDayOfMonth();
int year = parsedDate.getYear();
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)

8-8: Unused import: java.util.concurrent.TimeUnit.

This import is no longer needed since Duration is now used for implicitlyWait() at line 82.

-import java.util.concurrent.TimeUnit;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d17a61 and ba96af3.

📒 Files selected for processing (2)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (6 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)
  • AdminExtentReportManager (21-233)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)
  • AdminExtentReportManager (21-233)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Screenshot.java (1)
  • Screenshot (17-33)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
🔇 Additional comments (4)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (3)

33-46: LGTM! Clean helper methods for logging.

The logStep and getLocator helpers provide clean abstractions for ExtentReport logging with formatted locator strings.


364-366: Previously flagged issue has been addressed.

The createRes(WebDriver) method now correctly delegates to createRes(driver, "Create Resource") instead of create().


482-487: LGTM with note on existing technical debt.

The comment on line 483 acknowledges the need for a proper wait implementation. The try-catch pattern for element visibility checks is appropriate.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)

122-147: LGTM! Robust tearDown implementation.

The tearDown method properly:

  • Uses alwaysRun = true to ensure cleanup
  • Captures failure screenshots with null checks
  • Cleans up driver in finally block
  • Removes the test from ExtentReportManager

The previous NPE concern about SUCCESS/SKIP branches doesn't apply here since only FAILURE is handled (for screenshot capture), and the cleanup always runs.

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 0

♻️ Duplicate comments (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)

109-135: Bug: enter()/enterSensitive() fallback clicks the element instead of setting its value

In both enter(...) and enterSensitive(...), the generic catch (Exception e) currently does:

JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", driver.findElement(by));

This executes a JS click on the element instead of setting the intended text, so if the normal sendKeys path fails, the field is left unchanged while the test continues. That’s a functional error in the recovery path, especially for fields where the default value can still let the flow proceed.

You likely want to set the value via JS (and optionally fire change/input events), reusing the same value argument:

-        } catch (Exception e) {
-            Reporter.log("<p><img src='data:image/png;base64," + Screenshot.ClickScreenshot(driver)
-                    + "' width='900' height='450'/></p>");
-            JavascriptExecutor executor = (JavascriptExecutor) driver;
-            executor.executeScript("arguments[0].click();", driver.findElement(by));
-        }
+        } catch (Exception e) {
+            Reporter.log("<p><img src='data:image/png;base64," + Screenshot.ClickScreenshot(driver)
+                    + "' width='900' height='450'/></p>");
+            logger.error("Enter failed on " + by + ": " + e.getMessage());
+            JavascriptExecutor executor = (JavascriptExecutor) driver;
+            executor.executeScript(
+                    "arguments[0].value = arguments[1];",
+                    driver.findElement(by),
+                    value);
+        }

Apply the same pattern to enterSensitive(...) so that the sensitive value is still reliably populated even when the WebDriver path fails.

Also applies to: 137-159

🧹 Nitpick comments (7)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)

21-21: Unused import: ExtentTest.

This import is not directly used in the class. AdminExtentReportManager.getTest() returns an ExtentTest, but the result is never assigned to a local variable.

-import com.aventstack.extentreports.ExtentTest;
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (6)

48-68: Filter helpers: behavior OK, but JS fallback target seems questionable

The overall structure (log step → click filter → enter text / dropdown → click apply) looks good, and the new descriptions will help in reports. However, in the generic catch blocks you fall back to executor.executeScript("arguments[0].click();", driver.findElement(by));, which clicks the filter field/selector (by) rather than the “Filter” or “Apply” buttons that likely failed. That makes the recovery path a bit arbitrary and may not actually apply the filter; consider refining the fallback to target the specific control that failed (or simply rethrow after logging).

Also applies to: 70-87


89-107: click(): generic catch and JS-click fallback are acceptable but broad

The enriched logging and screenshot-on-failure behavior are useful, and JS-based click is a reasonable fallback for WebDriver interaction issues. The only concern is the broad catch (Exception e), which can swallow programming errors (e.g., NPE) and try to compensate with a JS click; if you ever debug flaky tests, it may help to narrow this to WebDriver-related exceptions or rethrow after logging for unexpected exception types.


161-200: Dropdown helpers are consistent; watch out for values containing quotes

The dropdown helpers nicely standardize logging and reuse click(...), and the different overloads (index 0, text value, By value, “center” variant) look internally consistent. One small edge case: in dropdown(WebDriver, By, String, String) you build an XPath using the raw value:

String val = "'" + value + "'";
By.xpath("//span[contains(text()," + val + ")]")

If any option text ever contains a single quote, that XPath will break. If such values are possible in your domains, consider adding a small helper to escape quotes in value before building the XPath.

Also applies to: 202-222, 224-239


405-413: getPreAppend(): consider logging instead of printStackTrace

Wrapping ConfigManager.getpreappend() in a try/catch is fine, but e.printStackTrace() will dump to stdout/stderr instead of your structured logs. For consistency with the rest of this class, you may want to log the exception via logger.error("Failed to get preappend", e); and possibly default preappend to an empty string to avoid "null" prefixes.


415-455: Calendar helpers: improved, locale-aware path looks good; consider harmonizing implementations

Both calendar helpers assume date is in MM/dd/yyyy and do minimal parsing. The new locale-aware overload (calendar(String date, String locale, String description)) is cleaner (no special-casing 10/20/30) and sensibly uses index-based month selection plus convertDigits for year/day, which should work well for locales like Arabic.

The older calendar(String date, String description) still uses the more brittle substring/replace("0","") logic for month/day. If you plan to keep both, consider refactoring that first method to reuse the simpler parsing logic from the locale-aware variant (e.g., parse month/day/year the same way and delegate) to reduce divergence and reduce the risk of format-related bugs.

Also applies to: 457-494


504-510: isElementDisplayed(): behavior OK; optional logging for unexpected failures

Returning false on any exception is often what you want in polling helpers like this, and the small sleep is fine for these tests. To aid debugging when the underlying issue is more serious (e.g., driver already quit), you might consider logging the exception at debug/trace once, or narrowing to WebDriver-related exceptions, instead of completely swallowing it.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba96af3 and bbeeb7b.

📒 Files selected for processing (2)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (6 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)
  • AdminExtentReportManager (21-233)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Screenshot.java (1)
  • Screenshot (17-33)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
🔇 Additional comments (7)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (5)

49-52: LGTM!

The Method testMethod parameter enables dynamic test naming, and initReport() initializes the ExtentReports instance appropriately at the start of setup.


78-81: LGTM!

Good modernization: using Duration.ofSeconds(20) aligns with Selenium 4's API and avoids the deprecated TimeUnit-based overload.


104-118: Verify test creation coordination with AdminTestListener.

The conditional if (AdminExtentReportManager.getTest() == null) suggests that AdminTestListener may already create the test before setUp runs. Confirm whether the listener consistently creates tests, as this determines if this block is necessary fallback logic or dead code. If not always created by the listener, login steps (lines 92-102) could execute without a test context.

Additionally, the silent exception catch at line 111 could mask configuration issues with getloginlang(). Consider logging the exception or making the fallback explicit.


100-102: Verify Commons.enterSensitive masks the password in logs.

Good that sensitive input is routed through a dedicated method. Ensure the implementation does not log the actual value.


121-145: Robust tearDown implementation following TestNG best practices.

Good practices:

  • alwaysRun = true ensures cleanup regardless of test outcome
  • Screenshot capture on FAILURE is wrapped in try-catch to prevent masking other failures
  • Finally block guarantees driver cleanup and thread-local removal
  • AdminExtentReportManager.removeTest() called in finally ensures report cleanup regardless of exception

The design correctly uses @AfterMethod(ITestResult) for result-dependent actions (failure screenshot capture) while delegating real-time result logging (SUCCESS/SKIP) to ITestListener callbacks or AdminExtentReportManager—this separation is consistent with TestNG best practices.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (2)

21-31: BaseClass extension and locator-aware logging look consistent

Extending BaseClass and centralizing logging through appendDate, logStep, and getLocator is coherent, and getLocator(By by) safely handles null and standard Selenium By.toString() formats. No issues from a correctness standpoint.

Also applies to: 33-46


241-243: Verify double-cancel behavior in editCenter() — two distinct cancel buttons?

The concern about identical locators for sequential cancel clicks is worth examining, but I cannot access the repository to verify the actual implementation of editCenter() or confirm whether there are indeed two distinct cancel buttons in the UI flow.

To resolve this, check:

  • The actual editCenter() method implementation in the file
  • Whether the UI contains two separate cancel buttons or if the same element is intentionally clicked twice
  • If two distinct buttons exist, adjust the second click to use the appropriate index ([2]) or alternative locator

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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

🧹 Nitpick comments (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (2)

154-180: Consider adding volatile to counter fields for visibility.

While the increment methods are properly synchronized, the counter fields (passedCount, failedCount, skippedCount) lack the volatile keyword, which means reads from getter methods may see stale values in multi-threaded execution. Since these are reporting metrics rather than critical state, the impact is low, but adding volatile would guarantee visibility across threads.

Apply this diff at the field declarations (lines 35-37):

-	private static int passedCount = 0;
-	private static int failedCount = 0;
-	private static int skippedCount = 0;
+	private static volatile int passedCount = 0;
+	private static volatile int failedCount = 0;
+	private static volatile int skippedCount = 0;

215-219: Enhance HTML escaping to include quotes.

The escapeHtml method only escapes &, <, and >, but omits quotes (" and '). While not a security concern in this test-reporting context, incomplete escaping could cause malformed HTML if locator strings contain quotes. Adding quote escaping ensures robust report rendering.

Apply this diff:

 	private static String escapeHtml(String s) {
 		if (s == null)
 			return "";
-		return s.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;");
+		return s.replace("&", "&amp;")
+		        .replace("<", "&lt;")
+		        .replace(">", "&gt;")
+		        .replace("\"", "&quot;")
+		        .replace("'", "&#39;");
 	}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bbeeb7b and faf58e2.

📒 Files selected for processing (2)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1 hunks)
  • uitest-admin/src/main/resources/testngFile/testng.xml (1 hunks)
🔇 Additional comments (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (2)

40-61: LGTM! Initialization logic is sound.

The report initialization with lazy instantiation and synchronized access is correct for parallel test execution. The dynamic report naming with git details and timestamp is a good practice for traceability.


221-230: LGTM! Screenshot attachment is properly guarded.

The null checks for both the test context and base64 data, combined with exception handling, make this a robust implementation.

uitest-admin/src/main/resources/testngFile/testng.xml (1)

29-29: LGTM! Listener integration is correct.

Adding AdminTestListener to the TestNG listeners aligns with the new ExtentReports infrastructure. Placing it before the EmailableReport listener ensures proper initialization order for the reporting lifecycle.

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between faf58e2 and f5c932a.

📒 Files selected for processing (1)
  • uitest-admin/Dockerfile (1 hunks)

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 0

♻️ Duplicate comments (1)
uitest-admin/Dockerfile (1)

1-40: Unresolved critical issue: Alpine base image incompatible with chromium-driver and build dependencies.

This comment mirrors the critical finding from the previous review. The Dockerfile still uses eclipse-temurin:21-jre-alpine with apk add chromium-chromedriver, which will fail because:

  1. Alpine's package repository does not provide chromium-chromedriver as a standalone package
  2. For a UI testing container requiring Selenium WebDriver automation, Alpine lacks the necessary browser automation toolchain

The prior recommendation stands: switch to a Debian-based image to preserve apt-get compatibility and ensure chromium-driver availability.

-FROM eclipse-temurin:21-jre-alpine
+FROM eclipse-temurin:21-jre-jammy

Then update the package installation to use apt-get and correct Debian package names:

-RUN apk -q update && \
-    apk add --no-cache wget curl unzip xvfb libxi chromium chromium-chromedriver bash shadow && \
+RUN apt-get -qq update && \
+    apt-get install -y --no-install-recommends wget curl unzip xvfb libxi6 chromium-browser chromium-chromedriver && \
🧹 Nitpick comments (1)
uitest-admin/Dockerfile (1)

42-50: Simplify redundant permission and ownership setup.

The COPY instructions and subsequent permission fixes can be consolidated for clarity:

  • Line 43: --chmod=771 is non-standard (typically 755 for executables).
  • Lines 45/49: JAR permissions are set after COPY; these can use --chmod in the COPY instruction instead.
  • Line 50: chown -R after COPY with --chown is redundant.

Suggested refactor:

-COPY --chown=${container_user_uid}:${container_user} --chmod=771 ./entrypoint.sh ${work_dir}/entrypoint.sh
-COPY --chown=${container_user}:${container_user} ./src/main/resources/ ${work_dir}/resources/
-COPY --chown=${container_user_uid}:${container_user} ./target/*.jar ${work_dir}
-
-# --- Fix permissions for entrypoint and JARs ---
-RUN chmod +x ${work_dir}/entrypoint.sh && \
-    find ${work_dir} -name "*.jar" -exec chmod 644 {} \; && \
-    chown -R ${container_user}:${container_user} ${work_dir};
+COPY --chown=${container_user}:${container_user} --chmod=755 ./entrypoint.sh ${work_dir}/entrypoint.sh
+COPY --chown=${container_user}:${container_user} --chmod=644 ./src/main/resources/ ${work_dir}/resources/
+COPY --chown=${container_user}:${container_user} --chmod=644 ./target/*.jar ${work_dir}

(Note: Assumes Docker BuildKit is enabled; adjust as needed for your build environment.)

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1baf7a2 and 86dcfdd.

📒 Files selected for processing (1)
  • uitest-admin/Dockerfile (1 hunks)
🔇 Additional comments (1)
uitest-admin/Dockerfile (1)

52-59: User/entrypoint setup is correct.

The non-root user switching and entrypoint configuration are properly formatted for Alpine/Linux containers. Once the base image is updated to Debian (to resolve the critical chromium-driver issue), these lines will continue to work as intended.


Summary

The Dockerfile introduces critical incompatibilities with the Alpine base image that must be resolved before merge. The previous review identified this blocker, and it remains unaddressed in the current code:

  • Alpine does not provide chromium-chromedriver as a separate package, breaking WebDriver-dependent UI tests.
  • Package management mismatch: the file uses apk commands (Alpine), but references were made to apt-get concepts from prior context.

Action required: Switch to eclipse-temurin:21-jre-jammy (or similar Debian-based variant) and adapt the package installation to use apt-get with Debian package names. This is a prerequisite for the reporting/testing enhancements mentioned in the PR objectives.

Secondary optimization available: consolidate redundant COPY and permission-fixing commands.

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 4

♻️ Duplicate comments (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)

144-149: Incorrect fallback in enter() - JavaScript click instead of setValue.

The generic exception handler uses executor.executeScript("arguments[0].click();", ...) which clicks the element instead of entering text. This leaves the field empty on failure.

Apply this diff to fix:

 		} catch (Exception e) {
 			Reporter.log("<p><img src='data:image/png;base64," + Screenshot.ClickScreenshot(driver)
 					+ "' width='900' height='450'/></p>");
+			logger.error("Enter failed: " + e.getMessage());
 			JavascriptExecutor executor = (JavascriptExecutor) driver;
-			executor.executeScript("arguments[0].click();", driver.findElement(by));
+			executor.executeScript("arguments[0].value = arguments[1];", driver.findElement(by), value);
 		}
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (2)

257-264: Fix SLF4J logging format strings - placeholders not replaced.

Lines 258, 260, and 263 use "... {} " + variable which concatenates instead of passing as parameter. The {} placeholder won't be replaced.

 			if (isStoreSuccess) {
-				LOGGER.info("Admin Extent report successfully pushed to S3/MinIO: {} " + reportFile.getName());
+				LOGGER.info("Admin Extent report successfully pushed to S3/MinIO: {}", reportFile.getName());
 			} else {
-				LOGGER.error("Failed to push Admin Extent report to S3/MinIO: { } " + reportFile.getName());
+				LOGGER.error("Failed to push Admin Extent report to S3/MinIO: {}", reportFile.getName());
 			}
 		} catch (Exception e) {
-			LOGGER.error("Exception while pushing Admin Extent report to S3/MinIO: {} " + e.getMessage());
+			LOGGER.error("Exception while pushing Admin Extent report to S3/MinIO", e);
 		}

102-105: Restore interrupt status when catching InterruptedException.

The InterruptedException is caught but neither logged nor used to restore the thread's interrupt status.

 			try {
 				exit = process.waitFor();
 			} catch (InterruptedException ie) {
+				Thread.currentThread().interrupt();
+				LOGGER.warn("Interrupted while waiting for git command", ie);
 			}
🧹 Nitpick comments (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java (1)

29-34: Consider using if-else-if or switch for mutually exclusive conditions.

The three if statements are mutually exclusive based on count value. Using if-else-if or a switch would be clearer and slightly more efficient.

-			if (count == 0)
-				Commons.dropdown(driver(), By.id("operation"), By.id("Insert"), "Selected Insert operation");
-			if (count == 1)
-				Commons.dropdown(driver(), By.id("operation"), By.id("Update"), "Selected Update operation");
-			if (count == 2)
-				Commons.dropdown(driver(), By.id("operation"), By.id("Delete"), "Selected Delete operation");
+			switch (count) {
+				case 0:
+					Commons.dropdown(driver(), By.id("operation"), By.id("Insert"), "Selected Insert operation");
+					break;
+				case 1:
+					Commons.dropdown(driver(), By.id("operation"), By.id("Update"), "Selected Update operation");
+					break;
+				case 2:
+					Commons.dropdown(driver(), By.id("operation"), By.id("Delete"), "Selected Delete operation");
+					break;
+			}
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (2)

77-83: Exception handler fallback may not recover correctly.

The catch block uses JS click on the filter element by, but the try block performs multiple operations (click Filter, enter data, click Apply). A single JS click won't properly recover the filter workflow.

Consider logging the failure and rethrowing, or implementing a proper retry of the full sequence:

 		} catch (Exception e) {
 			Reporter.log("<p><img src='data:image/png;base64," + Screenshot.ClickScreenshot(driver)
 					+ "' width='900' height='450'/></p>");
-			logger.info(e.getMessage());
-			JavascriptExecutor executor = (JavascriptExecutor) driver;
-			executor.executeScript("arguments[0].click();", driver.findElement(by));
+			logger.error("Filter operation failed: " + e.getMessage());
+			throw new RuntimeException("Filter operation failed", e);
 		}

467-468: Inconsistent click usage - bypasses logging.

The month selection uses direct cli.get(month - 1).click() instead of Commons.click(), so this action won't appear in the ExtentReport. Consider wrapping for consistency.

 			List<WebElement> cli = driver().findElements(By.xpath("//*[@class='mat-calendar-body-cell-content']"));
-			cli.get(month - 1).click();
+			WebElement monthElement = cli.get(month - 1);
+			AdminExtentReportManager.logStep("Selected month at index: " + (month - 1));
+			monthElement.click();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 86dcfdd and 9fa44b4.

📒 Files selected for processing (5)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (6 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (24-526)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)
  • TestRunner (19-204)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Screenshot.java (1)
  • Screenshot (17-33)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)
  • BaseClass (27-175)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)
  • AdminExtentReportManager (24-268)
🔇 Additional comments (8)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java (1)

21-57: Good adoption of descriptive logging pattern.

The test correctly uses the new Commons overloads with descriptive messages for each UI action, enhancing report traceability. The explicit waits before element interactions and screenshot capture are properly implemented.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (2)

36-51: Good implementation of explicit wait utilities.

The wait utilities properly use WebDriverWait with Duration.ofSeconds(20) and ExpectedConditions, replacing hardcoded waits. This addresses the previous review feedback about avoiding hard-coded waits.


408-410: Delegation fix verified.

The createRes(WebDriver) method now correctly delegates to createRes(driver, "Create Resource") instead of create(), addressing the previous review feedback.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1)

44-72: Null guards properly implemented for test status methods.

All three status handlers (onTestSuccess, onTestFailure, onTestSkipped) now include null checks for getTest(), addressing the previous review feedback about potential NPEs.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (2)

92-103: Login steps may not appear in ExtentReport.

The login actions (lines 92-102) execute in @BeforeMethod, which runs before AdminTestListener.onTestStart creates the ExtentTest. Since AdminExtentReportManager.getTest() returns null at this point, these descriptive log calls won't appear in the report.

If login step visibility in reports is important, consider creating the test entry early in setUp() instead of relying on the listener:

 	public void setUp(Method testMethod) throws Exception {
 		AdminExtentReportManager.initReport();
+		
+		// Create test entry early so login steps are logged
+		String className = this.getClass().getSimpleName();
+		String methodName = testMethod.getName();
+		String lang = "unknown";
+		try { lang = ConfigManager.getloginlang(); } catch (Exception ignored) {}
+		String testName = className + " | " + methodName + " | Language: " + lang;
+		AdminExtentReportManager.createTest(testName);
+
 		Reporter.log("BaseClass setup started", true);

Note: This would require updating AdminTestListener.onTestStart to check if a test already exists.


106-131: Well-structured tearDown with proper resource cleanup.

The tearDown method correctly:

  • Captures failure screenshots with proper null checks
  • Uses try-finally to ensure driver quit and ThreadLocal cleanup
  • Handles exceptions gracefully during screenshot capture
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (2)

40-76: Well-designed report initialization and thread-safe test management.

The report manager correctly:

  • Uses lazy initialization with double-checked locking for initReport()
  • Manages per-thread ExtentTest instances via ThreadLocal
  • Includes defensive guards throughout

182-230: Good logging utilities with proper null safety.

The logging methods (logStep, logStepWithLocator, logLocator, attachScreenshotFromBase64) include appropriate null checks for both the test context and input parameters, with fallback warnings when no test is active.

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 1

♻️ Duplicate comments (4)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1)

83-111: Duplicate S3 upload persists.

As noted in a previous review, flushReport() at line 86 internally pushes the report to S3, and then pushReportToS3(newReportName) at line 110 uploads again. This results in the report being uploaded twice (once with the original name from flushReport, once with the renamed file).

Consider modifying flushReport() to only flush without S3 push, or skip the explicit pushReportToS3 call here if flushReport() already handles it.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (3)

97-112: Swallowed InterruptedException in runCommand loses interrupt signal.

InterruptedException is caught and ignored, so the thread’s interrupt status is cleared and callers cannot detect it. Best practice is to restore the interrupt flag and optionally log the interruption.

Suggested change:

 	private static String runCommand(String... command) throws IOException {
 		Process process = new ProcessBuilder(command).redirectErrorStream(true).start();
 		try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
 
 			String line = reader.readLine();
 			int exit = 0;
 			try {
 				exit = process.waitFor();
 			} catch (InterruptedException ie) {
-			}
+				Thread.currentThread().interrupt();
+				LOGGER.warn("Interrupted while waiting for command: {}", String.join(" ", command), ie);
+			}
 			if (exit == 0 && line != null) {
 				return line.trim();
 			}
 		}

241-252: Avoid S3 upload from flushReport() to prevent duplicate uploads.

flushReport() currently both flushes the Extent report and calls pushReportToS3(reportPath). Based on the surrounding changes (AdminTestListener and EmailableReport), S3 upload is also triggered from the listener after the report is renamed, which can lead to duplicate uploads (and possibly different filenames in storage).

Consider letting the listener own the upload step and keep flushReport() focused on flushing only:

 	public static synchronized void flushReport() {
 		if (extent != null) {
 			extent.flush();
 			LOGGER.info("Extent report flushed successfully.");
-
-			try {
-				pushReportToS3(reportPath);
-			} catch (Exception e) {
-				LOGGER.error("Error while uploading report: ", e);
-			}
 		}
 	}

Please double-check how flushReport() and pushReportToS3() are invoked from AdminTestListener to ensure there is exactly one upload per final report file.


258-273: Fix SLF4J placeholder usage and log full exception in S3 upload.

The log statements concatenate values into the message while also using {} placeholders, so the placeholders are never populated. The exception log also only prints e.getMessage() instead of the stack trace.

Refactor to use proper SLF4J parameterized logging and include the exception:

 	public static synchronized void pushReportToS3(String reportFilePath) {
 		if (ConfigManager.getPushReportsToS3().equalsIgnoreCase("yes")) {
 			S3Adapter s3Adapter = new S3Adapter();
 			File reportFile = new File(reportFilePath);
 			boolean isStoreSuccess = false;
 			try {
 				isStoreSuccess = s3Adapter.putObject(ConfigManager.getS3Account(), "Adminui", null, null,
 						reportFile.getName(), reportFile);
 				if (isStoreSuccess) {
-					LOGGER.info("Admin Extent report successfully pushed to S3/MinIO: {} " + reportFile.getName());
+					LOGGER.info("Admin Extent report successfully pushed to S3/MinIO: {}",
+							reportFile.getName());
 				} else {
-					LOGGER.error("Failed to push Admin Extent report to S3/MinIO: { } " + reportFile.getName());
+					LOGGER.error("Failed to push Admin Extent report to S3/MinIO: {}",
+							reportFile.getName());
 				}
 			} catch (Exception e) {
-				LOGGER.error("Exception while pushing Admin Extent report to S3/MinIO: {} " + e.getMessage());
+				LOGGER.error("Exception while pushing Admin Extent report to S3/MinIO for file {}",
+						reportFile.getName(), e);
 			}
 		}
 	}
🧹 Nitpick comments (5)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)

57-61: Consider adding KnownIssueListener to the programmatic suite.

When tests are specified via ConfigManager.gettestcases(), only AdminTestListener is added to the suite (line 61). However, KnownIssueListener is only added in the else branch (line 153) for the testng.xml-based execution path. This inconsistency means known issues won't be skipped when running specific test cases programmatically.

 			suite.addListener("io.mosip.testrig.adminui.utility.EmailableReport");
 			suite.addListener("io.mosip.testrig.adminui.utility.AdminTestListener");
+			suite.addListener("io.mosip.testrig.adminui.utility.KnownIssueListener");
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1)

12-18: Remove unused imports.

The following imports are not used in this class: OutputType, TakesScreenshot, WebDriver, and BaseClass.

-import org.openqa.selenium.OutputType;
-import org.openqa.selenium.TakesScreenshot;
-import org.openqa.selenium.WebDriver;
-
-import io.mosip.testrig.adminui.utility.BaseClass;
 import io.mosip.testrig.adminui.kernel.util.ConfigManager;
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (2)

110-113: Remove unnecessary delete() after renameTo().

The renameTo() method moves the file, so the original file no longer exists at the old path. The delete() call on line 112 is redundant and will likely return false since the file has already been moved.

 		if (orignialReportFile.exists()) {
 			if (orignialReportFile.renameTo(newReportFile)) {
-				orignialReportFile.delete();
 				logger.info("Report File re-named successfully!");

117-129: Remove dead code: isStoreSuccess2 is always true.

The variable isStoreSuccess2 is initialized to true and never modified, making the condition isStoreSuccess && isStoreSuccess2 equivalent to just isStoreSuccess. The comment suggests this was placeholder code for a second upload that was never implemented.

 					boolean isStoreSuccess = false;
-					boolean isStoreSuccess2 = true; // or remove this flag until a second upload is added
 					try {
 						isStoreSuccess = s3Adapter.putObject(ConfigManager.getS3Account(), "Adminui", null, null,
 								newString, newReportFile);
 						logger.info("isStoreSuccess:: " + isStoreSuccess);
-
-						/* Need to figure how to handle EXTENT report handling */
-
 					} catch (Exception e) {
 						logger.error("error occured while pushing the object" + e.getMessage());
 					}
-					if (isStoreSuccess && isStoreSuccess2) {
+					if (isStoreSuccess) {
 						logger.info("Pushed report to S3");
 					} else {
 						logger.error("Failed while pushing file to S3");
 					}
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)

35-38: Counter visibility could be made fully thread-safe (optional).

passedCount, failedCount, skippedCount, and knownIssueCount are incremented in synchronized methods but read in unsynchronized getters. In practice this is unlikely to hurt here, but readers could see slightly stale values under concurrent access.

If you want fully consistent visibility with minimal change, either:

  • Mark the counters volatile, or
  • Make the getters synchronized as well.

Given the test-runner context this is a minor/optional refinement.

Also applies to: 155-189

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d5e740 and 9f02e93.

📒 Files selected for processing (7)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (13 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/KnownIssueListener.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (7 hunks)
  • uitest-admin/src/main/resources/config/Known_Issues.txt (1 hunks)
  • uitest-admin/src/main/resources/testngFile/testng.xml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • uitest-admin/src/main/resources/config/Known_Issues.txt
🧰 Additional context used
🧬 Code graph analysis (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)
  • BaseClass (27-175)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)
  • AdminExtentReportManager (24-277)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java (1)
  • BaseTestCaseFunc (30-230)
🔇 Additional comments (6)
uitest-admin/src/main/resources/testngFile/testng.xml (1)

28-32: LGTM! Listener order is appropriate.

The listener registration order is correct: KnownIssueListener (IInvokedMethodListener) intercepts before test execution to skip known issues, AdminTestListener (ITestListener) manages the reporting lifecycle, and EmailableReport (IReporter) generates the final HTML report.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)

38-48: LGTM! Known issues loading is well-implemented.

The try-with-resources ensures proper resource cleanup, empty lines are correctly filtered, and the graceful fallback on missing/unreadable file is appropriate for an optional feature.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1)

44-81: LGTM! Null guards properly implemented.

The null checks for ExtentTest in onTestSuccess, onTestFailure, and onTestSkipped prevent NPEs if createTest wasn't invoked. The known issue detection in onTestSkipped correctly integrates with TestRunner.knownIssues.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/KnownIssueListener.java (1)

9-27: LGTM! Clean implementation of known issue skipping.

The listener correctly intercepts test methods before invocation, checks against the known issues list, and uses SkipException which is the standard TestNG mechanism for skipping tests. The guard at line 14 ensures only test methods are evaluated.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (2)

639-648: LGTM! Known issue filtering is correctly implemented.

The getKnownIssueSubset method properly filters test results based on TestRunner.knownIssues and returns an immutable set via Set.copyOf().


685-706: LGTM! TestResult properly separates known issues from skipped tests.

The logic correctly extracts known issues from the raw skipped set, removes them to create finalSkipped, and maintains separate counts and result lists. This ensures accurate categorization in the report.

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

♻️ Duplicate comments (1)
uitest-admin/Dockerfile (1)

2-2: Alpine migration attempted but core package availability concern unresolved—verify or revert to Debian.

You've addressed the package manager by switching to apk, but the previous critical review flagged that chromium-driver is not available as a separate package in Alpine Linux. While Alpine's naming convention uses chromium-chromedriver, this package must be verified to exist and provide WebDriver capabilities for Selenium UI testing. Without confirmation, the build will fail at runtime.

Recommendation: Before proceeding, verify that chromium-chromedriver is available in Alpine repositories and compatible with your Selenium version. If verification fails, revert to a Debian-based image (e.g., eclipse-temurin:21-jre-jammy) to ensure compatibility with the broader ecosystem.

Alpine Linux chromium-chromedriver package availability and Selenium WebDriver support

Also applies to: 28-29

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f02e93 and d7757bf.

📒 Files selected for processing (1)
  • uitest-admin/Dockerfile (1 hunks)

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 2

🧹 Nitpick comments (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (3)

31-31: Consider making the knownIssues list unmodifiable after initialization.

The knownIssues list is exposed as a public static mutable field, which allows external code to modify it. Since this list is populated once during initialization and should remain constant throughout test execution, consider wrapping it with Collections.unmodifiableList() after loading the known issues.

Apply this pattern in the main method after loading (around line 48):

 		}
 		logger.info("Known Issues Loaded: " + knownIssues);
+		knownIssues = Collections.unmodifiableList(knownIssues);
 	} catch (Exception e) {

Don't forget to add the import:

import java.util.Collections;

81-124: Consider using else-if for mutually exclusive test selection.

The current implementation uses independent if statements, which checks all conditions even after a match is found. Since test names should be unique, using else if would be more efficient and convey the mutual exclusivity more clearly.

Apply this pattern:

-		if (test.equals("blocklistedwordsCRUD"))
+		if (test.equals("blocklistedwordsCRUD"))
 			classes.add(blocklistedwordsCRUD);
-
-		if (test.equals("bulkUploadCRUD"))
+		else if (test.equals("bulkUploadCRUD"))
 			classes.add(bulkUploadCRUD);
-
-		if (test.equals("centerCRUD"))
+		else if (test.equals("centerCRUD"))
 			classes.add(centerCRUD);
 		// ... continue for all test cases

Alternatively, consider using a Map<String, XmlClass> for cleaner lookup:

Map<String, XmlClass> testMap = new HashMap<>();
testMap.put("blocklistedwordsCRUD", blocklistedwordsCRUD);
testMap.put("bulkUploadCRUD", bulkUploadCRUD);
// ... add all mappings

for (String test : Scenarioname) {
	XmlClass testClass = testMap.get(test);
	if (testClass != null) {
		classes.add(testClass);
	}
}

203-213: Method naming convention and spelling (optional improvement).

The method name GetKernalFilename has two minor issues:

  1. Capital 'G' violates Java naming conventions (should be getKernelFilename)
  2. "Kernal" is misspelled (should be "Kernel")

Since this method is referenced externally (e.g., in BaseTestCaseFunc), renaming would require updates across the codebase.

The logic could also be simplified:

-public static String GetKernalFilename() {
-	String path = System.getProperty("env.user");
-	String kernalpath = null;
-	if (System.getProperty("env.user") == null || System.getProperty("env.user").equals("")) {
-		kernalpath = "Kernel.properties";
-
-	} else {
-		kernalpath = "Kernel_" + path + ".properties";
-	}
-	return kernalpath;
+public static String getKernelFilename() {
+	String envUser = System.getProperty("env.user");
+	if (envUser == null || envUser.isEmpty()) {
+		return "Kernel.properties";
+	}
+	return "Kernel_" + envUser + ".properties";
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7757bf and b07fa39.

📒 Files selected for processing (2)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (7 hunks)
  • uitest-admin/src/main/resources/config/Known_Issues.txt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • uitest-admin/src/main/resources/config/Known_Issues.txt
🧰 Additional context used
🧬 Code graph analysis (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java (1)
  • BaseTestCaseFunc (30-230)
🔇 Additional comments (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)

4-5: LGTM!

The imports are necessary for loading the Known Issues file and are used correctly.

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)

186-198: getResourcePath() IDE path should handle missing path.config (and provide a safe fallback).
If path.config is unset, user.dir + null yields a bad path and downstream file loads (Known_Issues, testngFile, etc.) will fail.

  } else if (checkRunType().equalsIgnoreCase("IDE")) {
-   String path = System.getProperty("user.dir") + System.getProperty("path.config");
+   String pathConfig = System.getProperty("path.config");
+   if (pathConfig == null || pathConfig.trim().isEmpty()) {
+     // fallback to classpath-based location (previous behavior)
+     path = new File(TestRunner.class.getClassLoader().getResource("").getPath()).getAbsolutePath();
+   } else {
+     path = System.getProperty("user.dir") + pathConfig;
+   }
    if (path.contains("test-classes"))
      path = path.replace("test-classes", "classes");
    return path;
  }
♻️ Duplicate comments (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)

143-160: Listener registration still differs between execution paths.
In the IDE/file-based path you only do runner.addListener(new KnownIssueListener()), while the ConfigManager path adds AdminTestListener + EmailableReport too. If the testngFile/*.xml suites don’t declare those listeners, reporting behavior will diverge.

#!/bin/bash
set -euo pipefail

# 1) Do testng suite XMLs already include listeners?
echo "Searching for listener declarations in suite XMLs..."
fd -t d 'testngFile' . -0 | while IFS= read -r -d '' d; do
  echo "== dir: $d"
  fd -e xml . "$d" -0 | xargs -0 rg -n --no-heading 'listener|KnownIssueListener|AdminTestListener|EmailableReport' || true
done

# 2) Confirm only one programmatic listener is added in IDE path
echo
echo "Programmatic listener registrations:"
rg -n --no-heading 'addListener\(' uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java
🧹 Nitpick comments (4)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (4)

29-36: Make knownIssues initialization resilient + avoid exposing a mutable public list.
Right now knownIssues is loaded only in main(...); any other entrypoint calling startTestRunner() will skip loading. Also, public static List<String> knownIssues is globally mutable.

Consider: move loading into startTestRunner() (idempotent), make the field final, and expose via an unmodifiable view / getter.

- public static List<String> knownIssues = new ArrayList<>();
+ public static final List<String> knownIssues = new ArrayList<>();

  public static void startTestRunner() throws Exception {
+   loadKnownIssuesOnce();
    File homeDir = null;
    TestNG runner = new TestNG();
    ...
  }

+ private static volatile boolean knownIssuesLoaded = false;
+ private static void loadKnownIssuesOnce() {
+   if (knownIssuesLoaded) return;
+   knownIssuesLoaded = true;
+   try (BufferedReader br = new BufferedReader(new InputStreamReader(
+       new FileInputStream(getResourcePath() + "/config/Known_Issues.txt"), StandardCharsets.UTF_8))) {
+     String line;
+     while ((line = br.readLine()) != null) {
+       if (!line.trim().isEmpty()) knownIssues.add(line.trim());
+     }
+     logger.info("Known Issues Loaded: " + knownIssues);
+   } catch (Exception e) {
+     logger.warn("Known_Issues.txt not found or unreadable: " + e.getMessage());
+   }
+ }

Also applies to: 42-53


85-132: Avoid the long if chain for scenario → XmlClass selection.
This is easy to drift/typo and hard to extend. A simple map (plus a warning for unknown scenario tokens) is lower-maintenance.

- String[] Scenarioname = ConfigManager.gettestcases().split(",");
- for (String test : Scenarioname) {
-   if (test.equals("blocklistedwordsCRUD")) classes.add(blocklistedwordsCRUD);
-   if (test.equals("bulkUploadCRUD")) classes.add(bulkUploadCRUD);
-   ...
- }
+ Map<String, XmlClass> scenarioToClass = new HashMap<>();
+ scenarioToClass.put("blocklistedwordsCRUD", blocklistedwordsCRUD);
+ scenarioToClass.put("bulkUploadCRUD", bulkUploadCRUD);
+ ...
+ for (String token : ConfigManager.gettestcases().split(",")) {
+   XmlClass clazz = scenarioToClass.get(token.trim());
+   if (clazz != null) classes.add(clazz);
+   else logger.warn("Unknown testcase token: " + token);
+ }

164-168: Be cautious with global System.getProperties().setProperty(...) for run-specific settings.
These are JVM-global and can leak across runs (especially if you ever execute multiple suites in one JVM). If TestNG supports setting these via its APIs (or suite params) in your version, prefer that; otherwise, at least keep these mutations tightly scoped/consistent.


209-219: Fix naming/typos and simplify null/blank handling in GetKernalFilename().
Kernal/kernalpath is likely meant to be Kernel/kernelPath, and you can rely on the already-read path variable.

- public static String GetKernalFilename() {
-   String path = System.getProperty("env.user");
-   String kernalpath = null;
-   if (System.getProperty("env.user") == null || System.getProperty("env.user").equals("")) {
-     kernalpath = "Kernel.properties";
-   } else {
-     kernalpath = "Kernel_" + path + ".properties";
-   }
-   return kernalpath;
- }
+ public static String getKernelFilename() {
+   String envUser = System.getProperty("env.user");
+   if (envUser == null || envUser.trim().isEmpty()) return "Kernel.properties";
+   return "Kernel_" + envUser.trim() + ".properties";
+ }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b07fa39 and cbdf154.

📒 Files selected for processing (1)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (7 hunks)
🔇 Additional comments (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)

62-83: Listener wiring in the ConfigManager path looks good.
Registering EmailableReport, AdminTestListener, and KnownIssueListener at the suite level matches the PR’s reporting goals.

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 1

🧹 Nitpick comments (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (1)

95-138: Use outputDirectory consistently for rename and logging instead of testng.output.dir

The rename + logging block mixes outputDirectory with System.getProperty("testng.output.dir") and user.dir. This is brittle if the system property is unset or diverges from the outputDirectory passed by TestNG; you can end up logging/renaming paths that don’t match where the report was actually written.

You already have outputDirectory from TestNG, so you can simplify and harden the logic by using it for both the original and renamed files and logging via getAbsolutePath():

-       String reportDir = outputDirectory; // or System.getProperty("testng.output.dir")
-       File orignialReportFile = new File(reportDir, oldString);
-       logger.info("reportFile is::" + System.getProperty("user.dir") + "/" + System.getProperty("testng.output.dir")
-               + "/" + System.getProperty("emailable.report2.name"));
-
-       File newReportFile = new File(
-               System.getProperty("user.dir") + "/" + System.getProperty("testng.output.dir") + "/" + newString);
-       logger.info("New reportFile is::" + System.getProperty("user.dir") + "/"
-               + System.getProperty("testng.output.dir") + "/" + newString);
-
-       if (orignialReportFile.exists()) {
-           if (orignialReportFile.renameTo(newReportFile)) {
-               orignialReportFile.delete();
+       File originalReportFile = new File(outputDirectory, oldString);
+       File newReportFile = new File(outputDirectory, newString);
+
+       logger.info("reportFile is::" + originalReportFile.getAbsolutePath());
+       logger.info("New reportFile is::" + newReportFile.getAbsolutePath());
+
+       if (originalReportFile.exists()) {
+           if (originalReportFile.renameTo(newReportFile)) {
+               originalReportFile.delete();

This keeps the filesystem operations aligned with how the report is created and avoids dependence on an external system property.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbdf154 and e64dd75.

📒 Files selected for processing (1)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (13 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)
  • TestRunner (24-221)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
🔇 Additional comments (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (2)

189-205: Known-issues column and styling integration look consistent

The additions for known-issues styling (.known_issuesodd/even, orange backgrounds, etc.) and the new “# Known Issues” column in the suite summary and scenario summaries are wired consistently:

  • The CSS class naming pattern (known_issues + odd/even) matches the cssClassPrefix usage in writeScenarioSummary.
  • Per-test known-issues counts are pulled via testResult.getKnownIssueTestCount() and rendered with an appropriate attention color.
  • Scenario-level known-issue rows reuse the same summary machinery as other statuses.

No functional issues spotted here; the integration looks clean and consistent with existing patterns.

Also applies to: 261-263, 285-287, 361-363, 424-427


639-648: Known-issue partitioning from skipped tests is correct; just ensure name matching strategy is intentional

The new logic to classify known-issue results is sound:

  • getKnownIssueSubset filters the skipped-set based on TestRunner.knownIssues.contains(r.getName()).
  • You then create finalSkipped as a mutable copy of rawSkipped and removeAll(knownIssueTests), so known issues are excluded from standard skipped metrics.
  • skippedTestResults / skippedTestCount are based on finalSkipped, and known issues get their own knownIssueTestResults / knownIssueTestCount and dedicated summary sections.

One thing to double-check is the identifier you use for matching:

if (TestRunner.knownIssues.contains(r.getName())) {
    filtered.add(r);
}

ITestResult.getName() is typically the test method name. If your Known_Issues.txt entries (and any other consumers of TestRunner.knownIssues) are using a different format (e.g., ClassName#methodName or groups), this may not match as expected and known issues will stay classified as regular skipped tests.

If the intent is to key by pure method name, this is fine; otherwise, consider aligning the match key (e.g., including class, parameters, or groups) across KnownIssueListener and this helper.

Also applies to: 685-707, 808-815

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 2

♻️ Duplicate comments (4)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (1)

262-288: Known-issues column in suite summary is wired correctly

The new # Known Issues header (Line [262]) and per-test calculation using getKnownIssueTestCount() (Lines [286–288]) are aligned with the known-issue tracking in TestResult. The conditional CSS class "num thich-orange-bg" will highlight suites that have any known issues.

One thing to be aware of: the totals row (Lines [310–317]) still doesn’t aggregate known issues, so the last column only totals duration, not KIs. If you later decide to surface an overall “Total Known Issues” count in the table, you’ll need to extend that row as well.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (3)

241-246: flushReport() correctly avoids duplicate S3 uploads

flushReport() (Lines [241–246]) now only calls extent.flush() and logs success, with no S3 upload side‑effects. This avoids the duplicate upload issue that can arise if a separate listener (e.g., AdminTestListener) handles pushing the renamed report to S3/MinIO at the end of the run.

This separation of concerns is a good improvement.


97-112: Handle InterruptedException in runCommand instead of silently swallowing it

In runCommand(...) (Lines [97–112]), InterruptedException is caught and ignored (Lines [103–106]):

  • This clears the thread’s interrupted status and hides the fact that the git command was interrupted.
  • In long‑running test runners, this can make cooperative shutdown or cancellation harder to reason about.

A minimal improvement is to restore the interrupt flag and log the interruption:

-        int exit = 0;
-        try {
-            exit = process.waitFor();
-        } catch (InterruptedException ie) {
-        }
+        int exit = 0;
+        try {
+            exit = process.waitFor();
+        } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
+            LOGGER.warn("Interrupted while waiting for git command", ie);
+        }

This keeps existing behavior for successful commands while preserving the interrupt signal for callers.

What is the recommended best practice in Java for handling InterruptedException when blocking on Process.waitFor() if the method cannot rethrow it?

252-269: Fix SLF4J placeholder usage and harden S3 push against null flags

The S3 upload logic is generally fine, but there are a couple of issues:

  • SLF4J formatting:
    • Lines [261–267] concatenate the file name or exception message onto the format string, so the {} placeholders are never used. The logs will literally contain {} instead of substituting arguments.
  • Null‑safety on the flag:
    • Line [253] calls ConfigManager.getPushReportsToS3().equalsIgnoreCase("yes"); if the config returns null, this will NullPointerException.

You can address both with a small refactor:

-    public static synchronized void pushReportToS3(String reportFilePath) {
-        if (ConfigManager.getPushReportsToS3().equalsIgnoreCase("yes")) {
+    public static synchronized void pushReportToS3(String reportFilePath) {
+        if ("yes".equalsIgnoreCase(ConfigManager.getPushReportsToS3())) {
             S3Adapter s3Adapter = new S3Adapter();
             File reportFile = new File(reportFilePath);
             boolean isStoreSuccess = false;
             try {
                 isStoreSuccess = s3Adapter.putObject(ConfigManager.getS3Account(), "Adminui", null, null,
                         reportFile.getName(), reportFile);
                 if (isStoreSuccess) {
-                    LOGGER.info("Admin Extent report successfully pushed to S3/MinIO: {} " + reportFile.getName());
+                    LOGGER.info("Admin Extent report successfully pushed to S3/MinIO: {}", reportFile.getName());
                 } else {
-                    LOGGER.error("Failed to push Admin Extent report to S3/MinIO: { } " + reportFile.getName());
+                    LOGGER.error("Failed to push Admin Extent report to S3/MinIO: {}", reportFile.getName());
                 }
             } catch (Exception e) {
-                LOGGER.error("Exception while pushing Admin Extent report to S3/MinIO: {} " + e.getMessage());
+                LOGGER.error("Exception while pushing Admin Extent report to S3/MinIO", e);
             }
         }
     }

This restores proper parameterized logging, ensures the push flag can be safely absent, and logs the full exception instead of just the message.

In SLF4J, what is the correct way to use `{}` placeholders when logging variables, and is it recommended to pass exceptions as a separate argument to capture the full stack trace?
🧹 Nitpick comments (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (1)

190-205: CSS additions for status rows look fine; consider removing duplication and tidying class names

The new CSS classes for passed/skipped/failed/ignored/known-issue rows and the specific background colors are coherent and match the cssClassPrefix values used in writeScenarioSummary().

Minor cleanups you may want to defer:

  • .stripe td {background-color: #E6EBF9} is now printed twice (Lines [188] and [205]); one of them can be removed.
  • Class name .thich-orange-bg (Lines [192], [287]) looks like a typo of "thick" — harmless but slightly confusing.

Functionally this is fine as-is.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)

155-189: Counters and total calculation are consistent with known‑issues support

The four counters (passedCount, failedCount, skippedCount, knownIssueCount) and their synchronized incrementers (Lines [155–169]) plus the simple accessors (Lines [171–189]) provide a clear central place to aggregate test outcomes, including known issues.

Just note:

  • These are static and never reset, so they accumulate across the JVM lifetime. If your TestNG suite runs multiple times in the same process, you may want a reset hook (e.g., at the start of a run) to avoid cross‑run leakage.

Otherwise, the arithmetic in getTotalCount() (Line [187]) correctly includes known issues in the overall total.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e64dd75 and bda525b.

📒 Files selected for processing (3)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (13 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java
🔇 Additional comments (4)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (1)

362-363: Scenario summary for known issues and duration formatting looks good

  • Adding the "Scenarios — Known Issues" section (Lines [362–363]) reuses the same class/grouping mechanism as other states and hooks into getKnownIssueTestResults(), which keeps the model consistent.
  • Switching to String.format("%.2f", scenarioDurationMin) for scenario durations (Line [425]) yields a clear, consistent display in minutes without changing semantics.

No functional concerns here.

Also applies to: 425-425

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (3)

24-40: ExtentReports initialization and per‑thread test management look appropriate

The overall structure — a single static ExtentReports instance, report path with timestamp (Line [50]), dark‑theme ExtentSparkReporter, and ThreadLocal<ExtentTest> for per‑test logging (Lines [26–28], [64–69]) — is coherent and matches typical ExtentReports usage in parallel TestNG runs.

  • initReport() is synchronized and idempotent (Lines [41–62]), which prevents duplicate initialization under concurrency.
  • Including git branch/commit and environment in the report name/system info is a nice touch for traceability.

No functional issues spotted in this part.

Also applies to: 41-63


79-95: System info, git metadata, and environment extraction are reasonable and fail‑safe

  • addSystemInfo() (Lines [79–95]) only runs once, logs what it’s adding, and falls back gracefully if ConfigManager.getloginlang() throws.
  • fetchGitDetails() and loadFromGitProperties() (Lines [114–140]) correctly prefer CLI data and fall back to git.properties, with clear logging when CLI fails or properties are missing.
  • safeEnvName() (Lines [142–153]) strips protocol and extracts an env token from the admin portal URL, returning "unknown" only when needed.

These pieces give you good context in the report while failing safely if git/env metadata can’t be resolved.

Also applies to: 114-140, 142-153


191-239: Logging helpers and screenshot attachment are straightforward and safe

The helper methods:

  • logStep(...), logStepWithLocator(...), and logLocator(...) (Lines [191–222]) correctly guard against missing thread‑local tests and provide useful WARN logs in those cases.
  • escapeHtml(...) (Lines [224–228]) ensures locator HTML is safely rendered inside <pre> tags.
  • attachScreenshotFromBase64(...) (Lines [230–239]) only attempts to attach when both the current test and base64 string are non‑null and logs (without failing the test) if media attachment throws.

These utilities are well‑scoped and should make test code cleaner without introducing runtime risk.

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 0

♻️ Duplicate comments (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (1)

634-643: Add null-safety guard around TestRunner.knownIssues to prevent NPE.

Line 638 directly accesses TestRunner.knownIssues.contains(...) without checking for null. If TestRunner.knownIssues is ever uninitialized, the report generation will fail with a NullPointerException. This issue was flagged in a previous review but remains unaddressed.

Apply this diff to add a null-safe guard:

     private static Set<ITestResult> getKnownIssueSubset(Set<ITestResult> resultsSet) {
         List<ITestResult> filtered = new ArrayList<>();
-
-        for (ITestResult r : resultsSet) {
-            if (TestRunner.knownIssues.contains(r.getName())) {
-                filtered.add(r);
+        
+        if (TestRunner.knownIssues != null && !TestRunner.knownIssues.isEmpty()) {
+            for (ITestResult r : resultsSet) {
+                if (TestRunner.knownIssues.contains(r.getName())) {
+                    filtered.add(r);
+                }
             }
         }
         return Set.copyOf(filtered);

Based on past review comments, this ensures behavior is unchanged when knownIssues is populated but avoids hard failure if configuration is missing.

🧹 Nitpick comments (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (1)

106-109: Remove redundant delete() call after successful renameTo().

renameTo() moves the file atomically; if it succeeds (line 107 returns true), orignialReportFile no longer exists, so line 108's delete() is a no-op. This is harmless but confusing.

Apply this diff to remove the redundant delete:

             if (orignialReportFile.renameTo(newReportFile)) {
-                orignialReportFile.delete();
                 logger.info("Report File re-named successfully!");
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bda525b and 32cb50d.

📒 Files selected for processing (1)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (13 hunks)
🔇 Additional comments (6)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (6)

685-701: Known-issue separation logic is correct; ensure null-safety fix is applied.

The logic properly separates known issues from skipped tests:

  • Line 687 extracts known issues from raw skipped results
  • Lines 688-689 remove known issues from the skipped set
  • Lines 694, 698 use the cleaned finalSkipped for skipped test results and counts
  • Lines 700-701 track known issues separately

This ensures known issues are not double-counted as regular skipped tests. However, line 687 inherits the null-safety issue from getKnownIssueSubset (see separate comment on lines 634-643).


803-809: LGTM: Clean API for known-issue data.

The new public getters expose known-issue results and counts following standard Java Bean conventions, providing a clean interface for callers to access the enhanced reporting data.


71-92: LGTM: Report generation flow correctly resets and accumulates known issues.

Line 72 properly resets totalKnownIssues at the start of each report generation, addressing the prior review concern about stale accumulation across multiple runs. The try-catch wrapper (lines 73-78) with early return prevents NPE if writer creation fails. Known-issue totals are correctly summed after the report is written (lines 88-92).


94-104: LGTM: Consistent path handling and correct total calculation.

Line 94 correctly includes known issues in the total test case count (known issues are not double-counted because they're removed from skipped in the TestResult constructor). Lines 101-104 use outputDirectory consistently for both original and renamed file paths, addressing the prior review concern about path divergence.


111-129: LGTM: S3 upload logic is clean and properly guarded.

The S3 upload flow is config-driven (line 111) and properly wrapped in try-catch (lines 114-123). Line 113 correctly uses only isStoreSuccess (the unused isStoreSuccess2 flag from the prior review has been removed), and error handling logs both success and failure cases appropriately.


184-199: LGTM: UI enhancements cohesively integrate known-issue tracking.

The CSS styling (lines 184-199), suite summary column header (line 256), known-issue count display (lines 280-282), and scenario summary section (lines 356-357) all work together to present known-issue data consistently throughout the HTML report.

Also applies to: 256-256, 280-282, 356-357

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
uitest-admin/pom.xml (1)

32-42: Critical: Duplicate testng.version property definition.

The testng.version property is defined twice with conflicting values:

  • Line 32: 7.10.1
  • Line 42: 6.11

Maven will use the last definition (6.11), which is problematic because:

  • TestNG 6.11 is from 2017 and extremely outdated
  • TestNG 6.11 is incompatible with Java 21 (specified as compiler target)
  • TestNG 6.11 likely has compatibility issues with ExtentReports 5.1.2
  • Missing critical bug fixes and security patches
🔎 Proposed fix
 	<properties>
 		<guava.version>31.1-jre</guava.version>
 		<testng.version>7.10.1</testng.version>
 		<!-- automationtests version -->
 		<wink-json4j-provider.version>1.1.2-incubating</wink-json4j-provider.version>
 		<kernel.version>1.2.0.1</kernel.version>
 		<zjsonpatch.version>0.4.7</zjsonpatch.version>
 		<extentreports.aventstack.version>3.0.0</extentreports.aventstack.version>
 		<extentreports.relevantcodes.version>2.41.2</extentreports.relevantcodes.version>
 		<json-path.version>2.4.0</json-path.version>
 		<maven.model.version>3.3.9</maven.model.version>
 		<rest.assured.version>3.0.7</rest.assured.version>
-		<testng.version>6.11</testng.version>
 		<zt.zip.version>1.13</zt.zip.version>
🧹 Nitpick comments (4)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (1)

184-198: Prefer semantic CSS class names for known issues styling.

The CSS classes for known issues use styling-derived names (thich-orange-bg, orange-bg) rather than semantic names. While functional, semantic names like .known-issue-bg or .known-issue-row would be more maintainable if the color scheme changes.

🔎 Optional refactor for semantic naming
-.thich-orange-bg {background-color: #E6934B}
+.known-issue-header {background-color: #E6934B}
 .green-bg {background-color: #6FD96F}
 .attn {background-color: #FF4C4C}
 .passedodd td {background-color: #6FD96F;}
 .passedeven td {background-color: #6FD96F;}
 .skippedodd td {background-color: #FFE7A6;}
 .skippedeven td {background-color: #FFE7A6;}
 .failedodd td {background-color: #FF4C4C;}
 .failedeven td {background-color: #FF4C4C;}
 .ignoredodd td {background-color: #808080;}
 .ignoredeven td {background-color: #808080;}
 .known_issuesodd td {background-color: #E6934B;}
 .known_issueseven td {background-color: #E6934B;}

Then update line 281 to use the new class name.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)

4-5: Remove unused FileReader import.

The FileReader import at line 5 is unused since the code properly uses FileInputStream with InputStreamReader and UTF-8 charset (lines 44-45).

🔎 Proposed cleanup
 import java.io.BufferedReader;
-import java.io.FileReader;
 import java.util.ArrayList;
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (2)

8-8: Unused import.

BaseTestCaseFunc is imported but not used in this test class.

🔎 Proposed fix
-import io.mosip.testrig.adminui.utility.BaseTestCaseFunc;

43-57: Consider adding test assertions to verify expected outcomes.

The extended CRUD workflow is well-structured with descriptive logging. However, the test lacks explicit assertions to verify that operations succeeded as expected (e.g., machine created, name updated, status changed).

While the current pattern (verification via no exceptions) is common, adding assertions would make test failures more informative and catch subtle issues:

// Example assertions that could be added:
Commons.createRes(driver(), "Created Machine Record");
// Assert.assertTrue(Commons.isElementVisible(driver(), By.xpath("//success message")));

Commons.filter(driver(), By.id("name"), data, "Filtered by Machine Name");
// Assert.assertTrue(Commons.getFilteredResultCount(driver()) > 0);

Commons.activate(driver(), "Activated Machine Record");
// Assert.assertEquals(Commons.getRecordStatus(driver()), "Active");
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 32cb50d and 36917c4.

📒 Files selected for processing (7)
  • uitest-admin/pom.xml (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (13 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/KnownIssueListener.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (7 hunks)
  • uitest-admin/src/main/resources/config/Known_Issues.txt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/KnownIssueListener.java
🧰 Additional context used
🧬 Code graph analysis (4)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)
  • BaseClass (27-175)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (24-526)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminExtentReportManager.java (1)
  • AdminExtentReportManager (24-271)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)
  • TestRunner (26-236)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java (1)
  • AdminTestUtil (34-323)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java (1)
  • BaseTestCaseFunc (30-230)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)
  • TestRunner (26-236)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
🔇 Additional comments (10)
uitest-admin/pom.xml (1)

78-78: The ExtentReports 5.1.2 version upgrade is valid and secure.

Version 5.1.2 is the latest release with bug fixes for tag navigation and ID conversion, and no known security vulnerabilities were identified. This version is compatible with modern TestNG versions, making the upgrade from 5.0.9 safe to proceed.

uitest-admin/src/main/resources/config/Known_Issues.txt (1)

1-3: LGTM! Clear documentation format.

The configuration file provides clear examples and documentation for the known issues format. The delimiter pattern (------) matches the parsing logic in TestRunner.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java (2)

634-643: Known issues separation logic is correct.

The getKnownIssueSubset helper correctly filters skipped tests that match entries in TestRunner.knownIssues. The logic properly separates known issues from regular skipped tests in the TestResult constructor (lines 687-701), ensuring they are not double-counted.

Note: The lack of null check on TestRunner.knownIssues at line 638 was previously raised and the maintainer chose to retain the current implementation for compatibility.


71-136: Report generation flow correctly integrates known issues.

The implementation properly:

  • Resets totalKnownIssues at the start of report generation (line 72)
  • Accumulates known issues in the total count (lines 88-92, 94)
  • Renames the report file to include all metrics including KI (lines 96-116)
  • Uses consistent path handling via outputDirectory (lines 101-104)

The S3 upload logic is clear and handles rename failures gracefully.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (2)

37-68: LGTM! Known issues loading is robust and well-structured.

The implementation correctly:

  • Declares the public static knownIssues map for cross-class access
  • Uses UTF-8 encoding for consistent file reading across platforms (lines 44-45)
  • Validates and filters lines appropriately (empty, comments, missing delimiter)
  • Parses bugId and testCaseName safely with length validation (lines 55-61)
  • Provides clear logging and graceful error handling (lines 64, 66-68)

The format matches the documented structure in Known_Issues.txt and integrates cleanly with both AdminTestListener and EmailableReport.


80-82: LGTM! Listener registration is now consistent across execution paths.

Both the ConfigManager path (lines 81-82) and IDE path (line 174) now properly register the necessary listeners including KnownIssueListener, ensuring known issues are handled uniformly regardless of execution mode.

Also applies to: 174-174

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1)

91-119: The review comment is based on an incorrect premise. The flushReport() method (lines 241-246) only calls extent.flush() to write the HTML file to disk—it does not internally call pushReportToS3(). The two methods are independent, and pushReportToS3() is called explicitly by the caller. Therefore, the report is not uploaded twice; it is flushed to disk with the original name, then uploaded to S3/MinIO with the renamed name as intended.

Likely an incorrect or invalid review comment.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (3)

16-18: LGTM!

Configuration values are properly loaded from ConfigManager using the appropriate getter methods.


28-34: LGTM!

The calendar selection and dropdown interactions are properly implemented with descriptive messages for enhanced reporting.


41-41: LGTM!

Registration center selection is appropriately added to the machine creation workflow.

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 2

🧹 Nitpick comments (4)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (3)

36-36: Consider encapsulating the knownIssues map.

The public mutable static field allows external modification. For test utilities, consider exposing it via a getter or making it unmodifiable after initialization:

private static Map<String, String> knownIssues = new HashMap<>();

public static Map<String, String> getKnownIssues() {
    return Collections.unmodifiableMap(knownIssues);
}

99-145: Consider using a Map for test case lookup.

The repeated if statements could be simplified with a Map-based lookup, improving maintainability when adding new test cases. Additionally, unknown test names are silently ignored, which could mask configuration typos.

🔎 Example refactor
Map<String, XmlClass> testClassMap = Map.ofEntries(
    Map.entry("blocklistedwordsCRUD", blocklistedwordsCRUD),
    Map.entry("bulkUploadCRUD", bulkUploadCRUD),
    // ... other entries
);

for (String test : Scenarioname) {
    XmlClass xmlClass = testClassMap.get(test);
    if (xmlClass != null) {
        classes.add(xmlClass);
    } else {
        logger.warn("Unknown test case: " + test);
    }
}

223-231: Minor: Cache System.getProperty("env.user") to avoid redundant calls.

The method calls System.getProperty("env.user") three times. Consider caching it in a local variable. Also note the method name contains a typo ("Kernal" → "Kernel"), but this appears to be pre-existing and matches ConfigManager.GetKernalFilename().

🔎 Proposed fix
 public static String GetKernalFilename() {
     String path = System.getProperty("env.user");
     String kernalpath = null;
-    if (System.getProperty("env.user") == null || System.getProperty("env.user").equals("")) {
+    if (path == null || path.isEmpty()) {
         kernalpath = "Kernel.properties";
     } else {
         kernalpath = "Kernel_" + path + ".properties";
     }
     return kernalpath;
 }
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (1)

3-3: Consider broader logger usage for test progress tracking.

The logger field is declared but only used once in the catch block. Since this PR focuses on reporting enhancements, consider adding logger statements at key test milestones (e.g., test start, before major sections like creation/edit/deactivation) to provide better traceability in logs independent of the ExtentReport flow.

💡 Example enhancement
 @Test
 public void machineCRUD() throws Exception {
+    logger.info("Starting machineCRUD test");
     String holidayDateCenter = ConfigManager.getholidayDateCenter();
     String publicKey = ConfigManager.getpublicKey();
     String signPublicKey = ConfigManager.getsignPublicKey();
     Commons.click(driver(), By.id("admin/resources"), "Clicked on Resources menu");
     // ... existing code ...
     
     Commons.createRes(driver(), "Created Machine Record");
+    logger.info("Machine created successfully, proceeding to filter and edit");
     
     // ... rest of test ...
+    logger.info("machineCRUD test completed successfully");
 }

Also applies to: 11-11, 37-37

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 36917c4 and d5e5cc1.

📒 Files selected for processing (3)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/AdminTestListener.java
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-19T13:30:35.392Z
Learnt from: BhuvanaShreeBS
Repo: mosip/admin-ui PR: 800
File: uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java:23-26
Timestamp: 2025-12-19T13:30:35.392Z
Learning: In uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java, the MAC address "1.2.3.4.5.6" and IP address "2.3.4.5.6" test values use non-standard formats intentionally to maintain existing behavior and compatibility with the test infrastructure.

Applied to files:

  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java
🧬 Code graph analysis (2)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (3)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java (1)
  • BaseClass (27-175)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/Commons.java (1)
  • Commons (24-526)
🔇 Additional comments (4)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (3)

79-81: LGTM!

Listener registration now consistently includes all three listeners (EmailableReport, AdminTestListener, KnownIssueListener) in the ConfigManager path.


178-181: LGTM!

Fixed the typo in the property name (testng.outpur.dirtestng.output.dir).


173-174: Remove this comment—testng.xml already includes all required listeners.

The testng.xml file includes all three listeners in its <listeners> section (KnownIssueListener, AdminTestListener, EmailableReport), so when the IDE execution path calls runner.setTestSuites(suitefiles), all listeners are active. Both execution paths (ConfigManager and IDE) result in consistent listener registration.

Likely an incorrect or invalid review comment.

uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (1)

30-30: Verify dropdown method overload behavior and test reliability.

The dropdown calls at lines 30, 35, and 40 use a 3-parameter signature (driver, By locator, description), yet the documented Commons.dropdown method expects 4 parameters including a value to select. This indicates an overloaded version exists that auto-selects options.

Verify:

  1. Whether the 3-parameter overload reliably selects the expected option for these dropdowns
  2. What selection strategy is used (first available, random, or another approach)
  3. Test stability if selection behavior differs from expectations in the automation environment

Also applies to: 35-35, 40-40

Signed-off-by: Bhuvanashree B S <bhuvanashree.b@cyberpwn.com>
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: 1

🧹 Nitpick comments (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (1)

35-39: Exception handling improved; consider using debug-level logging.

Good improvement catching NoSuchElementException specifically instead of the broad Exception. This correctly distinguishes between expected cases (element not present) and unexpected failures.

However, for an optional/expected scenario like this, logger.debug() would be more appropriate than logger.info() to avoid cluttering standard log output.

🔎 Optional refinement for log level
 try {
     Commons.dropdown(driver(), By.id("zone"), "Selected Zone");
-} catch (NoSuchElementException  e) {
-    logger.info("Zone dropdown not available");
+} catch (NoSuchElementException e) {
+    logger.debug("Zone dropdown not available in this test context");
 }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d5e5cc1 and 23f3262.

📒 Files selected for processing (2)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (1 hunks)
  • uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (7 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-19T13:30:35.392Z
Learnt from: BhuvanaShreeBS
Repo: mosip/admin-ui PR: 800
File: uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java:23-26
Timestamp: 2025-12-19T13:30:35.392Z
Learning: In uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java, the MAC address "1.2.3.4.5.6" and IP address "2.3.4.5.6" test values use non-standard formats intentionally to maintain existing behavior and compatibility with the test infrastructure.

Applied to files:

  • uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java
🧬 Code graph analysis (1)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (4)
uitest-admin/src/main/java/io/mosip/testrig/adminui/dbaccess/DBManager.java (1)
  • DBManager (26-153)
uitest-admin/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java (1)
  • AdminTestUtil (34-323)
uitest-admin/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java (1)
  • ConfigManager (13-680)
uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java (1)
  • BaseTestCaseFunc (30-230)
🔇 Additional comments (7)
uitest-admin/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java (2)

3-3: LGTM! Logger initialization supports enhanced reporting.

The Log4j logger is properly initialized and aligns well with the PR objective of enhanced ExtentReport logging capabilities.

Also applies to: 12-12


16-58: Excellent enhancement of test reporting with descriptive action messages.

The comprehensive addition of descriptive messages to all test actions (navigation, input, selection, CRUD operations) directly achieves the PR objective of enhanced ExtentReport logging. The test flow is well-structured, covering the full machine lifecycle: create → filter → edit → activate → edit → deactivate → decommission.

The descriptive messages provide clear traceability for each action, which will significantly improve test reports and debugging capabilities.

uitest-admin/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java (5)

4-4: LGTM! Imports support UTF-8 file reading.

The new imports properly support reading the Known Issues file with explicit UTF-8 encoding, addressing the charset concern from previous reviews.

Also applies to: 6-6, 8-8, 17-19


36-36: LGTM! Known Issues loading properly implemented.

The implementation correctly addresses previous review comments:

  • UTF-8 encoding via InputStreamReader with StandardCharsets.UTF_8
  • Edge case handling with split("------", 2) to handle test names containing the delimiter
  • Validation of trimmed parts before adding to map
  • Appropriate exception handling with warning log for an optional feature

The public static map is thread-safe since it's populated once at startup and only read afterward.

Also applies to: 43-67


178-178: LGTM! Report configuration properly set.

The output directory and report naming configuration correctly incorporate environment details and timestamp for unique report identification.

Also applies to: 180-181


223-233: LGTM! Minor formatting adjustments.

The formatting changes maintain existing logic while improving code layout. The method correctly determines the kernel properties filename based on environment configuration.


79-81: KnownIssueListener is registered twice in the IDE execution path.

The testng.xml file (lines 28-32) already declares all three listeners: EmailableReport, AdminTestListener, and KnownIssueListener. When the IDE path loads this XML, all listeners are automatically registered. The programmatic addition at line 173 is therefore redundant for KnownIssueListener. Consider removing the programmatic registration to avoid duplicate listener invocation, or verify that duplicate registration is intentional.

@ase-101 ase-101 merged commit 965647b into mosip:develop Dec 22, 2025
15 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.

4 participants