Skip to content

Support for authenticated flows (cookie/localStorage injection) #25

@gabrielgene

Description

@gabrielgene

Problem

There's currently no way to test flows that require authentication. Many web apps gate features behind login, so expect-cli can only test public pages. The browser opens without any session and the app redirects to login before reaching the target page.

Suggestion

A few possible approaches:

Option A: Cookie/localStorage injection

expect-cli -m "test the dashboard" \
  --cookie "session=abc123" \
  --local-storage '{"auth-token": "{...}"}' \
  -y

Option B: Auth config file

// expect.config.json
{
  "auth": {
    "localStorage": {
      "auth-token": "..."
    }
  }
}

Option C: Setup script

expect-cli -m "test dashboard" --setup ./scripts/inject-auth.sh -y

Environment

  • macOS Darwin 25.3.0 (Apple Silicon)
  • Node 24
  • expect-cli v0.0.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions