diff --git a/reference/e2e/smoke.spec.ts b/reference/e2e/smoke.spec.ts index 6ca2330..7a00fcd 100644 --- a/reference/e2e/smoke.spec.ts +++ b/reference/e2e/smoke.spec.ts @@ -225,7 +225,9 @@ test('admin: sign in through 2FA, agency credit, panel link preview', async ({ p test('API: a staff password without the 2FA code opens nothing; with the code it does', async ({ playwright, baseURL }) => { const { E2E_ADMIN_EMAIL: email, E2E_ADMIN_PASSWORD: password, E2E_TOTP_SECRET: secret } = process.env test.skip(!email || !password || !secret, 'E2E_* test admin not configured') - const api = await playwright.request.newContext({ baseURL }) // its own cookie jar + // Its own cookie jar. Payload takes the login cookie only from the site's own origin (csrf), so say where we are: + // without `Origin` these requests would count as anonymous and prove nothing. + const api = await playwright.request.newContext({ baseURL, extraHTTPHeaders: { origin: baseURL! } }) const login = await api.post('/api/users/login', { data: { email, password } }) expect(login.status()).toBe(200)