feat(snapshot): honor --depth=N with landmark nesting#2
Merged
Conversation
The snapshot script now attaches a `path` of landmark ancestors (`main`, `navigation`, `header`, `footer`, `section`, `article`, `aside`, `form`, `dialog`, `list`, `region`, …) to every ref. `toYaml` renders those landmarks as parent nodes and reuses shared prefixes between siblings, producing real aria-tree nesting that matches playwright-cli output. `--depth=N` clips the path: `--depth=1` reproduces the flat v0.2 output, `--depth=2` keeps only the outermost landmark, default is unbounded. `--depth=0` is rejected with a usage error. `Ref.path` is optional in state.json, so older state files without it continue to render flat. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
pathof landmark ancestors (main,navigation,header,footer,section,article,aside,form,dialog,list,region, …) per ref.toYamlrenders landmarks as parent nodes and reuses shared prefixes between sibling refs, producing real aria-tree nesting that matchesplaywright-clioutput.--depth=Nis honored:--depth=1reproduces the flat v0.2 output,--depth=2keeps only the outermost landmark, default (omitted) is unbounded.--depth=0is rejected with a usage error.Ref.pathis optional, so olderstate.jsonfiles from v0.2 keep working and render flat.Example
A page with a primary nav, a signup form inside
<main>, and a footer now renders:bowser snapshot --depth=2clips that to:Test plan
🤖 Generated with Claude Code