From 35a5c9a783daa3f350dbc7f82fdccaf4edae247e Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Fri, 15 May 2026 22:09:43 +0300 Subject: [PATCH] Add e2e test --- e2e/calendar.spec.ts | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/e2e/calendar.spec.ts b/e2e/calendar.spec.ts index abd0af2a2..acac94edd 100644 --- a/e2e/calendar.spec.ts +++ b/e2e/calendar.spec.ts @@ -1,3 +1,4 @@ +import type { Page } from "@playwright/test"; import { NZAP_TEST_ID } from "~/db/seed/constants"; import { calendarPage } from "~/utils/urls"; import { @@ -102,4 +103,43 @@ test.describe("Calendar", () => { await page.getByTestId("calendar-navigate-button").nth(1).click(); await expect(page.getByTestId("today-header")).toBeVisible(); }); + + test("renders clock header times in the browser locale", async ({ + browser, + workerBaseURL, + }) => { + const openWith = async (locale: string) => { + const context = await browser.newContext({ + locale, + baseURL: workerBaseURL, + }); + const page = await context.newPage(); + return { context, page }; + }; + + const ca = await openWith("en-CA"); + const gb = await openWith("en-GB"); + + try { + await seed(ca.page); + + await navigate({ page: ca.page, url: calendarPage() }); + await navigate({ page: gb.page, url: calendarPage() }); + + const firstClockText = (page: Page) => + page + .locator("[class*='clockHeader'] [class*='reserve-one-lb']") + .first(); + + const caTime = await firstClockText(ca.page).textContent(); + const gbTime = await firstClockText(gb.page).textContent(); + + expect(caTime).toMatch(/AM|PM|a\.m\.|p\.m\./i); + expect(gbTime).not.toMatch(/AM|PM|a\.m\.|p\.m\./i); + expect(caTime).not.toBe(gbTime); + } finally { + await ca.context.close(); + await gb.context.close(); + } + }); });