Skip to content
This repository was archived by the owner on Feb 1, 2026. It is now read-only.
This repository was archived by the owner on Feb 1, 2026. It is now read-only.

task(docs): evaluate Heroshot as replacement for custom screenshot generator #347

Description

@gander

Context

Issue #301 requires capturing multi-step form screenshots with realistic data, which will increase complexity in the current custom Playwright script (scripts/generate-screenshots.ts).

@omachala suggested Heroshot as a more maintainable alternative that externalizes screenshot configuration into YAML/JSON instead of hardcoded TypeScript.

Objective

Evaluate Heroshot's feasibility as a replacement for the current screenshot generation script by:

  1. Analyzing feature parity with current implementation
  2. Testing ease of implementation for our use cases
  3. Identifying implementation steps and effort required
  4. Making a recommendation (keep custom script vs. migrate to Heroshot)

Current Implementation Analysis

Current script: scripts/generate-screenshots.ts

  • Uses Playwright directly
  • Hardcoded interactions in TypeScript
  • Captures 11 screenshots (1024x768 viewport)
  • Automatically starts/stops backend and frontend servers
  • Manual form filling logic for test data

Pain points:

  • Adding new scenarios requires TypeScript code changes
  • Multi-step form interactions need complex Playwright logic
  • No built-in light/dark mode support
  • Manual viewport management

Heroshot Capabilities

Based on documentation review:

Core Features:

  • Visual Picker: Initial setup through UI (no manual config writing)
  • Config-based: All screenshots defined in .heroshot/config.json
  • Actions API: Pre-built actions for form interactions (click, type, fill_form, wait, etc.)
  • Multi-viewport: Desktop/tablet/mobile presets + custom dimensions
  • Theme Support: Automatic light/dark mode variants (screenshot-light.png, screenshot-dark.png)
  • CI/CD Ready: GitHub Actions integration with encrypted session storage
  • Framework Integration: Vue component for rendering screenshots in docs

Actions API Relevant to Our Use Case:

{
  "actions": [
    {"type": "click", "selector": ".next-button"},
    {"type": "type", "selector": "input[name='url']", "text": "https://example.com"},
    {"type": "fill_form", "fields": [
      {"selector": "#projectName", "value": "My Project"},
      {"selector": "#description", "value": "Test description"}
    ]},
    {"type": "wait", "time": 500}
  ]
}

Vue Integration:

<script setup>
import { Heroshot } from 'heroshot/vue';
</script>
<template>
  <Heroshot name="dashboard" alt="Dashboard view" />
</template>

Implementation Steps (Proposed)

Phase 1: Proof of Concept

  1. Install Heroshot

    npm install heroshot --save-dev
  2. Create initial config for 1-2 existing screenshots

    npx heroshot config
    • Test capturing dashboard and project list views
    • Verify output matches current screenshots
  3. Test multi-step form (the main challenge)

    • Configure actions for ProjectForm wizard:
      • Step 1: Fill basic info + click Next
      • Step 2: Fill crawl settings + click Next
      • Step 3: Fill run profile + capture
    • Compare ease vs. current Playwright code

Phase 2: Full Migration

  1. Port all 11 screenshots to Heroshot config
  2. Handle server startup/shutdown
    • Keep npm script wrapper or integrate into Heroshot workflow
    • May still need custom logic for backend/frontend coordination
  3. Update documentation
    • docs/screenshots/README.md
    • docs/guides/frontend-dev.md#screenshot-updates
  4. Remove old script (scripts/generate-screenshots.ts)

Phase 3: Enhancements (Optional)

  1. Add Vue component for rendering screenshots in docs
  2. CI/CD integration for automated screenshot updates on deploy
  3. Light/dark mode variants (currently we only have light mode)

Evaluation Criteria

Criterion Current Script Heroshot Winner
Ease of adding screenshots TypeScript code JSON config + visual picker ?
Multi-step form handling Custom Playwright Actions API (click, type, wait) ?
Server lifecycle Built-in (auto start/stop) Requires external script ?
Maintainability Code changes for new scenarios Config changes only ?
Theme support Manual (single theme) Automatic light/dark Heroshot ✅
Documentation integration Manual image links Vue component + auto-switching Heroshot ✅
Learning curve Playwright knowledge Heroshot config format ?

Questions to Answer During Evaluation

  1. Form interaction complexity: Can Heroshot's Actions API handle our 3-step wizard reliably?
  2. Server coordination: How do we integrate backend/frontend startup with Heroshot workflow?
  3. Test data: How do we inject realistic form data (currently hardcoded in TS)?
  4. Migration effort: Is the migration justified vs. extending current script?
  5. Long-term maintenance: Will Heroshot reduce ongoing screenshot maintenance burden?

Implementation Suggestions

If migrating to Heroshot:

  1. Keep server startup script separately

    // package.json
    {
      "scripts": {
        "screenshots": "npm run screenshots:servers && npx heroshot",
        "screenshots:servers": "node scripts/start-servers.js"
      }
    }
  2. Example config for multi-step form

    {
      "outputDirectory": "docs/screenshots",
      "browser": {
        "viewport": {"width": 1024, "height": 768}
      },
      "screenshots": [
        {
          "name": "03-project-create-step1",
          "url": "http://localhost:5173/projects/new",
          "actions": [
            {"type": "type", "selector": "#projectName", "text": "My Website Upgrade"},
            {"type": "type", "selector": "#websiteUrl", "text": "https://example.com"},
            {"type": "type", "selector": "#description", "text": "Testing framework upgrade"},
            {"type": "wait", "time": 200}
          ]
        },
        {
          "name": "03-project-create-step2",
          "url": "http://localhost:5173/projects/new",
          "actions": [
            {"type": "type", "selector": "#projectName", "text": "My Website Upgrade"},
            {"type": "click", "selector": ".next-button"},
            {"type": "wait", "time": 300},
            {"type": "click", "selector": "#crawlEnabled"},
            {"type": "type", "selector": "#maxPages", "text": "50"},
            {"type": "wait", "time": 200}
          ]
        }
      ]
    }
  3. Vue component integration (optional enhancement)

    <!-- In documentation or README -->
    <Heroshot name="dashboard" alt="Dashboard view" />

Acceptance Criteria

  • Heroshot installed and tested with 1-2 screenshots
  • Multi-step form (ProjectForm) successfully captured with Actions API
  • Evaluation document created comparing current vs. Heroshot approach
  • Decision made: migrate to Heroshot OR keep custom script with rationale
  • If migrating: implementation plan finalized with effort estimate
  • If keeping custom script: documented why Heroshot doesn't fit use case

Related Documentation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or requestfrontendFrontend-related code (Vue.js, TypeScript, UI components)size/mediumMedium effort: 2-4 hours of work

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions