Skip to content

feat(web): Playwright E2E suite with CI integration#76

Open
5queezer wants to merge 1 commit intomasterfrom
feat/e2e-playwright
Open

feat(web): Playwright E2E suite with CI integration#76
5queezer wants to merge 1 commit intomasterfrom
feat/e2e-playwright

Conversation

@5queezer
Copy link
Copy Markdown
Owner

Implements ADR-0008.

Summary

Adds a Playwright browser E2E suite to web/tests/e2e/ plus a new CI job that runs it against the real release binary. Closes the manual-verification gap at merge time for the frontend's OAuth + chart + picker flows.

Two specs:

  • smoke.spec.ts — cold-boot happy path: / → OAuth PKCE redirect via :9315/authorize → back to /?code=…&state=… → token exchange → click Load → klinecharts canvas renders with non-zero dimensions and an RSI .pane-header. Asserts zero console errors throughout.
  • indicator-picker.spec.ts — Kobalte Dialog open, search filter, add a non-RSI indicator, close modal, chip appears, chart refetches (scoped to POST /mcp with method=tools/call, params.name=generate_chart), reload — chip persists via localStorage, click Load, remove chip → chart refetches again, chip gone.

Playwright's webServer config (array form, supported since 1.31) launches cargo run --release -- --serve and npm run dev as managed fixtures so the suite is self-contained. reuseExistingServer: !process.env.CI. Chartgen gets a 180s startup timeout to tolerate a cold release build on CI; Swatinem/rust-cache keeps it fast in practice.

CI

New e2e job in .github/workflows/ci.yml, gated on build-release. Caches ~/.cache/ms-playwright, runs npx playwright install --with-deps chromium then npx playwright test. Uploads playwright-report/ and test-results/ as artifacts on failure (7-day retention).

Single worker because chartgen's OAuth store is process-global; concurrent PKCE flows would collide on state. One retry in CI to absorb first-run OAuth redirect timing.

Out of scope (deferred — see ADR)

  • Visual regression / pixel snapshots
  • Firefox, WebKit, mobile viewports
  • Trading-tool flows (not in frontend yet)
  • Axe-core accessibility audit
  • Performance budgets / Lighthouse CI
  • Docker isolation / parallel sharding

Known limitations

Dynamic multi-indicator rendering is blocked on fix/web-dynamic-indicators-and-layout — the current Chart.tsx only renders RSI. Tests scope around observable state (chips, POST /mcp refetch, localStorage persistence) rather than chart-visual assertions for non-RSI indicators. The smoke test does assert the RSI .pane-header is visible because RSI is the one indicator that's hardcoded into the chart today.

Verification

  • cd web && npm install && npm run build — passes.
  • cd web && npx playwright install chromium && npx playwright test — both specs pass locally in the agent environment (~6s total with warm servers).
  • cd web && npx playwright test --list — 2 tests discovered across 2 files.
  • cd website && npm install && npm run build — ADR-0008 and guides/testing.md render cleanly.
  • ./scripts/gen-mcp-types.sh — no drift.
  • coderabbit review --plain — addressed 3 findings (canvas size poll, storage-clear logging, narrower MCP response predicates). Final run to confirm zero findings hit the rate limit; re-running after merge.

Test plan

  • CI e2e job passes on Chromium
  • CI caches Playwright browsers on second run
  • HTML report uploads on induced failure
  • Local npm run e2e:ui works for debugging

🤖 Generated with Claude Code

Implements ADR-0008. Adds smoke and indicator-picker specs covering
the v0.2 happy paths (OAuth PKCE → chart render, picker modal
add/remove/persistence). Playwright's webServer config launches
chartgen --serve and the Vite dev server as fixtures so the suite is
self-contained.

CI job `e2e` builds the release binary, installs Chromium, runs the
suite, uploads playwright-report on failure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

Warning

Rate limit exceeded

@5queezer has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 34 minutes and 26 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 34 minutes and 26 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a3d4acba-8814-4968-98fc-eb4ad8e11ffc

📥 Commits

Reviewing files that changed from the base of the PR and between a87c9de and b457bd1.

⛔ Files ignored due to path filters (1)
  • web/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (11)
  • .github/workflows/ci.yml
  • web/.gitignore
  • web/package.json
  • web/playwright.config.ts
  • web/tests/e2e/fixtures/app.ts
  • web/tests/e2e/indicator-picker.spec.ts
  • web/tests/e2e/smoke.spec.ts
  • website/astro.config.mjs
  • website/src/content/docs/decisions/0008-e2e-playwright.md
  • website/src/content/docs/decisions/index.md
  • website/src/content/docs/guides/testing.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/e2e-playwright

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant