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.

  1. Is a session needed at all? Public flows (landing, signup) → skip the plugin.
  2. One user or many? Default one; add more only when actually exercised.
  3. 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.
  4. 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 localStorage via executeScript, or I.setCookie(...)
    • 2FA / OTP — async login; fetch the code from a test mailbox / backdoor before submitting
Installs
110
GitHub Stars
1
First Seen
May 21, 2026
codeceptjs-auth — codeceptjs/skills