From 47f414e0f29a1e248b4631582fbbc85716572cd4 Mon Sep 17 00:00:00 2001 From: phibkro <71797726+phibkro@users.noreply.github.com> Date: Sun, 20 Oct 2024 22:18:01 +0200 Subject: [PATCH] test: :white_check_mark: make sure user menu links stay --- app/pages/layout.spec.ts | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/app/pages/layout.spec.ts b/app/pages/layout.spec.ts index a84ffdf..7de8575 100644 --- a/app/pages/layout.spec.ts +++ b/app/pages/layout.spec.ts @@ -7,10 +7,37 @@ const departments = { }; test.describe("Dashboard sidebar", () => { + test.beforeEach(async ({ page }) => { + await page.goto("http://localhost:5173/dashboard"); + }); + + test.describe("user menu", () => { + const user = { + name: "shadcn", + }; + test("skal eksistere", async ({ page }) => { + await page.getByRole("button", { name: user.name }); + }); + + test("skal ha en lenke til profil", async ({ page }) => { + await page.getByRole("button", { name: user.name }).click(); + await page.getByRole("menuitem", { name: "Profil" }).click(); + }); + + test("skal ha en logg ut lenke", async ({ page }) => { + await page.getByRole("button", { name: user.name }).click(); + + await page.getByRole("menuitem", { name: "Logg ut" }).click(); + }); + + test("skal ha en lenke for utlegg", async ({ page }) => { + await page.getByRole("button", { name: user.name }).click(); + await page.getByRole("menuitem", { name: "Utlegg" }).click(); + }); + }); + test.describe("department selection", () => { test("all departments should be selectable", async ({ page }) => { - await page.goto("http://localhost:5173/dashboard"); - await page.getByRole("button", { name: departments.trondheim }).click(); await page.getByRole("menuitem", { name: departments.bergen }).click(); await expect(page.locator("body")).toContainText(departments.bergen);