hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import { expect, test } from "@playwright/test"; |
| 2 | |
| 3 | const schoolId = process.env.E2E_SCHOOL_ID; |
| 4 | const username = process.env.E2E_ADMIN_USERNAME ?? "admin"; |
| 5 | const password = process.env.E2E_ADMIN_PASSWORD ?? "admin123"; |
| 6 | |
| 7 | test("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-username").fill(username); |
| 11 | await page.locator("#login-password").fill(password); |
| 12 | await page.locator("form").getByRole("button", { name: /log in|sign in|giriş yap/i }).click(); |
| 13 | |
| 14 | const chooser = page.getByRole("heading", { name: /choose your school|okulunu seç/i }); |
| 15 | const shell = page.getByRole("main"); |
| 16 | await expect(chooser.or(shell)).toBeVisible(); |
| 17 | if (await chooser.isVisible()) { |
| 18 | if (!schoolId) throw new Error("login returned a school chooser; set E2E_SCHOOL_ID to the school uuid"); |
| 19 | await page.getByRole("button", { name: schoolId }).click(); |
| 20 | } |
| 21 | |
| 22 | await expect(page).toHaveURL(/\/$/); |
| 23 | await expect(page.getByRole("main")).toBeVisible(); |
| 24 | |
| 25 | // The mobile tab bar is absent on desktop but must be reachable and named on |
| 26 | // a touch viewport. This catches accidental removal of its accessible nav. |
| 27 | if (test.info().project.name === "mobile") { |
| 28 | const navigation = page.getByRole("navigation", { name: /menu|menü/i }); |
| 29 | await expect(navigation).toBeVisible(); |
| 30 | await navigation.getByRole("button", { name: /account|hesap/i }).focus(); |
| 31 | await expect(navigation.getByRole("button", { name: /account|hesap/i })).toBeFocused(); |
| 32 | } |
| 33 | }); |