test(e2e): click locale switcher by aria-label

Use the actual accessible name of the DE button to ensure Playwright clicks the correct element.

Co-authored-by: dennis <dennis@konkol.net>
This commit is contained in:
Cursor Agent
2026-01-14 16:24:00 +00:00
parent c150cd82d9
commit dce6b6f567

View File

@@ -4,8 +4,8 @@ test.describe("i18n routing", () => {
test("language switcher navigates between locales", async ({ page }) => { test("language switcher navigates between locales", async ({ page }) => {
await page.goto("/en", { waitUntil: "domcontentloaded" }); await page.goto("/en", { waitUntil: "domcontentloaded" });
// Buttons are "EN"/"DE" in the header // Buttons have aria-labels; click the DE switcher.
const deButton = page.getByRole("button", { name: "DE" }); const deButton = page.getByRole("button", { name: "Sprache auf Deutsch umstellen" });
if (await deButton.count()) { if (await deButton.count()) {
// Verify an EN label is present before switching (nav.home) // Verify an EN label is present before switching (nav.home)
await expect(page.getByRole("link", { name: "Home" })).toBeVisible(); await expect(page.getByRole("link", { name: "Home" })).toBeVisible();