Skip to main content
Running the full login flow for every test hits auth provider rate limits and wastes time. Wrap it in a module, enable caching, and Momentic reuses the saved browser state across runs.

Setup

  1. Extract your login steps into a Module. The last step should verify the authenticated state (e.g. a Page check for the dashboard URL).
  2. In the module config, enable Caching globally and Treat as auth module.
  3. Set a Default cache key (e.g. admin-user). Parallel tests sharing the key reuse the same cached session.
  4. Set a Default expiry seconds shorter than your session lifetime.
  5. Remove any manual Save auth state / Load auth state steps. Momentic handles this automatically.
Use different cache keys for different user roles (e.g. admin, member) so tests don’t leak state into each other.

How it works

Momentic captures cookies, localStorage, and IndexedDB when the module finishes. On subsequent runs within the expiry window, it restores that state and skips the module’s steps.