codeceptjs-auth
Installation
SKILL.md
CodeceptJS Auth Plugin
The auth plugin logs each user in once, captures cookies (or localStorage/token via overrides), and restores the session for subsequent tests. Stale sessions trigger a fresh login automatically.
If the project already has auth configured (fundamentals' discovery output), reuse its existing inject name and user keys — don't reconfigure.
Decide first — ask the user
Four answers shape the plugin. Don't guess any.
- Is a session needed at all? Public flows (landing, signup) → skip the plugin.
- One user or many? Default one; add more only when actually exercised.
- If many — what splits them? Role, workspace/tenant, plan tier, sign-in provider, per-test fixture — real systems vary. Ask; use the answer to name
users.<key>entries. - What's the auth type?
- Form — default; canonical shape below
- OAuth / SSO — click provider button, drive the IdP page (often separate origin)
- Magic link / passwordless — UI flow rarely worth automating; prefer an API mint or reading the link from a test mailbox
- API token — skip the form; write the token into
localStorageviaexecuteScript, orI.setCookie(...) - 2FA / OTP — async
login; fetch the code from a test mailbox / backdoor before submitting