test and expect
Re-exports from Playwright with the users fixture pre-installed:
storageState per account, so each test account signs in once per machine - not once per test.
Requires baseURL in tests/playwright.config.ts. The scaffold sets this; tests error with users fixture requires a baseURL if it’s missing.
users(N | string[], options?) - the fixture
Escape hatches
When the fixture is too high-level, import the underlying helpers directly:| Helper | Signature |
|---|---|
loadAllTestAccounts() | () => TestAccount[] - every cached account (sync) |
pickTestAccounts(n, opts?) | (n: number, opts?: { label?: string }) => TestAccount[] (sync); throws if not enough accounts |
findTestAccountByName(name) | (name: string) => TestAccount (sync); throws if not found |
ensureStorageState(browser, account, baseURL, options?) | Sign in once and return the cached storageState path |
newSignedInContext(browser, account, baseURL, options?) | One-liner for a signed-in BrowserContext |
getStatePathForEmail(email) | Direct cache-path lookup for an email |
readCachedState(email) | Direct cache read by email |
~/.deepspace/test-accounts.json synchronously - they don’t return promises.
TestAccount
~/.deepspace/test-accounts.json, populated by npx deepspace test-accounts create. createdAt is a numeric epoch millisecond timestamp, not an ISO string.
EnsureStorageStateOptions
ensureStorageState / newSignedInContext signatures
browser is always the first argument, then the account record, then baseURL, then options.
Patterns
Multiplayer test
Reusing a signed-in context outside the fixture
See also
- Testing guide - full workflow, test extension checklist, debugging
- CLI test command - runner flags
- CLI test-accounts command - provisioning the account pool