Chrome e2e authoring

Use aios-agent-chrome-e2e when someone else needs to create Playwright/Jest end-to-end tests against a signed-in web app. Chrome runs on a remote runner by default. Auth is a vault Playwright storage-state JSON (browser_session), not a UI login form.

Requires StackGen provider >= 0.1.52.

Demo root: examples/scenarios/chrome-e2e.

Session contract (any app)

Input Meaning
base_url App origin
session_cookies or storage_state_json How the browser becomes signed in
signed_in_path Path prefix that means “logged in” for the probe
allowed_domains Chrome allowlist (required when a session secret is bound)

Runner env (same JSON): E2E_BASE_URL, E2E_STORAGE_STATE, E2E_SIGNED_IN_PATH.

Export storage state once:

playwright codegen --save-storage=state.json https://app.example.com

Workflow

  1. probe-session — open target_url; classify SESSION_SIGNED_IN / SESSION_REJECTED / SESSION_NOT_APPLIED
  2. session-gate — stop unless signed in
  3. explore-flow — walk the flow in Chrome; record selectors
  4. write-test — Playwright + Jest spec that loads E2E_STORAGE_STATE
  5. run-test / fix-loop — run only the new file; fix up to the iteration cap
  6. open-pr — gh pr create --draft on the runner

Skills publish at apply via sg_skill (no separate skillsync).

Hand-written specs

Reuse the helper in skill chrome-e2e-playwright-login-helper: open a context with storageState: JSON.parse(process.env.E2E_STORAGE_STATE). Fail if the page bounces to /login, /auth/, or /oauth.

StackGen session (one preset)

session_preset  = "stackgen"
base_url        = var.stackgen_url
stackgen_token  = var.stackgen_token
stackgen_org_id = var.stackgen_project_id

Builds a Playwright session from the StackGen UI session cookie (API token) and optional persistedTenantId. See terraform.tfvars.stackgen.example. Runner env gets E2E_STORAGE_STATE (not a separate API token).

Troubleshooting

  • Chrome exits immediately → missing MCP_CHROME_ALLOWED_DOMAINS / allowed_domains
  • No tools for several minutes → cold image pull; refresh tools
  • evaluate_script waits for approval → expected (signed-in JS is HITL-gated)
  • Login page + marker → SESSION_REJECTED; login page without marker → SESSION_NOT_APPLIED
  • Specs missing E2E_* → start the runner with secrets sync (cli_start_command_with_secrets)