test(e2e): isolate administrator roles and locale between journeys

This commit is contained in:
cesnimda
2026-10-21 07:21:29 +02:00
parent dda1687345
commit b39a5af4de
10 changed files with 260 additions and 13 deletions
@@ -21,7 +21,9 @@ async function login(records: RequestRecord[], api: APIRequestContext, email: st
expect((await call(records, api, 'POST', '/auth/login', undefined, { email, password })).status()).toBe(200);
const me = await json<{ id: string; sessionContext: string }>(await call(records, api, 'GET', '/auth/me'));
const token = (await api.storageState()).cookies.find(value => value.name === 'XSRF-TOKEN'); expect(token).toBeDefined();
return { id: me.id, email, headers: { 'X-CSRF-TOKEN': token!.value, 'X-Session-Context': me.sessionContext } };
const headers = { 'X-CSRF-TOKEN': token!.value, 'X-Session-Context': me.sessionContext };
if (email === 'e2e@example.test') expect((await call(records, api, 'PUT', '/auth/preferences/language', headers, { language: 'en' })).status()).toBe(204);
return { id: me.id, email, headers };
}
async function createOwner(records: RequestRecord[], admin: APIRequestContext, headers: Headers) {
const email = `p710-audit-${Date.now()}-${Math.random().toString(36).slice(2)}@example.test`;