diff --git a/frontend/cypress.config.js b/frontend/cypress.config.js
index f5b9f83351..a48f5dd3fa 100755
--- a/frontend/cypress.config.js
+++ b/frontend/cypress.config.js
@@ -20,6 +20,7 @@ module.exports = defineConfig({
"cypress/e2e/report.cy.js",
"cypress/e2e/batchOrderEntry.cy.js",
"cypress/e2e/dashboard.cy.js",
+ "cypress/e2e/labNumberManagement.cy.js",
];
return config;
},
diff --git a/frontend/cypress/e2e/labNumberManagement.cy.js b/frontend/cypress/e2e/labNumberManagement.cy.js
new file mode 100644
index 0000000000..0f2bb2ce39
--- /dev/null
+++ b/frontend/cypress/e2e/labNumberManagement.cy.js
@@ -0,0 +1,44 @@
+import LoginPage from "../pages/LoginPage";
+
+let loginPage = null;
+let homePage = null;
+let adminPage = null;
+let labNumMgtPage = null;
+
+before(() => {
+ // Initialize LoginPage object and navigate to Admin Page
+ loginPage = new LoginPage();
+ loginPage.visit();
+
+ homePage = loginPage.goToHomePage();
+ adminPage = homePage.goToAdminPage();
+});
+
+beforeEach(() => {
+ // Load fixture data for each test
+ cy.fixture("LabNumberManagement").as("labNMData");
+});
+
+describe("Lab Number Management", function () {
+ it("User navigates to the Lab Number Management page", function () {
+ labNumMgtPage = adminPage.goToLabNumberManagementPage();
+ });
+
+ it("User selects legacy lab number type and submits", function () {
+ cy.get("@labNMData").then((labNumberManagementData) => {
+ labNumMgtPage.selectLabNumber(
+ labNumberManagementData.legacyLabNumberType,
+ );
+ labNumMgtPage.clickSubmitButton();
+ });
+ });
+
+ it("User selects alpha numeric lab number type and submits", function () {
+ cy.get("@labNMData").then((labNumberManagementData) => {
+ labNumMgtPage.selectLabNumber(labNumberManagementData.alphaLabNumberType);
+ labNumMgtPage.checkPrefixCheckBox();
+ labNumMgtPage.typePrefix(labNumberManagementData.userPrefix);
+ labNumMgtPage.clickSubmitButton();
+ });
+ });
+});
diff --git a/frontend/cypress/fixtures/LabNumberManagement.json b/frontend/cypress/fixtures/LabNumberManagement.json
new file mode 100644
index 0000000000..46792a45c1
--- /dev/null
+++ b/frontend/cypress/fixtures/LabNumberManagement.json
@@ -0,0 +1,5 @@
+{
+ "alphaLabNumberType": "Alpha Numeric",
+ "legacyLabNumberType": "Legacy",
+ "userPrefix": "REG-"
+}
diff --git a/frontend/cypress/pages/AdminPage.js b/frontend/cypress/pages/AdminPage.js
new file mode 100644
index 0000000000..0d059f1a02
--- /dev/null
+++ b/frontend/cypress/pages/AdminPage.js
@@ -0,0 +1,33 @@
+//This handles all pages of the admin
+import LabNumberManagementPage from "./LabNumberManagementPage";
+
+class AdminPage {
+ constructor() {}
+
+ visit() {
+ cy.visit("/administration"); //need to confirm this
+ }
+ //this page is also included in the homepage
+ goToAdminPage() {
+ this.openNavigationMenu();
+ cy.get("#menu_administration").click();
+ cy.get("#menu_administration_nav").click();
+ return new AdminPage();
+ }
+
+ //lab number management
+ goToLabNumberManagementPage() {
+ // Click on the element using the provided selector
+ cy.get("a.cds--side-nav__link[href='#labNumber']")
+ .should("be.visible") // Ensure the element is visible
+ .click(); // Click to navigate to the page
+
+ // Verify the URL or some unique identifier of the target page
+ cy.url().should("include", "#labNumber"); // Validate URL fragment
+ cy.contains("Lab Number Management").should("be.visible"); // Confirm presence of the page content
+
+ return new LabNumberManagementPage(); // Return the page object
+ }
+}
+
+export default AdminPage;
diff --git a/frontend/cypress/pages/HomePage.js b/frontend/cypress/pages/HomePage.js
index dfedb13fc3..ff7c338a7c 100755
--- a/frontend/cypress/pages/HomePage.js
+++ b/frontend/cypress/pages/HomePage.js
@@ -12,6 +12,7 @@ import RoutineReportPage from "./RoutineReportPage";
import StudyReportPage from "./StudyReportPage";
import DashBoardPage from "./DashBoard";
+import AdminPage from "./AdminPage";
class HomePage {
constructor() {}
@@ -192,6 +193,12 @@ class HomePage {
cy.get("#menu_immunochemdashboard_nav").click();
return new DashBoardPage();
}
+
+ goToAdminPage() {
+ this.openNavigationMenu();
+ cy.get("#menu_administration").click();
+ return new AdminPage();
+ }
}
export default HomePage;
diff --git a/frontend/cypress/pages/LabNumberManagementPage.js b/frontend/cypress/pages/LabNumberManagementPage.js
new file mode 100644
index 0000000000..8eb30188e6
--- /dev/null
+++ b/frontend/cypress/pages/LabNumberManagementPage.js
@@ -0,0 +1,30 @@
+class LabNumberManagementPage {
+ constructor() {}
+
+ verifyPageLoaded() {
+ // Confirm the page is loaded by checking a unique element
+ cy.contains("Lab Number Management").should("be.visible");
+ }
+
+ selectLabNumber(labNumberType) {
+ // Ensure the dropdown is visible and interactable
+ cy.get("#lab_number_type").should("be.visible").select(labNumberType); // Select the lab number type passed as an argument
+ }
+
+ checkPrefixCheckBox() {
+ cy.get("#usePrefix").check({ force: true }); // Check the checkbox
+ }
+ typePrefix(prefix) {
+ this.checkPrefixCheckBox();
+
+ // Wait for the input to become enabled
+ cy.get("#alphanumPrefix").should("not.be.disabled").type(prefix);
+ }
+ clickSubmitButton() {
+ cy.get("button.cds--btn.cds--btn--primary[type='submit']")
+ .should("be.visible")
+ .click();
+ }
+}
+
+export default LabNumberManagementPage;
diff --git a/frontend/src/components/admin/Admin.js b/frontend/src/components/admin/Admin.js
index 65832d2e17..d7f42db76d 100644
--- a/frontend/src/components/admin/Admin.js
+++ b/frontend/src/components/admin/Admin.js
@@ -396,54 +396,63 @@ function Admin() {