mix live_capture.gen.schema (live_capture v0.2.9)

View Source

Generates a JSON schema for capture modules

This is useful for automated visual regression testing with Playwright.

Usage

mix live_capture.gen.schema --module MyAppWeb.LiveCapture --url-prefix /storybook path/to/captures.json

Tip: pass multiple modules by duplicating --module switches

--url-prefix should match the scope of mounted live_capture routes

Skip path to print schema to stdout.

Output Format

captures.json

[
  {
    "schema": "MyAppWeb.LiveCapture",
    "breakpoints": [
      {"name": "s", "width": "480px"},
      {"name": "m", "width": "768px"}
    ],
    "captures": [
      {"module": "MyAppWeb.Example", "function": "simple", "variant": null, "url": "/storybook/raw/components/Example/button"},
      {"module": "MyAppWeb.Example", "function": "with_capture_variants", "variant": "main", "url": "/storybook/raw/components/Example/button/main"},
      {"module": "MyAppWeb.Example", "function": "with_capture_variants", "variant": "secondary", "url": "/storybook/raw/components/Example/button/secondary"}
    ]
  }
]