Skip to content

Commit

Permalink
Added admin e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
Bahati308 committed Jan 13, 2025
1 parent c2029b7 commit 0be342c
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 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/admin.cy.js",
];
return config;
},
Expand Down
17 changes: 17 additions & 0 deletions frontend/cypress/e2e/admin.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import LoginPage from "../pages/LoginPage";

let homePage = null;
let loginPage = null;
let adminPage = null;

before("login", () => {
loginPage = new LoginPage();
loginPage.visit();
});

describe("Admin Component Menu", function () {
it("User navigates to the Admin Component Menu", function () {
homePage = loginPage.goToHomePage();
adminPage = homePage.goToAdminPage();
});
});
4 changes: 4 additions & 0 deletions frontend/cypress/fixtures/Admin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"username": "admin",
"password": "adminADMIN!"
}
3 changes: 3 additions & 0 deletions frontend/cypress/fixtures/DashBoard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"labNo": "DEV01250000000000087"
}
27 changes: 27 additions & 0 deletions frontend/cypress/pages/AdminPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class AdminPage {
visit() {
cy.visit("/admin");
}

getHeader() {
return cy.get("h1");
}

// Add more methods to interact with elements on the admin page as needed
clickSomeAdminButton() {
return cy.get("#someAdminButton").click();
}

// Example method to verify an element on the admin page
verifyAdminElement() {
return cy.get("#adminElement").should("be.visible");
}
goToAdminPage() {
this.openNavigationMenu();
cy.get("#menu_admin").click();
cy.get("#menu_admin_nav").click();
return new AdminPage();
}
}

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;

0 comments on commit 0be342c

Please sign in to comment.