feat(e2e): enter TOTP second factor during SPA login #106
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/e2e-totp-handling"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The staging E2E account has 2FA enabled. The bunyip hub redirects to
/login/2faafter a credentials submit; the previousloginViaSpastopped at credentials and let the helper return false-success, so the downstream bearer capture had nothing to grab. This PR drives the second factor end-to-end with a TOTP code generated from a base32 secret.Changes
otplib@12as a dev dep (v13 reworked the API surface entirely; v12 has stableauthenticator.generate(secret)plus deprecation notices that are noise at this scale of consumer).lib/env.ts: new requiredtotpSecretfield readingE2E_TOTP_SECRET(base32, what you originally pasted into your authenticator app). Preflight aggregator includes it.lib/login.ts: after the password submit,waitForURL(/\/login\/(2fa|mfa)/); if matched, generate the current TOTP code, fill the second-factor form (permissive selectors:data-testid="totp",autocomplete="one-time-code",name="code|otp|totp",inputmode="numeric"), click Verify/Continue/Submit./loginregex on the post-login poll AND onexpectAtLoginScreento/^\/login(\/|$)/so/login/2fa,/login/mfa,/login/recoveryetc count as IN/login. Same regex change as PR #105; subsumes it..env.example+README.mddocumentE2E_TOTP_SECRETand the provisioning step.Operator step
Add
E2E_TOTP_SECRETto Forgejo Actions secrets before the next run (the base32 string saved at 2FA enrollment for the E2E account). Preflight will name it explicitly if missing.Test plan
E2E_TOTP_SECRETto Forgejo secrets. Merge. The next E2E run should clear setup (token captured) and auth-ui (URL settles past/login/2fa).locator.waitFor: timeoutonfillTotpStep, and we tighten the selector list.33ca0b98041a9e37e6e1