Skip to content

feat(website): add test inventory page#67

Draft
ian-flores wants to merge 5 commits intomainfrom
test-inventory
Draft

feat(website): add test inventory page#67
ian-flores wants to merge 5 commits intomainfrom
test-inventory

Conversation

@ian-flores
Copy link
Collaborator

Summary

  • Add src/vip/gherkin.py — shared Gherkin feature file parser (no external deps)
  • Add scripts/generate-test-catalog.py — walks tests/ and outputs website/src/data/test-catalog.json
  • Add website/src/pages/tests.astro — browsable test inventory with progressive disclosure (<details>/<summary>)
  • "Start here" callout pointing to Prerequisites category
  • Sidebar TOC with scenario counts per category
  • CI: website rebuild triggers on tests/**/*.feature changes, generates catalog at build time via uv
  • Add just website-data recipe

Closes #54, closes #53

Test plan

  • just website-data generates valid JSON with 7 categories, 24 features
  • cd website && npm ci && npm run build succeeds with 3 pages
  • Tests page shows all categories with expandable features and scenarios
  • Navigation header includes "Tests" link

Copilot AI review requested due to automatic review settings March 11, 2026 22:44
@github-actions
Copy link

github-actions bot commented Mar 11, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://posit-dev.github.io/vip/pr-preview/pr-67/

Built to branch gh-pages at 2026-03-12 01:14 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an auto-generated test catalog (from tests/**/*.feature) and a new website page that renders a browsable inventory of features/scenarios to help users understand and navigate the VIP test suite.

Changes:

  • Add a lightweight Gherkin .feature parser and a generator script to produce website/src/data/test-catalog.json.
  • Add a new /tests/ Astro page to browse categories, features, scenarios, and steps with progressive disclosure.
  • Update website navigation and Pages workflow to generate the catalog during the deploy build.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
website/src/pages/tests.astro New Test Inventory page rendering the generated catalog with TOC + details/summary disclosure UI.
website/src/components/Header.astro Adds a “Tests” link to the site header nav.
src/vip/gherkin.py New internal parser for .feature files (no external deps).
scripts/generate-test-catalog.py New generator that walks tests/ and emits the website catalog JSON.
website/src/data/.gitkeep Keeps website/src/data/ present in git while the JSON is generated/ignored.
justfile Adds just website-data to generate the catalog locally.
.gitignore Ignores the generated website/src/data/test-catalog.json.
.github/workflows/website.yml Rebuilds/deploys the website when .feature/generator/parser change; generates catalog before Astro build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

from pathlib import Path

# Keywords that terminate the feature description block.
_KEYWORDS = frozenset(["Scenario:", "Scenario Outline:", "Background:", "Rule:", "Examples:", "@"])
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_KEYWORDS includes "@", but tag lines are already handled earlier with if line.startswith("@"): and continue, so this entry can never influence description termination. Consider removing "@" from _KEYWORDS (or reordering logic) to avoid dead/ misleading configuration.

Suggested change
_KEYWORDS = frozenset(["Scenario:", "Scenario Outline:", "Background:", "Rule:", "Examples:", "@"])
_KEYWORDS = frozenset(["Scenario:", "Scenario Outline:", "Background:", "Rule:", "Examples:"])

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +35
def parse_feature_file(path: Path, *, relative_to: Path | None = None) -> dict:
"""Parse a ``.feature`` file and return a structured dict.

Parameters
----------
path:
Absolute or relative path to the ``.feature`` file.
relative_to:
If provided, ``file`` in the returned dict is set relative to this
directory. Otherwise the path is returned as-is.

Returns
-------
dict with keys: ``title``, ``description``, ``marker``, ``file``,
``scenarios`` (list of dicts with ``title`` and ``steps``).
"""
text = path.read_text(encoding="utf-8")
lines = text.splitlines()
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parse_feature_file is new parsing logic that feeds a generated site artifact; there are existing selftests/ for other vip modules, but no unit tests added for this parser. Please add focused tests that cover at least: extracting the first @tag as marker, capturing the Feature title, collecting description lines up to the first Scenario, and collecting scenario titles + step lines.

Copilot uses AI. Check for mistakes.
}

output.parent.mkdir(parents=True, exist_ok=True)
output.write_text(json.dumps(catalog, indent=2) + "\n")
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output.write_text(...) relies on the platform default encoding, which can produce non-UTF8 JSON on some systems. Since the website consumes this file, write it explicitly with encoding="utf-8" (matching the parser’s read path).

Suggested change
output.write_text(json.dumps(catalog, indent=2) + "\n")
output.write_text(json.dumps(catalog, indent=2) + "\n", encoding="utf-8")

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +30
- uses: astral-sh/setup-uv@v5

Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow runs uv run python ... without setting up a cached/synced environment. Elsewhere in this repo (e.g. .github/workflows/ci.yml) setup-uv is configured with enable-cache: true and followed by uv sync before uv run. Consider enabling uv caching here and running a uv sync/uv sync --frozen step before generating the catalog to make the build faster and more reproducible.

Suggested change
- uses: astral-sh/setup-uv@v5
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Sync Python dependencies
run: uv sync --frozen

Copilot uses AI. Check for mistakes.
- Remove dead "@" from _KEYWORDS in gherkin parser
- Use encoding="utf-8" in catalog JSON write
- Enable uv cache and add uv sync --frozen in website.yml
The report and website previews both use rossjrw/pr-preview-action
which posts a sticky comment. Without distinct comment-tag values,
one overwrites the other. Now each preview gets its own PR comment.
rossjrw/pr-preview-action doesn't support comment-tag, so both
previews shared the same sticky comment and one overwrote the other.
Disable the built-in comment on the website preview and use
marocchino/sticky-pull-request-comment directly with a distinct header.
@github-actions
Copy link

Website Preview · View preview

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

we need an inventory view of the suite of available tests on the vip site We need descriptions for each test case

2 participants