feat: add Playwright test suite - #347
Open
AnkitKmrGupta wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces Playwright as an additional end-to-end (E2E) test runner alongside the existing Cypress suite, including Playwright configuration, shared fixtures/helpers, a large set of ported/expanded API + UI E2E specs, and CI integration to execute the new suite.
Changes:
- Add a Playwright-based E2E test suite (config, fixtures, helpers, page objects) and port key Cypress API/UI tests into
tests/. - Update the E2E runner (
cypress/scripts/run-e2e.js) to select between Cypress vs Playwright and pass runtime env through to Playwright. - Integrate Playwright into CI and add supporting TypeScript config, npm scripts/dependencies, and minor ClickHouse reference cleanup.
Reviewed changes
Copilot reviewed 53 out of 56 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Adds a root TS config scoped to Playwright E2E suite typechecking. |
| playwright.config.ts | Defines Playwright projects (api, ui) and CI-oriented defaults (workers/retries/reporting). |
| package.json | Adds Playwright dependency and npm scripts for running/typechecking the new suite. |
| package-lock.json | Locks Playwright and its transitive dependencies. |
| .gitignore | Ignores Playwright reports/traces/artifacts. |
| .github/workflows/ci-pr.yml | Adds a Playwright E2E CI job (install, typecheck, browser deps, run, upload report). |
| cypress/scripts/run-e2e.js | Adds runner selection and a Playwright execution path with env passthrough. |
| oneclick.sh | Removes legacy ClickHouse table reference from schema checklist/comments. |
| tests/pages/euclid-page.ts | Adds a Playwright page object for the Euclid rule builder UI. |
| tests/helpers/stub.ts | Adds Playwright request stubbing helpers (ports of Cypress intercept patterns). |
| tests/helpers/seed.ts | Adds shared analytics seeding + ClickHouse-ingestion wait helpers. |
| tests/helpers/poll.ts | Adds polling helper for “retry request until predicate holds” flows. |
| tests/helpers/network.ts | Adds helper to await/inspect API calls (status + request/response JSON). |
| tests/helpers/clickhouse.ts | Adds ClickHouse HTTP query helper and expected-table checks for runtime smoke. |
| tests/helpers/assertions.ts | Ports Cypress chai-style API response shape assertions to Playwright expect. |
| tests/fixtures/test.ts | Defines Playwright fixtures for API client, per-test merchant, and worker-shared merchant/page. |
| tests/fixtures/storage.ts | Seeds dashboard auth/merchant state into localStorage via addInitScript. |
| tests/fixtures/session.ts | Implements session creation (signup/login) with per-worker caching + eviction. |
| tests/fixtures/factory.ts | Re-exports shared Cypress test-data factory to keep payload builders unified. |
| tests/fixtures/api-client.ts | Adds a Playwright-native API client wrapper for decision-engine endpoints. |
| tests/e2e/smoke/nav-smoke.spec.ts | Adds UI smoke coverage verifying key routes render without crashing. |
| tests/e2e/settings/api-keys-page.spec.ts | Ports API keys UI tests (create/show-once/revoke + API usage). |
| tests/e2e/routing/volume-split-page.spec.ts | Ports volume split routing UI creation/activation flow. |
| tests/e2e/routing/rules/euclid-volume-split-output.spec.ts | Ports Euclid volume-split output-mode UI tests (100% total guard, preview JSON). |
| tests/e2e/routing/rules/euclid-nested-branches.spec.ts | Ports nested AND/OR branch UI behavior tests and JSON preview assertion. |
| tests/e2e/routing/rules/euclid-lifecycle.spec.ts | Ports rule lifecycle UI + panel management tests (create/activate/deactivate). |
| tests/e2e/routing/rules/euclid-enum-operators.spec.ts | Ports enum operator UI tests (is one of / is not one of + JSON preview). |
| tests/e2e/routing/rules/euclid-e2e.spec.ts | Ports high-value UI→API contract tests asserting exact /routing/create payloads. |
| tests/e2e/routing/rules/euclid-builder.spec.ts | Ports rule builder pure-UI interaction/validation tests (no backend mutation). |
| tests/e2e/routing/debit-routing-page.spec.ts | Ports debit routing UI toggle test with server-side persistence verification. |
| tests/e2e/decision-explorer/decision-explorer.spec.ts | Ports decision explorer UI coverage across tabs + a debit tab end-to-end run. |
| tests/e2e/auth/auth-page.spec.ts | Ports auth UI tests including guarded redirects and duplicate signup behavior via stubbing. |
| tests/e2e/analytics/payment-audit.spec.ts | Ports audit UI tests including both decision trail and preview-trace modes. |
| tests/e2e/analytics/dashboard-overview.spec.ts | Ports overview UI analytics behavior with seed + ingestion wait semantics. |
| tests/e2e/analytics/analytics-page.spec.ts | Ports analytics UI tests (multi-objective vs rule-based view toggle + refresh). |
| tests/api/routing/rule-routing.spec.ts | Ports rule-routing API contract tests (single/priority/advanced + nested evaluation). |
| tests/api/routing/routing-rules.spec.ts | Ports dynamic routing + volume split + mutation regression API contract tests (with polling). |
| tests/api/routing/routing-rule-mutations.spec.ts | Adds API tests for update/deactivate/delete invariants, including active rule immutability. |
| tests/api/routing/routing-hybrid.spec.ts | Adds API tests for /routing/hybrid fallback behavior and rejection cases. |
| tests/api/routing/routing-config.spec.ts | Adds API tests for routing key catalog and SR dimensions + GSM options. |
| tests/api/platform/runtime-smoke.spec.ts | Ports runtime smoke checks (ClickHouse schema + optional docs site checks). |
| tests/api/platform/health.spec.ts | Adds API smoke checks for health/readiness/diagnostics behavior. |
| tests/api/multi-objective-routing/sr-routing.spec.ts | Ports SR routing contract tests including cache consistency and score-update behavior. |
| tests/api/multi-objective-routing/rule-configs.spec.ts | Ports rule-config CRUD API tests (success-rate + elimination). |
| tests/api/multi-objective-routing/decide-gateway.spec.ts | Ports core /decide-gateway invariants and eligible-list constraints. |
| tests/api/multi-objective-routing/autopilot.spec.ts | Adds API tests for autopilot flags and gateway-score reset invariants. |
| tests/api/merchant/merchant-features.spec.ts | Adds merchant feature flags and debit-routing toggle API tests. |
| tests/api/merchant/merchant-crud.spec.ts | Ports merchant CRUD API tests with explicit session establishment and cleanup. |
| tests/api/cost/cost-ingestion.spec.ts | Adds contract tests for cost ingestion “empty merchant” read surfaces + seed-cost behaviors. |
| tests/api/auth/auth.spec.ts | Adds API tests for signup/login rejection and /auth/me identity. |
| tests/api/auth/auth-guards.spec.ts | Adds API tests to ensure representative protected routes require credentials. |
| tests/api/auth/auth-flows.spec.ts | Adds API tests for logout/switch/onboarding/members/password flows. |
| tests/api/auth/auth-admin-sso.spec.ts | Adds API tests for admin SSO one-time code exchange semantics and guardrails. |
| tests/api/auth/api-keys.spec.ts | Adds API-key lifecycle tests plus explicit “known gap” cross-merchant isolation coverage. |
| tests/api/analytics/analytics.spec.ts | Ports analytics API contract test generating traffic then asserting response shapes. |
| tests/api/analytics/analytics-extended.spec.ts | Adds coverage for remaining analytics endpoints to ensure they answer with payloads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+16
to
+28
| export async function stubApi( | ||
| page: Page, | ||
| pathGlob: string, | ||
| response: { status: number; body: unknown }, | ||
| ): Promise<void> { | ||
| await page.route(pathGlob, (route) => | ||
| route.fulfill({ | ||
| status: response.status, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify(response.body), | ||
| }), | ||
| ) | ||
| } |
Comment on lines
+152
to
+156
| e2e-playwright: | ||
| name: E2E (Playwright) | ||
| runs-on: ubuntu-latest | ||
| continue-on-error: true | ||
| timeout-minutes: 60 |
AnkitKmrGupta
force-pushed
the
add-playwright-test-suite
branch
2 times, most recently
from
August 5, 2026 10:23
45d8496 to
9488374
Compare
AnkitKmrGupta
force-pushed
the
add-playwright-test-suite
branch
8 times, most recently
from
August 7, 2026 07:10
724e0ee to
dcaad1e
Compare
AnkitKmrGupta
force-pushed
the
add-playwright-test-suite
branch
from
August 7, 2026 07:33
dcaad1e to
79e8643
Compare
AnkitKmrGupta
force-pushed
the
add-playwright-test-suite
branch
from
August 7, 2026 09:22
65445b7 to
a00f780
Compare
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.
This pull request introduces Playwright as a new end-to-end (E2E) test runner alongside Cypress, adds a full Playwright configuration and suite, and ports key E2E API tests from Cypress to Playwright. It updates the CI workflow to support Playwright E2E runs, enhances the E2E runner script to select between Playwright and Cypress, and adds new NPM scripts for Playwright usage. Additionally, it cleans up legacy ClickHouse table references.
E2E Testing Infrastructure and CI Integration
.github/workflows/ci-pr.yml) that installs dependencies, runs Playwright tests in source mode, and uploads test reports.cypress/scripts/run-e2e.js) to support both Playwright and Cypress, allowing runner selection via CLI flag or environment variable, and to properly pass environment variables to Playwright. [1] [2] [3] [4] [5]Playwright Test Suite and Configuration
playwright.config.ts) with two projects:api(API-contract tests) andui(user-journey tests), including parallelization, retries, and CI-specific settings.package.json).API E2E Test Coverage
tests/api/analytics/analytics.spec.ts,tests/api/analytics/analytics-extended.spec.ts) and thorough API key lifecycle and authorization tests (tests/api/auth/api-keys.spec.ts). [1] [2] [3]Maintenance and Cleanup
connector_markup_overlayClickHouse table reference from scripts and comments (oneclick.sh). [1] [2]These changes modernize and expand E2E testing, improving reliability and coverage while preparing for a transition away from Cypress.