Skip to content

test: modernize visual regression with pinned Playwright - #2552

Merged
amir-ba merged 10 commits into
telekom:mainfrom
amir-ba:test/playwright-visual-regression
Oct 7, 2026
Merged

amir-ba merged 10 commits into
telekom:mainfrom
amir-ba:test/playwright-visual-regression

Conversation

@amir-ba

@amir-ba amir-ba commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

- Compose/CDP, shared browser page, fixed sleeps, implicit baseline updates
+ Playwright Test contexts, readiness checks, explicit state captures
+ One Storybook artifact, digest-pinned Chromium 153 image
+ Identical Linux comparison locally and in GitHub Actions

Removes deprecated visual-only Docker/Puppeteer/Jest dependencies. Core declares its existing Jest dependencies directly. DataGrid now waits for nested components and fonts before automatic width measurement, with a regression spec.

Evidence

Before: Chromium 108 and implicit baseline updates; reproduced DataGrid measuring an unready cell as 12px instead of 120px.

After, local:

  • 474 canonical PNGs: decoding, dimensions and nonblank audit passed; representative light/dark states inspected.
  • Full comparison: 400 passed, 128 existing skipped cases, 2.1 minutes. Repeat: 800 passed without flaky results.
  • Matching acceptance, deliberate mismatch rejection, missing-baseline rejection and no baseline writes verified. Policy checks preserve prior HTML/JSON evidence.
  • Native Windows interactions: 4 passed. DataGrid repeat: 104 passed.
  • Core: 359 specs / 168 snapshots and 78 E2E tests passed. Lint, React build/types, formatting, frozen install and generated-file clean-tree checks passed.
  • Screenshot policy: 0.01 per-pixel perceptual threshold excludes one-RGB-level rounding; maxDiffPixels 0. No changed-pixel-count allowance.

Implementation checks are green at c7678a3: build-pr and CodeQL. Remote visual report: 400 passed, 128 skipped, zero unexpected/flaky results, 4.1 minutes. Final published head 01b8670 is also green: all eight build-pr jobs and CodeQL. Its downloaded report confirms 400 passed, 128 skipped, zero unexpected/flaky results, 474 expected PNG attachments, 4.4 minutes. Artifact names use Actions PR merge SHA 3d0f3d2; its parent is the exact final head, and the Storybook producer checkout was verified. Final browser evidence. CI also fixes scoped Git checkout trust and explicitly installs the existing core browser after dependency-cache restoration; image assertions are unchanged. Visual artifacts include HTML, JSON, JUnit, failure images and traces. Nine previously skipped suites remain visible coverage debt.

Merge Danger

Door: Two-way. Blast radius: Visual tests plus DataGrid initial auto-width timing.

Chromium 108 → 153 requires baseline replacement and named state paths. Passing comparisons do not establish design approval. Review baseline changes and the HTML report before merge. This PR stays draft and unmerged.

Setup and baseline review: packages/visual-tests/README.md. Research: docs/2026-10-07-visual-test-modernization.md.

Playwright CLI assessment is complete in the research document, after green checks. Keep the Playwright Test CLI already used by local/Actions gates. The separate session CLI is an optional inspection/debugging companion, not a replacement for PNG comparison, fixtures, or reports. The pinned 1.63.0 package exposes playwright cli --help; standalone attachment compatibility is not runtime-tested. No second runner migration or performance claim is included.

amir-ba added 10 commits October 7, 2026 02:08
…ywright-visual-regression

# Conflicts:
#	yarn.lock
- Updated visual tests for Menu, RadioButtonGroup, RadioButton, SegmentedButton, and SidebarNavigation components.
- Refactored test cases to use async functions for better organization and clarity.
- Improved accessibility checks and assertions for various states and interactions.
- Added keyboard navigation tests for SidebarNavigation and SegmentedButton components.
- Enhanced screenshot capturing for different states to ensure visual consistency.
@amir-ba
amir-ba marked this pull request as ready for review October 7, 2026 14:40
Copilot AI balanced review requested due to automatic review settings October 7, 2026 14:40
@amir-ba
amir-ba requested a review from maomaoZH as a code owner October 7, 2026 14:40
@amir-ba
amir-ba merged commit 670c6ff into telekom:main Oct 7, 2026
10 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

State captures remain contaminated, nested shadow components can still be measured prematurely, and the reported coverage totals conflict.

Review effort: Balanced
Findings: 3 Medium severity · 1 Low severity

Open (4)
What changed in this PR

Migrates visual regression testing from Jest/Puppeteer to pinned Playwright, adds deterministic readiness checks, and fixes DataGrid auto-width timing.

Changes:

  • Introduces Playwright fixtures, containerized runners, reports, and snapshot policy checks.
  • Migrates component visual and interaction suites to explicit state captures.
  • Waits for component/font readiness before DataGrid width measurement.
