storageState. No proprietary workarounds, no vendor lock-in, no jumping through hoops like you would with other no-code testing tools.
How It Works
Playwright’sstorageState captures cookies and local storage from the browser after login. You save this to a JSON file, then tell your tests to load it — skipping the login UI entirely.
The flow is simple:
- Run a setup step that logs in and saves the browser state to a file
- All other tests load that saved state and start already authenticated
In the Web Editor (Agent Sessions)
In Stably’s Web Editor, you don’t need to write any code. Just tell the AI what you want.Save authenticated state after login
When creating or editing a test in the Web Editor, simply prompt the AI agent:
“Log in with the test account credentials, then save the authenticated state to playwright/.auth/user.json”
The AI agent will generate the appropriate Playwright storageState call for you.
Reuse saved state in other tests
For subsequent tests that need to be authenticated, prompt the AI:
“Use the saved auth state from playwright/.auth/user.json so I don’t have to log in again”
The agent will add the correct test.use({ storageState: ... }) configuration.
In the CLI
The same approach works in the Stably CLI. Just describe what you need in your prompt.Interactive mode
“Create an auth setup that logs into my app at https://myapp.com/login with the test credentials, and saves the storage state for reuse”The agent will generate a Playwright setup project with
storageState.
One-shot mode
What the Generated Code Looks Like
For reference, here’s what the AI agent generates under the hood. This is standard Playwright code — nothing proprietary.Auth setup (runs once)
auth.setup.ts
Tests that reuse the state
dashboard.spec.ts
Playwright config with setup project
playwright.config.ts
Multiple Accounts
Need different roles (admin, regular user, viewer)? Save separate state files:“Set up auth for two roles: an admin and a regular user. Save each to separate state files and create tests that use the correct role.”
Tips
Add playwright/.auth to .gitignore
Add playwright/.auth to .gitignore
The saved state files contain session tokens. Don’t commit them:
.gitignore
Store credentials securely
Store credentials securely
Use Stably Environments to store test credentials as secret variables rather than hardcoding them. In the CLI, pass them via environment variables.
Handle token expiry
Handle token expiry
If your auth tokens expire quickly, the setup project runs fresh on each
npx playwright test invocation — so state is always current. For long-lived CI runs, consider adding a TTL check or forcing a fresh login.Combine with Google SSO
Combine with Google SSO
If your app uses Google login, combine
storageState with Stably’s authWithGoogle helper to save authenticated Google sessions.Why This Is Easier Than Other Tools
| Stably | Typical no-code tools | |
|---|---|---|
| Auth mechanism | Standard Playwright storageState | Proprietary cookie injection or replay |
| Setup | Tell the AI agent in plain English | Configure through vendor-specific UI |
| Multiple roles | Separate state files, standard Playwright | Often requires per-role configuration in dashboard |
| Portability | Pure Playwright — works anywhere | Locked to the vendor’s runtime |
| Debugging | Read the generated .json state file | Black box |