Skip to content

Conversation

@makhnatkin
Copy link
Collaborator

@makhnatkin makhnatkin commented Mar 7, 2025

This PR introduces Playwright visual testing to ensure UI consistency in PRs, enhancing code quality and preventing unintended UI changes.

What's Included?

1. GitHub Workflows

  • PR Visual Tests – Runs Playwright visual tests for every PR.
  • PR Visual Tests Report – Posts test reports as comments in the PR.

2. New Commands in package.json

To streamline testing, the following commands have been added:

  • playwright:install – Installs Playwright with Chromium and Webkit
  • playwright – Runs visual tests
  • playwright:update – Updates snapshots
  • playwright:clear – Clears test cache
  • playwright:report – Displays test results report
  • playwright:docker – Runs tests in Docker for local pre-PR validation
  • playwright:docker:update – Updates snapshots in Docker for consistency across environments
  • playwright:docker:clear – Clears cache in Docker for local testing
  • playwright:docker:report – Displays test results report in Docker

3. Dependencies Added

  • @playwright/test – Core package for running Playwright tests.
  • @playwright/experimental-ct-react – Enables React component testing via Playwright. (Experimental Storybook package)

4. Test Configuration

  • playwright.config.ts – Configures tests to run in Chromium and Webkit with React support via Vite.
  • Defines test directory, generates HTML reports

5. Visual Tests

Snapshots are stored in __snapshots__ for verification.

6. Documentation

Added a new doc explaining Playwright visual testing, setup, and usage.

@makhnatkin makhnatkin requested a review from d3m1d0v as a code owner March 7, 2025 08:01
@makhnatkin makhnatkin requested a review from shevnv March 7, 2025 08:01
@makhnatkin makhnatkin marked this pull request as draft March 7, 2025 08:01
@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@makhnatkin makhnatkin force-pushed the feat/visual-tests branch 3 times, most recently from 76e35cf to 8ccbbcb Compare March 11, 2025 22:56
@makhnatkin makhnatkin marked this pull request as ready for review March 12, 2025 11:22
@makhnatkin makhnatkin marked this pull request as draft March 12, 2025 11:23
@makhnatkin makhnatkin marked this pull request as ready for review March 12, 2025 14:34
@makhnatkin makhnatkin merged commit 0182567 into main Mar 13, 2025
5 checks passed
@makhnatkin makhnatkin deleted the feat/visual-tests branch March 13, 2025 19:28
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.

4 participants