-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
133 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
frontend/cypress/e2e/AdminE2E/MenuConfig/globalMenuConfig.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import LoginPage from "../../../pages/LoginPage"; | ||
|
||
let loginPage = null; | ||
let homePage = null; | ||
let adminPage = null; | ||
let globalMenuConfigPage = null; | ||
|
||
before(() => { | ||
// Initialize LoginPage object and navigate to Admin Page | ||
loginPage = new LoginPage(); | ||
loginPage.visit(); | ||
|
||
homePage = loginPage.goToHomePage(); | ||
adminPage = homePage.goToAdminPage(); | ||
}); | ||
|
||
describe("Global Menu Configuration", function () { | ||
it("User navigates to the Global Menu Configuration page", function () { | ||
globalMenuConfigPage = adminPage.goToGlobalMenuConfigPage(); | ||
}); | ||
|
||
it("User turns 0ff the toggle switch and submits", function () { | ||
globalMenuConfigPage.turnOffToggleSwitch(); | ||
globalMenuConfigPage.submitButton(); | ||
}); | ||
|
||
it("User turns on the toggle switch", function () { | ||
globalMenuConfigPage.turnOnToggleSwitch(); | ||
}); | ||
it("User checks the menu items and submits", function () { | ||
globalMenuConfigPage.checkMenuItem("home"); | ||
globalMenuConfigPage.checkMenuItem("order"); | ||
globalMenuConfigPage.checkMenuItem("billing"); | ||
globalMenuConfigPage.checkMenuItem("immunoChem"); | ||
globalMenuConfigPage.checkMenuItem("cytology"); | ||
globalMenuConfigPage.checkMenuItem("results"); | ||
globalMenuConfigPage.checkMenuItem("validation"); | ||
globalMenuConfigPage.checkMenuItem("patient"); | ||
globalMenuConfigPage.checkMenuItem("pathology"); | ||
globalMenuConfigPage.checkMenuItem("workplan"); | ||
globalMenuConfigPage.checkMenuItem("nonConform"); | ||
globalMenuConfigPage.checkMenuItem("reports"); | ||
globalMenuConfigPage.checkMenuItem("study"); | ||
globalMenuConfigPage.checkMenuItem("admin"); | ||
globalMenuConfigPage.checkMenuItem("help"); | ||
globalMenuConfigPage.submitButton(); | ||
}); | ||
it("User relogs in to verify the menu changes", function () { | ||
// Initialize LoginPage object and navigate to the menu | ||
loginPage = new LoginPage(); | ||
loginPage.visit(); | ||
|
||
homePage = loginPage.goToHomePage(); | ||
globalMenuConfigPage = homePage.openNavigationMenu(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
class GlobalMenuConfigPage { | ||
constructor() {} | ||
|
||
// This method is used to visit the page | ||
visit() { | ||
cy.visit("/administration#globalMenuManagement"); | ||
} | ||
|
||
turnOffToggleSwitch() { | ||
cy.get("div.cds--toggle__switch").click(); | ||
} | ||
|
||
turnOnToggleSwitch() { | ||
cy.get("div.cds--toggle label div > div").should("be.visible").click(); | ||
} | ||
|
||
checkMenuItem = function (menuItem) { | ||
// Map of menu items to their respective checkboxes | ||
const menuItems = { | ||
home: "#menu_home_checkbox", | ||
order: "#menu_sample_checkbox", | ||
immunoChem: "#menu_immunochem_checkbox", | ||
cytology: "#menu_cytology_checkbox", | ||
results: "#menu_results_checkbox", | ||
validation: "#menu_resultvalidation_checkbox", | ||
reports: "#menu_reports_checkbox", | ||
study: "#menu_reports_study_checkbox", | ||
billing: "#menu_billing_checkbox", | ||
admin: "#menu_administration_checkbox", | ||
help: "#menu_help_checkbox", | ||
patient: "#menu_patient_checkbox", | ||
nonConform: "#menu_nonconformity_checkbox", | ||
workplan: "#menu_workplan_checkbox", | ||
pathology: "#menu_pathology_checkbox", | ||
}; | ||
|
||
// Get the corresponding checkbox selector based on the passed menuItem | ||
const checkboxSelector = menuItems[menuItem]; | ||
|
||
if (checkboxSelector) { | ||
// Perform the check action, forcing it to check even if covered | ||
cy.get(checkboxSelector).check({ force: true }); | ||
} else { | ||
// If no valid menuItem is passed, log an error | ||
cy.log("Invalid menu item"); | ||
} | ||
}; | ||
|
||
submitButton() { | ||
cy.contains("button", "Submit").click(); | ||
} | ||
} | ||
|
||
export default GlobalMenuConfigPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters