Skip to content

test(RunResults): stage 3 — Cypress component tests for run-status pill - #698

Open
emilmilanov wants to merge 1 commit into
runresults-runstatus-componentfrom
runresults-runstatus-tests
Open

test(RunResults): stage 3 — Cypress component tests for run-status pill#698
emilmilanov wants to merge 1 commit into
runresults-runstatus-componentfrom
runresults-runstatus-tests

Conversation

@emilmilanov

@emilmilanov emilmilanov commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Problem and goal

Stage 3 of the RunResults run-status pill work. Stacks on top of #696 — extends the shared assertions.ts with a full test suite for the new run-status pill (56 tests total per framework, up from the previous 40).

Every test in the shared module runs against BOTH React and Vue, so DOM parity between frameworks is enforced by construction — if one framework's rendering diverges from the other, its spec fails. This addresses the "silent drift risk" suggestion from the code review on #696.

What's tested

Shared (React + Vue via assertions.ts)

  • Presence and segments — pill absent without runStatus; renders BEFORE the test-counts pill in DOM order (contract lock); #N + status icon always; branch segment only when branch is set; divider only present with a second segment; long branch truncation at 260px.
  • Link vs unlinked#N is <a> when href set / <span> otherwise; branch is ALWAYS <span> (regression guard for the branchHref removal in commit 8408c052).
  • Variantsbase has no hover:after:shadow-*; link carries the status-colored hover border class; both variants render the same neutral gray-100 resting ::after shadow (regression guard for the design-review change in 3b0b5c08).
  • Status colors — sample one status per palette bucket (jade / red / indigo / gray / orange) to lock in `RUN_STATUS_TEXT_CLASSES` and `RUN_STATUS_BORDER_CLASSES` without exhaustive repetition.
  • Themes — light bg-gray-50 + gray-100 border shadow; dark bg-gray-950 + gray-800 border shadow; branch text color inverts per theme.
  • Runtime guard — invalid status → no wrapper when test-counts also empty; invalid status + counts → wrapper renders without the pill; `console.warn` fires. Uses the global console.warn spy in `cypress/support/component.ts` and resets its history in afterEach so the global callCount(0) check still passes.
  • data-cy contract — `run-status`, `run-status-build-number`, `run-status-icon`, `run-status-branch`, `run-status-branch-icon`.
  • Spacing — 8px segment padding-left, 0px right on the divider-hosting segment (via `runStatusSegmentDividerAdjacent`), 8px branch padding, 8px inter-pill gap.
  • Percy — link/passed light, link/failed dark, and a combined pill row (run-status + branch + test counts).

Framework-specific (in each cy.tsx spec)

  • `renderLink also wraps the run-status #N segment` — verifies the same callback is used for both pills. Kept per-framework because React expects a `ReactNode` and Vue expects a `VNode` — no way to share the JSX in `assertions.ts`.

Mount helper updates

All four spec files (React + Vue × regular + a11y) now thread the `runStatus` prop through their `mountStory` helper so stage 4 can build on the same wiring.

Verification

  • `yarn cy:run --spec 'components/RunResults/react/RunResultsReact.cy.tsx'` → 56 passing / 0 failing
  • `yarn cy:run --spec 'components/RunResults/vue/RunResultsVue.cy.tsx'` → 56 passing / 0 failing

Test plan

  • CI runs both React and Vue specs green.
  • Percy diffs (if enabled on the branch) look like the expected pills.

Stacks on #696. Stage 4 (`runresults-runstatus-accessibility`) will stack on this.

🤖 Generated with Claude Code


Note

Low Risk
Test-only changes to Cypress specs and shared assertions; no runtime or API behavior is modified in this diff.

Overview
Adds stage 3 component-test coverage for the RunResults run-status pill, with no production code changes.

Shared assertions.ts gains a large run-status pill suite that runs for both React and Vue: presence/DOM order before test counts, optional branch segment and divider, link vs span rules (including branch never linkable), base vs link variants, status color tokens, light/dark theming, invalid-status skip + console.warn (with spy reset in afterEach), data-cy selectors, spacing, and Percy snapshots.

