Skip to content

Add E2E tests #7

@cv

Description

@cv

Summary

Add end-to-end tests that exercise the full surf CLI against a real Chrome browser instance.

Background

PR #2 added the testing infrastructure with vitest. The test/e2e/ directory exists but is empty.

Scope

E2E tests should cover real browser automation scenarios:

Navigation & Reading

  • surf go → navigate to URL, verify page loaded
  • surf read → verify accessibility tree extraction
  • surf page.text → verify text content extraction
  • surf back / surf forward → history navigation

Interaction

  • surf click → click elements by ref, selector, coordinates
  • surf type → text input with/without submit
  • surf scroll.* → scroll operations
  • surf key → keyboard input

Screenshots

  • surf screenshot → verify image output
  • surf screenshot --annotate → verify element labels
  • surf screenshot --fullpage → full page capture

Tabs

  • surf tab.new / surf tab.close / surf tab.switch
  • surf tab.name / surf tab.switch <name>

Network Capture

  • Verify requests are captured during navigation
  • surf network filtering options
  • surf network.get / surf network.body / surf network.curl

AI Queries (optional/manual)

  • surf chatgpt, surf gemini, surf perplexity
  • These require logged-in sessions, may need to be manual or skipped in CI

Technical Considerations

  • Need a strategy for launching/managing Chrome instances
  • Consider using a local test server for predictable test pages
  • May need longer timeouts for browser operations
  • Some tests may be flaky due to timing—add retries where appropriate

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions