From 15fdd2abe03848876e5fd8d36abafc48433194a7 Mon Sep 17 00:00:00 2001 From: Madhura Date: Mon, 15 Jun 2026 14:25:43 +0100 Subject: [PATCH 1/6] Add more menus to the navbar for student and teachers --- src/app/components/site/NavigationBar.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/components/site/NavigationBar.tsx b/src/app/components/site/NavigationBar.tsx index 33c66f6b82..129f19e6e9 100644 --- a/src/app/components/site/NavigationBar.tsx +++ b/src/app/components/site/NavigationBar.tsx @@ -6,6 +6,7 @@ import { isAdminOrEventManager, isContentEditor, isEventLeader, + isLoggedIn, isTeacherOrAbove, isTutorOrAbove, } from "../../services"; @@ -32,6 +33,12 @@ export const NavigationBar = () => { My tests {} + {!isLoggedIn(user) && ( + }> + Benefits for teachers + + )} + {isTutorOrAbove(user) && ( }> Manage groups @@ -43,6 +50,7 @@ export const NavigationBar = () => { GCSE suggested teaching order A Level suggested teaching order GCSE revision plan + Benefits for teachers )} @@ -57,6 +65,7 @@ export const NavigationBar = () => { Computer Science Journeys Careers in Computer Science Glossary + Benefits for students }> From 9f84baf8b22210c17dc3ad14ebe601f5ac06d2d4 Mon Sep 17 00:00:00 2001 From: Madhura Date: Mon, 15 Jun 2026 15:30:32 +0100 Subject: [PATCH 2/6] add tests for the items added in nav bar --- src/test/pages/IsaacApp.test.tsx | 83 ++++++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 3 deletions(-) diff --git a/src/test/pages/IsaacApp.test.tsx b/src/test/pages/IsaacApp.test.tsx index 0206e7fe3d..137880eef3 100644 --- a/src/test/pages/IsaacApp.test.tsx +++ b/src/test/pages/IsaacApp.test.tsx @@ -4,16 +4,21 @@ import { zip } from "lodash"; import { renderTestEnvironment, NavBarMenus, NAV_BAR_MENU_TITLE, TestUserRole } from "../utils"; import { USER_ROLES, history } from "../../app/services"; +const BENEFITS_FOR_STUDENTS_PAGE = "/pages/9664ad7b-af70-4a2e-b94d-31eb8b04f870"; +const BENEFITS_FOR_TEACHERS_PAGE = "/pages/b8e27a15-f743-4a63-ba66-eed2ed16a1c5"; + const myIsaacLinks = ["/assignments", "/my_gameboards", "/progress", "/tests"]; const tutorLinks = ["/groups", "/set_assignments", "/my_markbook"]; +const loggedOutTeacherLinks = [BENEFITS_FOR_TEACHERS_PAGE]; const teacherLinks = [ "/groups", "/set_assignments", "/my_markbook", "/set_tests", - "/teaching_order_g_ocr", - "/teaching_order_g_aqa", + "/gcse_teaching_order", "/teaching_order", + "/teacher_gcse_revision_page", + BENEFITS_FOR_TEACHERS_PAGE, ]; const learnLinks = [ "/topics/gcse", @@ -23,6 +28,7 @@ const learnLinks = [ "/pages/computer_science_journeys_gallery", "/careers_in_computer_science", "/glossary", + BENEFITS_FOR_STUDENTS_PAGE, ]; const eventsLinks = ["/events", "/safeguarding"]; const teacherEventLinks = ["/events?show_reservations_only=true"].concat(eventsLinks); @@ -34,7 +40,7 @@ const navigationBarLinksPerRole: { } = { ANONYMOUS: { "My Isaac": myIsaacLinks, - Teach: null, + Teach: loggedOutTeacherLinks, Learn: learnLinks, Events: eventsLinks, Help: helpLinks, @@ -139,6 +145,77 @@ describe("IsaacApp", () => { }); it.todo("should show the users number of current assignments in the navigation menu"); + describe("Benefits navigation menus", () => { + const waitForAppToLoad = async () => { + await screen.findByTestId("main"); + }; + + const openNavDropdown = async (menu: NavBarMenus) => { + await waitForAppToLoad(); + const header = await screen.findByTestId("header"); + const navLink = await within(header).findByText(NAV_BAR_MENU_TITLE[menu]); + await userEvent.click(navLink); + const menuSectionParent = navLink.closest("li[class*='nav-item']") as HTMLLIElement | null; + if (!menuSectionParent) { + fail(`Missing NavigationSection parent for ${menu} menu.`); + } + return within(menuSectionParent).findAllByRole("menuitem"); + }; + + const expectTeachersMenuVisible = async (visible: boolean) => { + await waitForAppToLoad(); + const header = await screen.findByTestId("header"); + await waitFor(() => { + const navLink = within(header).queryByText(NAV_BAR_MENU_TITLE.Teach); + if (visible) { + expect(navLink).not.toBeNull(); + } else { + expect(navLink).toBeNull(); + } + }); + }; + + it("shows Benefits for students in the Learn menu for students", async () => { + renderTestEnvironment({ role: "STUDENT" }); + const learnMenuItems = await openNavDropdown("Learn"); + const benefitsForStudents = learnMenuItems.find((item) => item.textContent?.includes("Benefits for students")); + expect(benefitsForStudents).toBeDefined(); + expect(benefitsForStudents).toHaveAttribute("href", BENEFITS_FOR_STUDENTS_PAGE); + }); + + it("shows only Benefits for teachers in the Teachers menu for logged out users", async () => { + renderTestEnvironment({ role: "ANONYMOUS" }); + await expectTeachersMenuVisible(true); + const teachersMenuItems = await openNavDropdown("Teach"); + expect(teachersMenuItems).toHaveLength(1); + expect(teachersMenuItems[0]).toHaveTextContent("Benefits for teachers"); + expect(teachersMenuItems[0]).toHaveAttribute("href", BENEFITS_FOR_TEACHERS_PAGE); + }); + + it("shows Benefits for teachers alongside other teacher menus when logged in as a teacher", async () => { + renderTestEnvironment({ role: "TEACHER" }); + await expectTeachersMenuVisible(true); + const teachersMenuItems = await openNavDropdown("Teach"); + const hrefs = teachersMenuItems.map((item) => item.getAttribute("href")); + expect(hrefs).toEqual(teacherLinks); + expect(hrefs).toContain(BENEFITS_FOR_TEACHERS_PAGE); + }); + + it("does not show the Teachers menu for logged in students", async () => { + renderTestEnvironment({ role: "STUDENT" }); + await expectTeachersMenuVisible(false); + }); + + it("does not show Benefits for teachers in the Teachers menu for logged in tutors", async () => { + renderTestEnvironment({ role: "TUTOR" }); + await expectTeachersMenuVisible(true); + const teachersMenuItems = await openNavDropdown("Teach"); + const hrefs = teachersMenuItems.map((item) => item.getAttribute("href")); + expect(hrefs).toEqual(tutorLinks); + expect(hrefs).not.toContain(BENEFITS_FOR_TEACHERS_PAGE); + }); + }); + it.each(USER_ROLES)("should not show the promo content banner for %s users", async (role) => { renderTestEnvironment({ role }); await screen.findByTestId("main"); From 248f860dea3c2b7a79fa762d8e5a13f2935e81e6 Mon Sep 17 00:00:00 2001 From: Madhura Date: Tue, 16 Jun 2026 10:23:34 +0100 Subject: [PATCH 3/6] Update landing pages ids --- src/app/components/site/NavigationBar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/site/NavigationBar.tsx b/src/app/components/site/NavigationBar.tsx index 129f19e6e9..da699cbb87 100644 --- a/src/app/components/site/NavigationBar.tsx +++ b/src/app/components/site/NavigationBar.tsx @@ -50,7 +50,7 @@ export const NavigationBar = () => { GCSE suggested teaching order A Level suggested teaching order GCSE revision plan - Benefits for teachers + Benefits for teachers )} @@ -65,7 +65,7 @@ export const NavigationBar = () => { Computer Science Journeys Careers in Computer Science Glossary - Benefits for students + Benefits for students }> From b59710bf80cf2175d22e16fd4d4fec505a6d14a9 Mon Sep 17 00:00:00 2001 From: Madhura Date: Tue, 16 Jun 2026 12:25:00 +0100 Subject: [PATCH 4/6] Refactor page link --- src/app/components/site/NavigationBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/site/NavigationBar.tsx b/src/app/components/site/NavigationBar.tsx index da699cbb87..55fb44ae9e 100644 --- a/src/app/components/site/NavigationBar.tsx +++ b/src/app/components/site/NavigationBar.tsx @@ -35,7 +35,7 @@ export const NavigationBar = () => { {!isLoggedIn(user) && ( }> - Benefits for teachers + Benefits for teachers )} From 97f56280d2991f7e19e97a2725ed44224be8e8a9 Mon Sep 17 00:00:00 2001 From: Madhura Date: Tue, 16 Jun 2026 12:27:16 +0100 Subject: [PATCH 5/6] Refactor landing page links in tests --- src/test/pages/IsaacApp.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/pages/IsaacApp.test.tsx b/src/test/pages/IsaacApp.test.tsx index 137880eef3..00f7176170 100644 --- a/src/test/pages/IsaacApp.test.tsx +++ b/src/test/pages/IsaacApp.test.tsx @@ -4,8 +4,8 @@ import { zip } from "lodash"; import { renderTestEnvironment, NavBarMenus, NAV_BAR_MENU_TITLE, TestUserRole } from "../utils"; import { USER_ROLES, history } from "../../app/services"; -const BENEFITS_FOR_STUDENTS_PAGE = "/pages/9664ad7b-af70-4a2e-b94d-31eb8b04f870"; -const BENEFITS_FOR_TEACHERS_PAGE = "/pages/b8e27a15-f743-4a63-ba66-eed2ed16a1c5"; +const BENEFITS_FOR_STUDENTS_PAGE = "/pages/teacher_landing_page"; +const BENEFITS_FOR_TEACHERS_PAGE = "/pages/student_landing_page"; const myIsaacLinks = ["/assignments", "/my_gameboards", "/progress", "/tests"]; const tutorLinks = ["/groups", "/set_assignments", "/my_markbook"]; From 39f7587fb3e61c86ad381ce5f133b652e7849b95 Mon Sep 17 00:00:00 2001 From: Madhura Date: Tue, 16 Jun 2026 16:44:07 +0100 Subject: [PATCH 6/6] Fix the links --- src/test/pages/IsaacApp.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/pages/IsaacApp.test.tsx b/src/test/pages/IsaacApp.test.tsx index 00f7176170..4ac62bc076 100644 --- a/src/test/pages/IsaacApp.test.tsx +++ b/src/test/pages/IsaacApp.test.tsx @@ -4,8 +4,8 @@ import { zip } from "lodash"; import { renderTestEnvironment, NavBarMenus, NAV_BAR_MENU_TITLE, TestUserRole } from "../utils"; import { USER_ROLES, history } from "../../app/services"; -const BENEFITS_FOR_STUDENTS_PAGE = "/pages/teacher_landing_page"; -const BENEFITS_FOR_TEACHERS_PAGE = "/pages/student_landing_page"; +const BENEFITS_FOR_STUDENTS_PAGE = "/pages/student_landing_page"; +const BENEFITS_FOR_TEACHERS_PAGE = "/pages/teacher_landing_page"; const myIsaacLinks = ["/assignments", "/my_gameboards", "/progress", "/tests"]; const tutorLinks = ["/groups", "/set_assignments", "/my_markbook"];