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
+37
View File
@@ -0,0 +1,37 @@
import { expect, type Page, test } from "@playwright/test"
async function setSpanishLocaleCookie(page: Page, baseURL?: string) {
await page.context().addCookies([
{
name: "stock-manager-locale",
value: "es",
url: baseURL ?? "http://127.0.0.1:3100",
},
])
}
test.describe("i18n locale cookie", () => {
test("renders Spanish pilot copy on login and dashboard home", async ({
baseURL,
page,
}) => {
await setSpanishLocaleCookie(page, baseURL)
await page.goto("/login")
await expect(
page.getByRole("heading", { name: "Iniciar sesión" }),
).toBeVisible()
await page.getByLabel("Usuario").fill("admin")
await page.getByLabel("Contraseña").fill("admin-password")
await page.getByRole("button", { name: "Iniciar sesión" }).click()
await expect(page).toHaveURL("/")
await expect(
page.getByRole("heading", { name: "Panel de control" }),
).toBeVisible()
await expect(page.locator("html")).toHaveAttribute("lang", "es")
await expect(page.getByText("Total de artículos")).toBeVisible()
await expect(page.getByText("Total de activos")).toBeVisible()
await expect(page.getByText("Total de destinatarios")).toBeVisible()
})
})