M1: the reference e2e suite follows the stored 2FA verify count

The verify count now survives a restart of the site, so the specs can no longer
share one test admin across server runs: create-test-admin.ts makes two test
admins and clears their stored counts; the setup spec signs in as the second.
The whole suite passes in one run (20 passed, 1 skipped).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 00:39:23 +01:00
co-authored by Claude Fable 5.2
parent 83356ab4ed
commit 81cee02e78
6 changed files with 32 additions and 55 deletions
+3 -2
View File
@@ -1,6 +1,6 @@
import { type APIRequestContext, expect, type Page, test } from '@playwright/test'
import { totp } from './totp'
import { secondTestAdmin, totp } from './totp'
/**
* "2FA setup required" in a real browser: an account that has not set two-step verification up sees only the setup
@@ -17,7 +17,8 @@ const EDITOR = { email: `e2e-editor-${stamp}@example.com`, password: `editor-${s
/** The admin the later tests act as: the owner made in the first test, else the smoke-test admin. */
let admin: { email: string; password: string; secret: string } | null =
process.env.E2E_ADMIN_EMAIL && process.env.E2E_ADMIN_PASSWORD && process.env.E2E_TOTP_SECRET
? { email: process.env.E2E_ADMIN_EMAIL, password: process.env.E2E_ADMIN_PASSWORD, secret: process.env.E2E_TOTP_SECRET }
? // the second test admin: the other specs spend the first one's verify attempts (5 per account in 10 minutes)
{ email: secondTestAdmin(process.env.E2E_ADMIN_EMAIL), password: process.env.E2E_ADMIN_PASSWORD, secret: process.env.E2E_TOTP_SECRET }
: null
let editorId: string | undefined