Skip to content

Commit

Permalink
Merge branch 'develop' into fix-rewriting-TestManagementConfigMenu-page
Browse files Browse the repository at this point in the history
  • Loading branch information
adityadeshlahre authored Jan 17, 2025
2 parents 4e842d8 + 6a37493 commit 80fd5f2
Show file tree
Hide file tree
Showing 25 changed files with 275 additions and 58 deletions.
1 change: 1 addition & 0 deletions frontend/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand Down
44 changes: 44 additions & 0 deletions frontend/cypress/e2e/labNumberManagement.cy.js
Original file line number Diff line number Diff line change
@@ -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();
});
});
});
5 changes: 5 additions & 0 deletions frontend/cypress/fixtures/LabNumberManagement.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"alphaLabNumberType": "Alpha Numeric",
"legacyLabNumberType": "Legacy",
"userPrefix": "REG-"
}
33 changes: 33 additions & 0 deletions frontend/cypress/pages/AdminPage.js
Original file line number Diff line number Diff line change
@@ -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;
7 changes: 7 additions & 0 deletions frontend/cypress/pages/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import RoutineReportPage from "./RoutineReportPage";
import StudyReportPage from "./StudyReportPage";

import DashBoardPage from "./DashBoard";
import AdminPage from "./AdminPage";

