feat(i18n): add locale dictionaries and pilot surfaces

This commit is contained in:
2026-06-11 04:55:47 +02:00
parent 2c6d6bffcd
commit ac3dfe69cd
15 changed files with 354 additions and 19 deletions
+28 -6
View File
@@ -1,6 +1,17 @@
import { expect, type Page, test } from "@playwright/test"
async function signInAsAdmin(page: Page) {
async function setEnglishLocaleCookie(page: Page, baseURL?: string) {
await page.context().addCookies([
{
name: "stock-manager-locale",
value: "en",
url: baseURL ?? "http://127.0.0.1:3100",
},
])
}
async function signInAsAdmin(page: Page, baseURL?: string) {
await setEnglishLocaleCookie(page, baseURL)
await page.goto("/login")
await page.getByLabel("Username").fill("admin")
await page.getByLabel("Password").fill("admin-password")
@@ -9,7 +20,12 @@ async function signInAsAdmin(page: Page) {
}
test.describe("main app smoke", () => {
test("redirects unauthenticated users to login", async ({ page }) => {
test("redirects unauthenticated users to login", async ({
baseURL,
page,
}) => {
await setEnglishLocaleCookie(page, baseURL)
await page.goto("/admin/users")
await expect(page).toHaveURL(/\/login/)
@@ -17,8 +33,11 @@ test.describe("main app smoke", () => {
await expect(page.getByRole("button", { name: "Sign In" })).toBeVisible()
})
test("signs in as seeded admin and opens the dashboard", async ({ page }) => {
await signInAsAdmin(page)
test("signs in as seeded admin and opens the dashboard", async ({
baseURL,
page,
}) => {
await signInAsAdmin(page, baseURL)
await expect(page.getByRole("heading", { name: "Dashboard" })).toBeVisible()
await expect(page.getByText("E2E Admin")).toBeVisible()
@@ -27,8 +46,11 @@ test.describe("main app smoke", () => {
).toBeVisible()
})
test("admin can open users and inventory pages", async ({ page }) => {
await signInAsAdmin(page)
test("admin can open users and inventory pages", async ({
baseURL,
page,
}) => {
await signInAsAdmin(page, baseURL)
await page.getByRole("link", { name: "Users" }).click()
await expect(page).toHaveURL(/\/admin\/users/)