Skip to content

Commit

Permalink
test: ✅ make sure user menu links stay
Browse files Browse the repository at this point in the history
  • Loading branch information
phibkro committed Oct 20, 2024
1 parent bc4ff3e commit 47f414e
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions app/pages/layout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 47f414e

Please sign in to comment.