Reference smoke test: send the site origin so the login cookie counts; test typing
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
0c61ac231b
commit
97ee1289aa
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user