Skip to content

Commit

Permalink
Merge branch 'develop' into issue-1399
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzy11 authored Jan 20, 2025
2 parents aece0ec + bb5795b commit fa0ab72
Show file tree
Hide file tree
Showing 29 changed files with 397 additions and 157 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();
});
});
});
10 changes: 4 additions & 6 deletions frontend/cypress/e2e/login.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ describe("Failing or Succeeding to Login", function () {
login.signIn();

if (user.correctPass === true) {
cy.get("header#mainHeader > button[title='Open menu']")
.should("exist")
.and(
"span:nth-of-type(3) > .cds--btn.cds--btn--icon-only.cds--btn--primary.cds--header__action > svg > path:nth-of-type(1)",
"exist",
);
cy.get("header#mainHeader > button[title='Open menu']").should(
"exist",
);
cy.get(".custom-action svg path:first-of-type").should("exist");
} else {
cy.get("div[role='status']").should("be.visible");
}
Expand Down
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;
18 changes: 11 additions & 7 deletions frontend/src/components/Style.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ li.clickableUserDetails:hover {
}

.adminPageContent {
margin-left: 17%;
margin-left: 21%;
margin-right: 1%;
}

Expand Down Expand Up @@ -516,9 +516,18 @@ button {
grid-template-columns: 1fr;
}
}
@media screen and (max-width: 550px) {

@media screen and (max-width: 1053px) {
.adminPageContent {
margin-left: 9%;
margin-right: 5%;
}
}

@media screen and (max-width: 500px) {
.adminPageContent {
margin-left: 15%;
margin-right: 5%;
}
}

Expand All @@ -527,11 +536,6 @@ button {
flex-direction: column;
}
}
@media screen and (max-width: 500px) {
.adminPageContent {
margin-left: 17%;
}
}

@media screen and (max-width: 322px) {
.logo {
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/components/admin/Admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,54 +285,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
Loading

0 comments on commit fa0ab72

Please sign in to comment.