arbret/frontend/e2e/helpers/setup.ts
counterweight d2fc7d8850
Fix e2e tests: Set English language before navigation
- Add context.addInitScript in beforeEach hooks to set English locale before page navigation
- Remove debugging code from useLanguage hook
- Remove unused setup file imports
- Fix exchange test to check for English text correctly
- All frontend tests passing
2025-12-25 22:35:27 +01:00

16 lines
542 B
TypeScript

import { test } from "@playwright/test";
/**
* Set language to English for e2e tests.
* E2E tests should only test in English according to requirements.
* This is applied globally via test.beforeEach in the setup file.
*/
test.beforeEach(async ({ context }) => {
// Add init script to set English language before any page loads
// This must be called before any page.goto() calls
await context.addInitScript(() => {
if (typeof window !== "undefined") {
window.localStorage.setItem("arbret-locale", "en");
}
});
});