Skip to content

feat: add Playwright test suite - #347

Open
AnkitKmrGupta wants to merge 3 commits into
mainfrom
add-playwright-test-suite
Open

feat: add Playwright test suite#347
AnkitKmrGupta wants to merge 3 commits into
mainfrom
add-playwright-test-suite

Conversation

@AnkitKmrGupta

Copy link
Copy Markdown
Collaborator

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

  • Added a new Playwright E2E job to the GitHub Actions workflow (.github/workflows/ci-pr.yml) that installs dependencies, runs Playwright tests in source mode, and uploads test reports.
  • Updated the E2E runner script (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

  • Added a comprehensive Playwright configuration (playwright.config.ts) with two projects: api (API-contract tests) and ui (user-journey tests), including parallelization, retries, and CI-specific settings.
  • Added Playwright as a dev dependency and new NPM scripts for running and type-checking Playwright tests (package.json).

API E2E Test Coverage

  • Ported and expanded E2E API tests to Playwright, including analytics endpoint 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

  • Removed the obsolete connector_markup_overlay ClickHouse 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.

@AnkitKmrGupta AnkitKmrGupta self-assigned this Aug 5, 2026
Copilot AI lite review requested due to automatic review settings August 5, 2026 08:21
Comment thread .github/workflows/ci-pr.yml Fixed

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.

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 thread tests/helpers/stub.ts
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
AnkitKmrGupta force-pushed the add-playwright-test-suite branch 2 times, most recently from 45d8496 to 9488374 Compare August 5, 2026 10:23
@AnkitKmrGupta AnkitKmrGupta changed the title test(e2e): add Playwright test suite feat: add Playwright test suite Aug 5, 2026
@AnkitKmrGupta
AnkitKmrGupta force-pushed the add-playwright-test-suite branch 8 times, most recently from 724e0ee to dcaad1e Compare August 7, 2026 07:10
@AnkitKmrGupta
AnkitKmrGupta force-pushed the add-playwright-test-suite branch from dcaad1e to 79e8643 Compare August 7, 2026 07:33
@AnkitKmrGupta
AnkitKmrGupta force-pushed the add-playwright-test-suite branch from 65445b7 to a00f780 Compare August 7, 2026 09:22
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.

3 participants