File Description
.github/​workflows/​build-pr.yml Splits Storybook build and visual comparison jobs.
docs/​2026-10-07-visual-test-modernization.md Documents research and migration decisions.
packages/​components/​package.json Declares Jest dependencies directly.
packages/​components/​src/​components/​data-grid/​data-grid.spec.ts Tests delayed auto-width measurement.
packages/​components/​src/​components/​data-grid/​data-grid.tsx Adds asynchronous measurement readiness.
packages/​visual-tests/​.gitignore Ignores Playwright outputs.
packages/​visual-tests/​README.md Documents the new browser-test workflow.
packages/​visual-tests/​inject-fail-images.js Removes legacy report customization.
packages/​visual-tests/​jest-puppeteer.config.js Removes Puppeteer configuration.
packages/​visual-tests/​jest.config.js Removes Jest visual-test configuration.
packages/​visual-tests/​outdated-snapshot-reporter.js Removes legacy snapshot cleanup.
packages/​visual-tests/​package.json Replaces visual-test dependencies and scripts.
packages/​visual-tests/​playwright.config.js Configures Playwright projects and reporting.
packages/​visual-tests/​scripts/​check-snapshot-policy.js Verifies read-only snapshot comparisons.
packages/​visual-tests/​scripts/​container-entry.js Runs Playwright inside the pinned container.
packages/​visual-tests/​scripts/​prepare.js Builds and stages Storybook.
packages/​visual-tests/​scripts/​run-container.js Starts the canonical Docker environment.
packages/​visual-tests/​setup.js Removes the legacy server setup.
packages/​visual-tests/​teardown.js Removes legacy teardown/report copying.
packages/​visual-tests/​test-environment-setup.js Removes global Puppeteer helpers.
packages/​visual-tests/​src/​accordion.visual.spec.js Migrates accordion states.
packages/​visual-tests/​src/​brand-header.visual.spec.js Migrates skipped brand-header coverage.
packages/​visual-tests/​src/​breadcrumb.visual.spec.js Migrates breadcrumb states.
packages/​visual-tests/​src/​button.visual.spec.js Migrates button variants and interactions.
packages/​visual-tests/​src/​callout.visual.spec.js Migrates skipped callout coverage.
packages/​visual-tests/​src/​card.visual.spec.js Migrates card states.
packages/​visual-tests/​src/​checkbox-group.visual.spec.js Migrates checkbox-group states.
packages/​visual-tests/​src/​checkbox.visual.spec.js Migrates checkbox variants and states.
packages/​visual-tests/​src/​chip.visual.spec.js Migrates chip variants.
packages/​visual-tests/​src/​components.interaction.spec.js Adds native interaction checks.
packages/​visual-tests/​src/​datagrid.visual.spec.js Waits for DataGrid measurement completion.
packages/​visual-tests/​src/​date-picker.visual.spec.js Migrates date-picker states.
packages/​visual-tests/​src/​divider.visual.spec.js Migrates divider variants.
packages/​visual-tests/​src/​dropdown-select.visual.spec.js Adds dropdown-select behavior coverage.
packages/​visual-tests/​src/​dropdown.visual.spec.js Migrates deprecated dropdown states.
packages/​visual-tests/​src/​footer.visual.spec.js Migrates footer variants.
packages/​visual-tests/​src/​icon.visual.spec.js Migrates icon variants.
packages/​visual-tests/​src/​link.visual.spec.js Migrates link states.
packages/​visual-tests/​src/​list.visual.spec.js Migrates list variants.
packages/​visual-tests/​src/​logo.visual.spec.js Migrates logo states.
packages/​visual-tests/​src/​menu-flyout.visual.spec.js Adds flyout interaction coverage.
packages/​visual-tests/​src/​notification-badge.visual.spec.js Migrates badge variants.
packages/​visual-tests/​src/​notification.visual.spec.js Migrates notification variants.
packages/​visual-tests/​src/​pagination.visual.spec.js Migrates pagination states.
packages/​visual-tests/​src/​progressbar.visual.spec.js Migrates progress-bar variants.
packages/​visual-tests/​src/​radio-button-group.visual.spec.js Restores radio-group coverage.
packages/​visual-tests/​src/​radio-button.visual.spec.js Restores radio-button coverage.
packages/​visual-tests/​src/​rating-stars.visual.spec.js Migrates rating-star states.
packages/​visual-tests/​src/​segmented-button.visual.spec.js Restores segmented-button interactions.
packages/​visual-tests/​src/​sidebar-navigation.visual.spec.js Restores sidebar behavior coverage.
packages/​visual-tests/​src/​slider.visual.spec.js Migrates slider states.
packages/​visual-tests/​src/​switch.visual.spec.js Migrates switch states.
packages/​visual-tests/​src/​tab-navigation.visual.spec.js Migrates tab-navigation states.
packages/​visual-tests/​src/​table.visual.spec.js Migrates table variants and hover.
packages/​visual-tests/​src/​tag.visual.spec.js Migrates tag variants.
packages/​visual-tests/​src/​test-fixtures.js Adds shared readiness and screenshot fixtures.
packages/​visual-tests/​src/​textarea.visual.spec.js Migrates textarea states.
packages/​visual-tests/​src/​textfield.visual.spec.js Migrates text-field states.
packages/​visual-tests/​src/​toggle-group.visual.spec.js Migrates skipped toggle-group coverage.
packages/​visual-tests/​src/​tooltip.visual.spec.js Migrates tooltip hover coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +743 to +754
await Promise.all(
Array.from(
this.hostElement.shadowRoot.querySelectorAll(
`.${name}__auto-width-check td *`
),
(
element: HTMLElement & {
componentOnReady?: () => Promise<HTMLElement>;
}
) => element.componentOnReady?.()
)
);
Comment on lines +22 to +25
await page.mouse.move(60, 40);
await page.mouse.down();
await story.screenshot('active.png');
await page.keyboard.press('Tab');
Comment on lines +24 to +26
await page.mouse.down();
await story.screenshot('active.png');
await page.keyboard.press('Tab');
Comment on lines +130 to +132
All 38 legacy files are migrated: 478 active visual cases plus four native
interaction cases across both themes. Button interaction states now run in both
themes instead of inheriting the previous suite's theme.
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.

2 participants