1---2name: playwright-regression-testing3description: Automated regression testing strategy and best practices using Playwright with TypeScript. Use when asked to plan, organize, select, execute, or optimize regression test suites for web applications. Covers change-based and risk-based test selection, test tagging and prioritization, parallel execution, sharding, CI/CD pipeline integration with GitHub Actions, flaky test management, suite health monitoring, and regression types (corrective, progressive, selective, complete). Keywords: regression testing, test selection, smoke tests, test suite optimization, CI pipeline, flaky tests, test sharding, impact analysis, git diff.4---56# Playwright Regression Testing (TypeScript)78Strategy and best practices for automated regression testing of web applications using Playwright with TypeScript.910> **Activation:** This skill is triggered when working with regression test strategy, test suite selection, test prioritization, CI/CD pipeline testing, flaky test management, test sharding, or optimizing test execution for web applications using Playwright.1112## When to Use This Skill1314- **Plan regression suites** with risk-based and change-based test selection15- **Organize tests** into tiers (smoke, sanity, selective, full regression)16- **Optimize execution** with parallelization, sharding, and time-budget strategies17- **Integrate with CI/CD** using GitHub Actions pipelines18- **Manage flaky tests** with quarantine, retry policies, and root cause tracking19- **Monitor suite health** with execution time, flake rate, and detection metrics20- **Select tests after changes** using git diff analysis and impact mapping2122## Prerequisites2324| Requirement | Details |25| -------------- | ---------------------------------------- |26| Node.js | v18+ recommended |27| Playwright | `@playwright/test` package |28| TypeScript | `typescript` configured in project |29| Browsers | Installed via `npx playwright install` |30| Git | Required for change-based test selection |31| GitHub Actions | Recommended CI/CD platform |3233---3435## Quick Reference3637### Tier Model3839```40Tier 0 — Smoke (< 2 min) → Critical path, runs on every commit41Tier 1 — Sanity (< 10 min) → Core features, runs on every PR42Tier 2 — Selective (< 30 min) → Change-based + risk-based, runs on merge43Tier 3 — Full (< 60 min) → Complete regression, runs nightly/pre-release44```4546### Regression Types4748| Type | When | Scope |49| --------------- | ---------------------------------------- | ---------------------------------- |50| **Corrective** | No app code changed (infra, config, env) | Full suite to verify nothing broke |51| **Progressive** | New features added | Existing tests + new feature tests |52| **Selective** | Specific code changes | Changed modules + dependent tests |53| **Complete** | Major refactor, release candidate | Run everything across all projects |5455### Tag Taxonomy5657| Tag | Purpose | Tier |58| ------------- | -------------------------------- | ------------- |59| `@smoke` | Critical path, must always pass | 0 |60| `@sanity` | Core feature verification | 1 |61| `@regression` | Standard regression coverage | 2-3 |62| `@critical` | Revenue/business-critical flows | 0-1 |63| `@slow` | Tests exceeding 30 seconds | 3 |64| `@quarantine` | Known flaky, under investigation | Skipped in CI |65| `@a11y` | Accessibility checks | 2 |6667### CLI Quick Reference6869| Command | Description |70| ----------------------------------------------- | ------------------------ |71| `npx playwright test --grep @smoke` | Run smoke tier only |72| `npx playwright test --grep @regression` | Run regression suite |73| `npx playwright test --grep-invert @quarantine` | Skip quarantined tests |74| `npx playwright test --shard=1/4` | Run shard 1 of 4 |75| `npx playwright test --last-failed` | Re-run only failed tests |7677---7879## Common Rationalizations8081> Common shortcuts and "good enough" excuses that erode test quality — and the reality behind each.8283| Rationalization | Reality |84| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |85| "Run all tests every time" | Change-based test selection reduces CI time 60-80%. Run the full suite nightly, not every commit. |86| "Flaky tests are normal" | Flaky tests erode trust in the entire suite. Quarantine, investigate, and fix them. |87| "Regression testing is just re-running everything" | Strategic selection (risk-based, change-based) catches more defects in less time than brute-force runs. |88| "Test sharding is premature optimization" | Parallel sharding cuts CI time linearly with workers. Start with 4 shards from day one. |89| "Smoke tests cover regression" | Smoke tests verify health; regression tests verify behavior. They serve different purposes. |90| "Tagging tests is busywork" | Tags enable selective execution, prioritization, and suite analysis. Untagged suites are unmanageable. |9192---9394## References9596| Document | Content |97| ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |98| [Regression Strategy](./references/regression-strategy.md) | Tier definitions, test selection (change-based, risk-based, historical, time-budget), directory layout, tagging, naming conventions, Playwright best practices, example test |99| [CI/CD Integration](./references/ci-cd-integration.md) | GitHub Actions tiered pipeline, sharding, merge reports, Playwright config, performance optimization, CLI reference |100| [Flaky Management](./references/flaky-management.md) | Retry policies, quarantine strategies, detection checklist, suite health metrics, troubleshooting |101102---103104## Verification105106After completing this skill's workflow, confirm:107108- [ ] **Regression suite covers critical paths** — All priority-1 user flows have regression tests109- [ ] **Smoke test subset identified** — Tagged `@smoke` tests run in under 2 minutes110- [ ] **No test duplication** — Each scenario tested exactly once at the appropriate level111- [ ] **Test isolation verified** — Running tests in random order produces same results as sequential112- [ ] **Flaky test baseline established** — All tests pass 5/5 consecutive runs113- [ ] **CI pipeline configured** — GitHub Actions workflow runs regression on schedule114- [ ] **Allure or HTML report generated** — Test results available in human-readable format