mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
test(e2e): pin the shared auth state to an explicit English locale cookie
The server honours User.locale when the locale cookie is absent now, and the locale-switch spec mirrors its German pick into the shared e2e user's profile — every spec running after it rendered German and the English-string assertions failed. The explicit cookie sits at the top of the resolution ladder, keeping each spec context deterministic; locale-switch still overrides it inside its own context.
This commit is contained in:
1 parent
c49734842b
commit
c5eddef31d
1 file changed
+20
@@ -203,6 +203,26 @@ export default async function globalSetup(config: FullConfig): Promise<void> {
|
||||
state.cookies = state.cookies.filter((c) =>
|
||||
["healthlog_session", "healthlog-locale", "hl_onboarding"].includes(c.name),
|
||||
);
|
||||
// v1.27.11 — pin the shared auth state to English via an explicit locale
|
||||
// cookie. The server now honours `User.locale` when the cookie is absent
|
||||
// (the ITP fix), and the locale-switch spec mirrors its German pick into
|
||||
// the SHARED e2e user's profile — without this cookie every spec running
|
||||
// after it would render German and the English-string assertions fail.
|
||||
// The cookie sits at the top of the resolution ladder, so each spec
|
||||
// context stays deterministically English; locale-switch overrides it
|
||||
// inside its own context only.
|
||||
const base = new URL(baseURL);
|
||||
state.cookies = state.cookies.filter((c) => c.name !== "healthlog-locale");
|
||||
state.cookies.push({
|
||||
name: "healthlog-locale",
|
||||
value: "en",
|
||||
domain: base.hostname,
|
||||
path: "/",
|
||||
expires: Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 365,
|
||||
httpOnly: false,
|
||||
secure: false,
|
||||
sameSite: "Lax",
|
||||
});
|
||||
await writeFile(STORAGE_STATE_PATH, JSON.stringify(state, null, 2));
|
||||
await ctx.dispose();
|
||||
console.log(
|
||||
|
||||
Reference in new issue
Block a user