class HomePage {
constructor() {}
Expand Down Expand Up @@ -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;
30 changes: 30 additions & 0 deletions frontend/cypress/pages/LabNumberManagementPage.js
Original file line number Diff line number Diff line change
@@ -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;
9 changes: 9 additions & 0 deletions frontend/src/components/admin/Admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,54 +396,63 @@ function Admin() {
<PathRoute path="#NonConformityConfigurationMenu">
<ConfigMenuDisplay
menuType="NonConformityConfigurationMenu"
label="Non Conformity Configuration Menu"
id="sidenav.label.admin.formEntry.nonconformityconfig"
/>
</PathRoute>
<PathRoute path="#MenuStatementConfigMenu">
<ConfigMenuDisplay
menuType="MenuStatementConfigMenu"
label="Menu Statement Configuration Menu"
id="sidenav.label.admin.formEntry.menustatementconfig"
/>
</PathRoute>
<PathRoute path="#ValidationConfigurationMenu">
<ConfigMenuDisplay
menuType="ValidationConfigurationMenu"
label="Validation Configuration Menu"
id="sidenav.label.admin.formEntry.validationconfig"
/>
</PathRoute>
<PathRoute path="#SampleEntryConfigurationMenu">
<ConfigMenuDisplay
menuType="SampleEntryConfigMenu"
label="Sample Entry Configuration Menu"
id="sidenav.label.admin.formEntry.sampleEntryconfig"
/>
</PathRoute>
<PathRoute path="#WorkPlanConfigurationMenu">
<ConfigMenuDisplay
menuType="WorkplanConfigurationMenu"
label="WorkPlan Configuration Menu"
id="sidenav.label.admin.formEntry.Workplanconfig"
/>
</PathRoute>
<PathRoute path="#SiteInformationMenu">
<ConfigMenuDisplay
menuType="SiteInformationMenu"
label="Site Information Menu"
id="sidenav.label.admin.formEntry.siteInfoconfig"
/>
</PathRoute>
<PathRoute path="#ResultConfigurationMenu">
<ConfigMenuDisplay
menuType="ResultConfigurationMenu"
label="Result Configuration Menu"
id="sidenav.label.admin.formEntry.resultConfig"
/>
</PathRoute>
<PathRoute path="#PatientConfigurationMenu">
<ConfigMenuDisplay
menuType="PatientConfigurationMenu"
label="Patient Configuration Menu"
id="sidenav.label.admin.formEntry.patientconfig"
/>
</PathRoute>
<PathRoute path="#PrintedReportsConfigurationMenu">
<ConfigMenuDisplay
menuType="PrintedReportsConfigurationMenu"
label="PrintedReports Configuration Menu"
id="sidenav.label.admin.formEntry.PrintedReportsconfig"
/>
</PathRoute>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ function BatchTestReassignmentAndCancelation() {
{notificationVisible === true ? <AlertDialog /> : ""}
<div className="adminPageContent">
<PageBreadCrumb breadcrumbs={breadcrumbs} />
<Grid>
<Grid fullWidth={true}>
<Column lg={16} md={8} sm={4}>
<Section>
<Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import BarcodeConfigurationFormValues from "../../formModel/innitialValues/Barco
let breadcrumbs = [
{ label: "home.label", link: "/" },
{ label: "breadcrums.admin.managment", link: "/MasterListsPage" },
{
label: "sidenav.label.admin.barcodeconfiguration",
link: "/MasterListsPage#barcodeConfiguration",
},
];
function BarcodeConfiguration() {
const { notificationVisible, setNotificationVisible, addNotification } =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ import {
} from "../../common/CustomNotification";
import PageBreadCrumb from "../../common/PageBreadCrumb";

const breadcrumbs = [{ label: "home.label", link: "/" }];
const breadcrumbs = [
{ label: "home.label", link: "/" },
{ label: "breadcrums.admin.managment", link: "/MasterListsPage" },
{
label: "sidenav.label.admin.testmgt.calculated",
link: "/MasterListsPage#calculatedValue",
},
];
interface CalculatedValueProps {}

type TestListField = "TEST_RESULT" | "FINAL_RESULT";
Expand Down Expand Up @@ -623,7 +630,7 @@ const CalculatedValue: React.FC<CalculatedValueProps> = () => {
return (
<div className="adminPageContent">
<PageBreadCrumb breadcrumbs={breadcrumbs} />
<Grid>
<Grid fullWidth={true}>
<Column lg={16}>
<Section>
<Heading>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { FormattedMessage, useIntl } from "react-intl";
import PageBreadCrumb from "../../../common/PageBreadCrumb.js";
import GenericConfigEdit from "../../generalConfig/common/GenericConfigEdit.js";

let breadcrumbs = [{ label: "home.label", link: "/" }];
function ConfigMenuDisplay(props) {
const { notificationVisible, setNotificationVisible, addNotification } =
useContext(NotificationContext);
Expand All @@ -54,6 +53,12 @@ function ConfigMenuDisplay(props) {

const [ConfigEdit, setConfigEdit] = useState(false);

let breadcrumbs = [
{ label: "home.label", link: "/" },
{ label: "breadcrums.admin.managment", link: "/MasterListsPage" },
{ label: `${props.label}`, link: `/MasterListsPage#${props.menuType}` },
];

function handleModify(event) {
event.preventDefault();
setConfigEdit(true);
Expand Down Expand Up @@ -185,7 +190,7 @@ function ConfigMenuDisplay(props) {
{notificationVisible === true ? <AlertDialog /> : ""}
<div className="adminPageContent">
<PageBreadCrumb breadcrumbs={breadcrumbs} />
<Grid>
<Grid fullWidth={true}>
<Column lg={16} md={8} sm={4}>
<Section>
<Heading>
Expand Down
13 changes: 10 additions & 3 deletions frontend/src/components/admin/labNumber/LabNumberManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ import { FormattedMessage, useIntl } from "react-intl";
import { ConfigurationContext } from "../../layout/Layout";
import PageBreadCrumb from "../../common/PageBreadCrumb.js";

let breadcrumbs = [{ label: "home.label", link: "/" }];
let breadcrumbs = [
{ label: "home.label", link: "/" },
{ label: "breadcrums.admin.managment", link: "/MasterListsPage" },
{
label: "sidenav.label.admin.labNumber",
link: "/MasterListsPage#labNumber",
},
];
function LabNumberManagement() {
const intl = useIntl();

Expand Down Expand Up @@ -159,7 +166,7 @@ function LabNumberManagement() {
{loading && <Loading />}
<div className="adminPageContent">
<PageBreadCrumb breadcrumbs={breadcrumbs} />
<Grid>
<Grid fullWidth={true}>
<Column lg={16}>
<Section>
<Heading>
Expand All @@ -169,7 +176,7 @@ function LabNumberManagement() {
</Column>
</Grid>
<Form onSubmit={handleSubmit}>
<Grid>
<Grid fullWidth={true}>
<Column lg={8}>
<Select
id="lab_number_type"
Expand Down
12 changes: 10 additions & 2 deletions frontend/src/components/admin/menu/BillingMenuManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ import {
import { FormattedMessage, useIntl } from "react-intl";
import PageBreadCrumb from "../../common/PageBreadCrumb.js";

let breadcrumbs = [{ label: "home.label", link: "/" }];
let breadcrumbs = [
{ label: "home.label", link: "/" },
{ label: "breadcrums.admin.managment", link: "/MasterListsPage" },
{
label: "Billing Menu Management",
link: "/MasterListsPage#billingMenuManagement",
},
];
function BillingMenuManagement() {
const { notificationVisible, setNotificationVisible, addNotification } =
useContext(NotificationContext);
Expand Down Expand Up @@ -87,13 +94,14 @@ function BillingMenuManagement() {
{loading && <Loading />}
<div className="adminPageContent">
<PageBreadCrumb breadcrumbs={breadcrumbs} />
<Grid>
<Grid fullWidth={true}>
<Column lg={16} md={8} sm={4}>
<Section>
<Heading>
<FormattedMessage id="menu.billing.title" />
</Heading>
</Section>
<br />
<Section>
<Form onSubmit={handleSubmit}>
<div className="formInlineDiv">
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/components/admin/menu/CommonProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,16 @@ export const CommonProperties = () => {
<>
<div className="adminPageContent">
{notificationVisible === true ? <AlertDialog /> : ""}
<PageBreadCrumb breadcrumbs={[{ label: "home.label", link: "/" }]} />
<PageBreadCrumb
breadcrumbs={[
{ label: "home.label", link: "/" },
{ label: "breadcrums.admin.managment", link: "/MasterListsPage" },
{
label: "common properties",
link: "/MasterListsPage#commonproperties",
},
]}
/>
<Grid fullWidth={true}>
<Column lg={16} md={8} sm={4}>
<Section>
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/admin/menu/DictionaryManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,11 @@ function DictionaryManagement() {
<PageBreadCrumb
breadcrumbs={[
{ label: "home.label", link: "/" },
{ label: "dictionary.label.modify", link: "/DictionaryManagement" },
{ label: "breadcrums.admin.managment", link: "/MasterListsPage" },
{
label: "dictionary.label.modify",
link: "/MasterListsPage#DictionaryManagement",
},
]}
/>
<Grid fullWidth={true}>
Expand Down
Loading

0 comments on commit 80fd5f2

Please sign in to comment.