All four mountStory helpers now pass runStatus so shared and a11y specs can exercise the pill.

React and Vue specs each add one test that renderLink wraps the run-status #N segment (with forwarded className), since that JSX cannot live in the shared module.

Reviewed by Cursor Bugbot for commit 5f9f6a5. Bugbot is set up for automated code reviews on this repo. Configure here.

Extends the shared `assertions.ts` with a `run-status pill` describe
block covering everything the pill can do, plus framework-specific
`renderLink` integration tests in each cy.tsx spec. Both mount helpers
(regular + a11y) now thread the `runStatus` prop through so stage 4 can
build on the same wiring.

Coverage in the shared module (runs against BOTH React and Vue —
enforces DOM parity):

- **Presence and segments** — pill absent without `runStatus`; renders
  BEFORE the test-counts pill in DOM order (contract lock); `#N` +
  status icon always; branch segment only when `branch` is set;
  divider only present with a second segment; long branch truncation
  at 260px.
- **Link vs unlinked** — `#N` is `<a>` when `href` set / `<span>`
  otherwise; branch is ALWAYS `<span>` (regression guard for the
  `branchHref` removal in commit 8408c05).
- **Variants** — `base` has no hover:after:shadow-*; `link` carries
  the status-colored hover border class; both variants render the
  same neutral gray-100 resting `::after` shadow (regression guard
  for the design-review change in commit 3b0b5c0).
- **Status colors** — sample one status per palette bucket (jade /
  red / indigo / gray / orange) to lock in `RUN_STATUS_TEXT_CLASSES`
  and `RUN_STATUS_BORDER_CLASSES` without exhaustively repeating for
  each of the 8 statuses.
- **Themes** — light `bg-gray-50` + gray-100 border shadow; dark
  `bg-gray-950` + gray-800 border shadow; branch text color inverts
  per theme.
- **Runtime guard** — invalid status → no wrapper when test-counts
  also empty; invalid status + counts → wrapper renders without the
  pill; `console.warn` fires. Uses the global `console.warn` spy from
  cypress/support/component.ts and resets its history in afterEach so
  the global callCount(0) check still passes. Distinct invalid values
  per test because `warnInvalidRunStatus` dedupes by status.
- **data-cy contract** — `run-status`, `run-status-build-number`,
  `run-status-icon`, `run-status-branch`, `run-status-branch-icon`.
- **Spacing** — 8px segment padding-left, 0px right on the segment
  that hosts the divider (via `runStatusSegmentDividerAdjacent`),
  8px branch padding, 8px inter-pill gap.
- **Percy** — link/passed light, link/failed dark, and a combined
  row (run-status + branch + test counts). Broader coverage stays in
  the demo page.

Framework-specific in each cy.tsx spec:

- `renderLink also wraps the run-status #N segment` — verifies the
  same callback is used for both pills. Kept per-framework because
  React expects a `ReactNode` and Vue expects a `VNode` — no way to
  share the JSX in `assertions.ts`.

Verified live: `yarn cy:run` on both `RunResultsReact.cy.tsx` and
`RunResultsVue.cy.tsx` — 56 tests each, all passing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cypress-design Ready Ready Preview Jul 6, 2026 1:35pm

Request Review

@changeset-bot

changeset-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5f9f6a5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cypress

cypress Bot commented Jul 6, 2026

Copy link
Copy Markdown

cypress-design    Run #4019

Run Properties:  status check passed Passed #4019  •  git commit 68da24c710 ℹ️: Merge 5f9f6a5faeaab9fb36a7ab3d56f5f1f7aaf67795 into 193d76d52f1fda60b940f3f15112...
Project cypress-design
Branch Review runresults-runstatus-tests
Run status status check passed Passed #4019
Run duration 02m 15s
Commit git commit 68da24c710 ℹ️: Merge 5f9f6a5faeaab9fb36a7ab3d56f5f1f7aaf67795 into 193d76d52f1fda60b940f3f15112...
Committer Emil Milanov
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 2
View all changes introduced in this branch ↗︎

Warning

No Report: Something went wrong and we could not generate a report for the Application Quality products.

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.

1 participant