Add scenario YAML loader and docgen record command for Playwright workflows#26
Open
Add scenario YAML loader and docgen record command for Playwright workflows#26
Conversation
…kflows Implements the core data model from issue #17: - New module: scenario.py — loads/saves YAML scenario files with AppConfig and ScenarioStep dataclasses. Each step defines narration, browser actions (act), and verification assertions (verify) declaratively. - New CLI command: docgen record --scenario <path> [--out <dir>] [--print-outline] Loads a scenario YAML and displays the recording plan. Full browser recording pipeline depends on a running application at the configured base_url. - Scenario YAML format: - app: name, base_url, viewport, ready_selector, ready_wait_ms - steps: id, narration, browser, demo, visual_type, act, verify - Supported act commands: click, check, hover, fill, wait, drag_rectangle - Supported verify commands: expect_visible, expect_text, expect_value - Data model supports: - demo_steps / browser_steps filtered views - get_step(id) lookup - outline() for human-readable preview - Round-trip save/load preserving all fields - Clean YAML output (omits default values) - 22 new tests covering load, save, properties, roundtrip, and edge cases (110 total tests passing) Closes #17 Co-authored-by: John Menke <jmjava@gmail.com>
3836c2e to
44a9859
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the core data model and CLI entry point from issue #17. It provides the foundation for YAML-driven Playwright recording workflows where applications define their demo in a
scenario.ymlfile — no Python code needed.What's implemented
Scenario YAML format — a declarative way to define demo recordings:
New module:
scenario.pyAppConfigdataclass: app name, base_url, viewport, ready_selectorScenarioStepdataclass: id, narration, browser, demo, visual_type, act, verifyScenariodataclass: filtered views (demo_steps, browser_steps), step lookup, outlineload_scenario()/save_scenario(): YAML round-trip with clean output (omits defaults)New CLI command:
docgen recordWhat stays for follow-up
The full recording pipeline (TTS per segment, Playwright browser recording paced to audio, ffmpeg compose) and the admin UI (
docgen adminwith segment CRUD API and HTML editor) are larger features that build on this data model foundation.Integration with docgen.yaml
New files
src/docgen/scenario.pytests/test_scenario.pyTesting
pytest tests/ --ignore=tests/e2e)ruff check src/ tests/— all checks passedCloses #17