R4-3: pnpm e2e:built (webpack and Turbopack); Playwright runs reset the test admins first
The command builds the reference site with both bundlers, checks the public files for a package manifest and runs the late-staff spec and the published-files check against each built site. A global setup resets the test admins and their stored 2FA attempt counts before every run, so a spec no longer depends on what ran before it. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
9a648b0498
commit
e77c607bca
@@ -0,0 +1,14 @@
|
||||
import { execFileSync } from 'node:child_process'
|
||||
|
||||
/**
|
||||
* Before every Playwright run: the test admins are made (or reset) and their stored 2FA attempt counts cleared
|
||||
* (e2e/create-test-admin.ts). The count is kept in the database — 5 verify attempts per account in 10 minutes —
|
||||
* so without this a second run within ten minutes, or one spec run after the whole suite, would find the test
|
||||
* admin locked out: the result would depend on what ran before. Skipped when the test admin is not configured
|
||||
* (the specs that need it skip themselves) or with E2E_SKIP_ADMIN_SETUP=1.
|
||||
*/
|
||||
export default function globalSetup(): void {
|
||||
const { E2E_ADMIN_EMAIL, E2E_ADMIN_PASSWORD, E2E_SKIP_ADMIN_SETUP, E2E_TOTP_SECRET } = process.env
|
||||
if (E2E_SKIP_ADMIN_SETUP === '1' || !E2E_ADMIN_EMAIL || !E2E_ADMIN_PASSWORD || !E2E_TOTP_SECRET) {return}
|
||||
execFileSync('pnpm', ['payload', 'run', 'e2e/create-test-admin.ts'], { env: { ...process.env, NODE_ENV: 'development' }, stdio: 'inherit' })
|
||||
}
|
||||
Reference in New Issue
Block a user