chore(tests): introduce Playwright cross-browser regression testing - #449
Open
harshbhx wants to merge 7 commits into
Open
chore(tests): introduce Playwright cross-browser regression testing#449harshbhx wants to merge 7 commits into
harshbhx wants to merge 7 commits into
Conversation
This sets up @playwright/test with a minimal GitHub Actions workflow that runs a smoke test on Chromium, Firefox, and WebKit. It builds the demo CSS with grunt sass:dev before testing so index.html renders properly. This is the first step toward automating cross-browser testing for issue yegor256#15. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sets up Chromium, Firefox, and WebKit screenshot tests for index.html and key components, plus deterministic computed-style assertions. The GitHub Actions workflow auto-generates Linux baselines on the first push and re-runs tests; a separate workflow_dispatch job lets maintainers update baselines after intentional visual changes. Closes yegor256#15.
…into playwright-setup
There was a problem hiding this comment.
Pull request overview
This PR adds Playwright-based cross-browser regression testing to Tacit, including computed-style assertions and visual snapshot testing, and wires it into GitHub Actions so regressions are detected automatically.
Changes:
- Introduces Playwright test suites for smoke, computed styles, and visual regression.
- Adds Playwright configuration + npm scripts to run/update tests.
- Adds CI workflows to run Playwright and to manually refresh visual baselines; updates docs and gitignore accordingly.
Reviewed changes
Copilot reviewed 8 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/visual.spec.js |
Adds visual snapshot tests for the index page and key components. |
tests/tacit.spec.js |
Adds a cross-browser smoke test for page load/title. |
tests/styles.spec.js |
Adds computed-style assertions to catch CSS regressions deterministically. |
playwright.config.js |
Configures Playwright projects (Chromium/Firefox/WebKit) and a local web server. |
package.json |
Adds @playwright/test and convenience scripts for running/updating tests. |
.github/workflows/playwright.yml |
Adds CI workflow to install deps, build CSS, run Playwright, and upload reports on failure. |
.github/workflows/playwright-update-snapshots.yml |
Adds manual workflow to regenerate/commit snapshot baselines. |
.gitignore |
Ignores Playwright output directories (test-results/, playwright-report/). |
README.md |
Documents the Playwright setup and adds a CI badge. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a fully automated, CI driven cross browser testing setup using [Playwright](https://playwright.dev) for Tacit. It covers smoke tests, computed style assertions, and visual regression tests across Chromium, Firefox, and WebKit, all without requiring contributors to install browsers or generate snapshots locally.
Closes #15
Motivation
Tacit is a classless CSS framework, which means every style change can unintentionally affect the rendered output of any HTML element. Right now, visual regressions are only caught through manual inspection. Automated cross browser coverage gives maintainers confidence that design changes render correctly everywhere, and makes future contributions safer for everyone involved.
What Changed
Dependencies
@playwright/testas a devDependency.Configuration
playwright.config.jsdefining three projects:chromium,firefox, andwebkit, along with a built in static server usingpython -m http.server.Test Suites
tests/tacit.spec.js: a basic smoke test that verifies the index page loads.tests/styles.spec.js: deterministic computed style assertions for headings, tables, inputs, links, and strong text.tests/visual.spec.js: screenshot regression tests covering the full page, headings, table, and form components.Continuous Integration
.github/workflows/playwright.yml, which installs dependencies, builds the CSS, installs Playwright browsers, generates Linux baselines when missing, runs the full test suite, and uploads the Playwright report if anything fails..github/workflows/playwright update snapshots.yml, a manualworkflow_dispatchworkflow for regenerating baselines when a visual change is intentional.Developer Experience
package.json:npm run playwright: runs the full suite.npm run playwright:update: updates baselines..gitignoreto excludetest-results/andplaywright-report/.README.md.How It Works: CI Driven Baselines
Screenshot baselines are generated on Linux inside the GitHub Action runner (
ubuntu-24.04), so contributors never need to run--update-snapshotslocally or install any browsers themselves.tests/visual.spec.js-snapshotsdoes not exist yet, the action generates baseline screenshots, commits them, and pushes back to the same branch.update playwright snapshotsworkflow to refresh all baselines at once.Test Plan
To verify the setup locally:
npm install npx playwright install npm run playwright # to update baselines instead, if needed: npm run playwright:updateThe Playwright GitHub Action also runs automatically on every push, so no manual step is required once this PR is merged.
Checklist