forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits

auth-shell.spec.ts26 lines, 1.3 KiBHistoryRawDownload
1import { expect, test } from "@playwright/test";
2
3const school = process.env.E2E_SCHOOL_SLUG ?? "demo";
4const username = process.env.E2E_ADMIN_USERNAME ?? "admin";
5const password = process.env.E2E_ADMIN_PASSWORD ?? "admin123";
6
7test("sign-in reaches the authenticated shell with keyboard-accessible navigation", async ({ page }) => {
8 await page.goto("/login");
9 await expect(page.locator("#login-username")).toBeVisible();
10 await page.locator("#login-school").fill(school);
11 await page.locator("#login-username").fill(username);
12 await page.locator("#login-password").fill(password);
13 await page.locator("form").getByRole("button", { name: /log in|sign in|giriş yap/i }).click();
14
15 await expect(page).toHaveURL(/\/$/);
16 await expect(page.getByRole("main")).toBeVisible();
17
18 // The mobile tab bar is absent on desktop but must be reachable and named on
19 // a touch viewport. This catches accidental removal of its accessible nav.
20 if (test.info().project.name === "mobile") {
21 const navigation = page.getByRole("navigation", { name: /menu|menü/i });
22 await expect(navigation).toBeVisible();
23 await navigation.getByRole("button", { name: /account|hesap/i }).focus();
24 await expect(navigation.getByRole("button", { name: /account|hesap/i })).toBeFocused();
25 }
26});