feat(i18n): localize movement UI

This commit is contained in:
2026-06-14 01:20:23 +02:00
parent 7d5ab64653
commit f62cd6fb37
8 changed files with 270 additions and 17 deletions
+43
View File
@@ -0,0 +1,43 @@
import { expect, type Page, test } from "@playwright/test"
async function setLocaleCookie(
page: Page,
locale: "en" | "es",
baseURL?: string,
) {
await page.context().addCookies([
{
name: "stock-manager-locale",
value: locale,
url: baseURL ?? "http://127.0.0.1:3100",
},
])
}
async function signInAsAdmin(page: Page, baseURL?: string) {
await setLocaleCookie(page, "en", baseURL)
await page.goto("/login")
await page.getByLabel("Username").fill("admin")
await page.getByLabel("Password").fill("admin-password")
await page.getByRole("button", { name: "Sign In" }).click()
await expect(page).toHaveURL("/")
}
test.describe("movements localization", () => {
test("renders movement list UI copy in Spanish", async ({
baseURL,
page,
}) => {
await signInAsAdmin(page, baseURL)
await setLocaleCookie(page, "es", baseURL)
await page.goto("/movements")
await expect(page.locator("html")).toHaveAttribute("lang", "es")
await expect(
page.getByRole("heading", { name: "Movimientos" }),
).toBeVisible()
await expect(page.getByText("No se encontraron movimientos.")).toBeVisible()
await expect(page.getByText("Tipo")).toHaveCount(0)
})
})