Skip to content

test(design): add a Playwright layout check for the report stylesheet #7616

Backlog

Description

@devops-cli-service

Split from #4754.

The report stylesheet and template need a live browser check. The check proves no sideways page scroll at 400 px and 1280 px, chart text of 12 px or larger, captions outside the scroll boxes, both themes, and 0 console errors. The check cannot run now: playwright is absent from pyproject.toml and the workspace environment. This part is deferred so the rest of the item can reach Ready. Acceptance criteria: Add playwright to the dev dependencies and install Chromium in the CI job. Add a test in tests/design that renders the sample report to a temporary file and opens it with Playwright Chromium at 400 px and 1280 px, with data-theme set to light and to dark. The test asserts document.documentElement.scrollWidth is at most the viewport width, each computed chart text size is 12 px or larger, each margin note sits beside its text at 1280 px and below it at 400 px, the two themes give different body background colors, and the console shows 0 errors.

Proposed design

Problem statement

The report stylesheet and template have no live browser check. A Playwright test must open the sample report at 400 px and 1280 px in the light and dark themes. The test proves no sideways scroll, chart text of 12 px or larger, margin notes outside the chart scroll boxes, distinct theme backgrounds and zero console errors.

Acceptance criteria

Requirement: Playwright dev dependency

The project MUST declare Playwright in its dev dependency group and lock it.

Scenario: The dev environment imports Playwright

  • WHEN uv sync --all-groups completes
  • THEN uv run python -c "import playwright" exits 0 and prints the Playwright version.

Requirement: Chromium in the design test job

The CI job that runs the design tests SHALL install Chromium for Playwright before the layout test.

Scenario: CI installs Chromium

  • WHEN the CI design job runs uv run playwright install --with-deps chromium
  • THEN the command exits 0 and uv run python -c "from playwright.sync_api import sync_playwright; print('ok')" prints ok.

Requirement: Browser matrix for the sample report

The design test suite SHALL render the sample report to a temporary HTML file and open it in Playwright Chromium at 400 px and 1280 px in the light and dark themes.

Scenario: Four viewport and theme combinations

  • WHEN uv run pytest tests/design/test_report_layout.py runs
  • THEN the test loads the report four times and each page load completes with no navigation error.

Requirement: No sideways page scroll

The report MUST NOT scroll sideways at 400 px or 1280 px in either theme.

Scenario: Document width fits the viewport

  • WHEN the report is open at a viewport width of 400 px or 1280 px in either theme
  • THEN document.documentElement.scrollWidth is at most window.innerWidth.

Requirement: Readable chart text

Each chart text element in the report MUST have a computed font size of at least 12 px.

Scenario: Computed chart text size

  • WHEN the report is open in both themes
  • THEN each computed font-size of the chart text elements is 12 px or larger.

Requirement: Margin note placement and overflow

Each margin note MUST sit outside the chart scroll box, beside its text at 1280 px and below its text at 400 px.

Scenario: Margin note at each width

  • WHEN the report is open at 1280 px and at 400 px in both themes
  • THEN each note's rectangle does not intersect the chart scroll box, is horizontally adjacent at 1280 px, and is below the paragraph at 400 px.

Requirement: Distinct theme backgrounds

The light and dark themes MUST give different body background colors.

Scenario: Theme background colors

  • WHEN the report is open with data-theme="light" and with data-theme="dark"
  • THEN the computed background-color of the body is different for the two themes.

Requirement: No console errors

The report page MUST log zero console errors in each viewport and theme.

Scenario: Console error count

  • WHEN the report is open at 400 px and 1280 px in both themes
  • THEN the captured console error count is 0.

Existing Tool Considered

No alternatives check has run. Playwright is an open, maintained browser automation library that covers the live layout check. It lacks a browser binary and an HTML report renderer. The CI job installs Chromium, and the test renders the sample report with the existing report module.

Key questions

  • Which module renders the sample report for the browser test?: The existing src/devops_cli/design/report.py module renders the sample report to a temporary HTML file. [sources: src/devops_cli/design/report.py, tests/design/test_report_template.py]
  • Where should the browser layout test live?: Add a new tests/design/test_report_layout.py module. (best practice) [sources: tests/design/test_report_css.py, tests/design/test_report_template.py]
    • Chosen: New tests/design/test_report_layout.py. It keeps the slow browser check apart from the CSS and template unit tests.
    • Rejected: Add to tests/design/test_report_css.py. It mixes a browser check with unit tests of the stylesheet.
  • Which open tool covers the live browser layout check?: Use Playwright with Chromium. (best practice) [sources: pyproject.toml, openspec/changes/4745-build-the-docs-site-theme-from/design.md:44]
    • Chosen: Playwright. It is the open browser automation library that the project design names for layout checks.
    • Rejected: A custom browser harness. It copies Playwright and adds code that the project must keep.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/test
    source/agent
    status/new
    value/medium
    effort/medium
    scope/design
    on Nov 28, 2026
  2. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    ContributorAuthor
  3. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/designsource/agentstatus/newtype/testvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions