feat(i18n): add locale dictionaries and pilot surfaces
This commit is contained in:
@@ -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()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user