Goal
Allow measuring pages that require authentication by passing a Playwright storage state file (cookies + localStorage), using Playwright's own native format.
Usage
# Step 1 — capture auth state with Playwright codegen
npx playwright codegen --save-storage=auth.json https://example.com/login
# Step 2 — measure an authenticated page
npx webperf-snippets https://example.com/dashboard --storage-state auth.json
Implementation
One-line change in cli/src/runner.js:
// before
const context = await browser.newContext({ viewport });
// after
const context = await browser.newContext({ viewport, storageState: opts.storageState });
Files
cli/src/runner.js — pass storageState to newContext()
cli/src/bin.js — expose --storage-state <path> flag
Acceptance criteria
Goal
Allow measuring pages that require authentication by passing a Playwright storage state file (cookies + localStorage), using Playwright's own native format.
Usage
Implementation
One-line change in
cli/src/runner.js:Files
cli/src/runner.js— passstorageStatetonewContext()cli/src/bin.js— expose--storage-state <path>flagAcceptance criteria
--storage-state <path>restores session before navigation