Skip to content

test(e2e): add Playwright + first 3 critical-path E2E scenarios - #9

Merged
mohamed-ctrl878 merged 10 commits into
mainfrom
feat/playwright-e2e-setup
Sep 17, 2026
Merged

mohamed-ctrl878 merged 10 commits into
mainfrom
feat/playwright-e2e-setup

Conversation

@mohamed-ctrl878

@mohamed-ctrl878 mohamed-ctrl878 commented Sep 17, 2026 •

Copy link
Copy Markdown
Owner

Problem

The frontend had zero E2E test coverage — only Vitest unit tests under tests/useCases. Flagged as a P0 gap in the QA/scalability plan (AxeCode_QA_Scalability_Plan.md, section 2.4).

What this adds

  • @playwright/test + config (single chromium project for now).
  • Three initial critical-path scenarios:
    • tests/e2e/auth.spec.js — valid login → dashboard; invalid credentials → error shown, no false-positive redirect, form re-enabled.
    • tests/e2e/problems.spec.js — /problems catalog loads (auth-gated), opening a problem renders the workspace (Run/Submit buttons, tabs, Monaco editor mounted).
    • tests/e2e/courses.spec.js — /courses catalog loads (auth-gated), opening a course renders its details page.
  • tests/e2e/utils/auth.js — shared login helper.
  • tests/e2e/README.md — full setup instructions and explicit scope notes.

A blocker worth flagging explicitly

LoginPage's submit button is disabled until recaptchaToken is set — on the frontend itself, independent of the backend's RECAPTCHA_REQUIRED flag. So no UI automation can log in at all without solving reCAPTCHA. The fix isn't a code change, it's environment config: Google publishes a test key pair specifically for this (documented in tests/e2e/README.md), which verifies instantly with no real challenge. Requires setting VITE_RECAPTCHA_SITE_KEY (frontend) and RECAPTCHA_SECRET_KEY (backend) to the test values in whatever environment these tests run against — never in production.

Deliberately out of scope for this PR (tracked as follow-ups, see QA plan)

  • Asserting actual Judge0 execution results (Run/Submit correctness) — needs seeded test problems with known-good solutions.
  • The full purchase flow (checkout → Paymob/Kashier → entitlement granted → content unlocked) — needs sandboxed payment credentials (P0 in the plan).
  • Live/Agora video call flows.

Before merging

  • Provide E2E_TEST_USER_EMAIL / E2E_TEST_USER_PASSWORD for a seeded test account.
  • Confirm the reCAPTCHA test key pair is set on whatever environment CI/local runs point at.
  • Run npx playwright install --with-deps chromium once, then npm run test:e2e locally to confirm all 3 specs pass end-to-end.
  • (Not included here) Wire a CI job for this once a staging environment is available — running against production is obviously not appropriate, and running against nothing isn't useful, so this is left for the "Full-Stack E2E" step in the QA plan rather than bolted on here.

No E2E framework existed for the frontend before this — only
Vitest unit tests under tests/useCases. Flagged as P0 in the
QA/scalability plan.
Single chromium project for now; add more browsers once the first
scenarios are stable. webServer auto-start is local-only — CI/staging
runs assume the app is already deployed, per the phased plan (full
staging E2E is a separate P1 item).
The submit button on LoginPage is disabled until recaptchaToken is
set (frontend-side, independent of the backend's RECAPTCHA_REQUIRED
flag), so login cannot be automated at all without either Google's
official test key pair or a network-level mock of the recaptcha
widget. Using the test key pair is Google's documented, supported
way to do this and requires no code branching for "test mode" in
the app itself.
… copy

Avoids drift between test route constants and the actual app routes.
Covers the P0 "no E2E coverage at all" gap from the QA plan. Two
cases: successful login reaching the dashboard, and invalid
credentials surfacing an error without a false-positive redirect
(the more dangerous failure mode for an auth flow).
Verifies the auth-gated /problems catalog loads and that opening a
problem renders the core workspace (Run/Submit, tabs, Monaco editor
mounted). Deliberately does NOT assert on Judge0 execution results
yet — that needs seeded test problems/test-cases in a staging
environment, tracked as a follow-up per the QA plan's phased
full-stack E2E section.
Uses the "Details" button as the entry point since it's the one
CourseCard action present regardless of price/access state. The
full purchase flow (checkout → payment provider → entitlement
granted → content unlocked) is intentionally left for a follow-up
PR — it needs sandboxed Paymob/Kashier credentials and a seeded
paid course, per the QA plan's payment E2E task (P0).
@vercel

vercel Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
axe-code Ready Ready Preview Sep 17, 2026 10:15am UTC
axe-code-gq5p Ready Ready Preview Sep 17, 2026 10:15am UTC

@github-actions

Copy link
Copy Markdown

❌ Frontend CI Results

Stage Status
🔍 ESLint ⚠️ Check logs
📦 Build ❌ Failed

Deploy: Vercel will deploy automatically after merge to main.

📋 View Full Logs

Vitest's default `include` glob matches any *.spec.js in the repo, so
without an explicit `exclude` it was also picking up the new
Playwright specs under tests/e2e/ and trying to run them with the
wrong test runner API, failing the CI "Unit Tests" step (and, since
that step isn't continue-on-error, blocking Build from running too).
@github-actions

Copy link
Copy Markdown

✅ Frontend CI Results

Stage Status
🔍 ESLint ✅ Passed
📦 Build ✅ Passed

Deploy: Vercel will deploy automatically after merge to main.

📋 View Full Logs

@mohamed-ctrl878
mohamed-ctrl878 merged commit f5b58d4 into main Sep 17, 2026
5 checks passed

This branch was successfully deployed

2 active deployments
Preview – axe-code — 0a4c0088 Deployed Sep 17, 2026 by vercel[bot]
Preview – axe-code-gq5p — 0a4c0088 Deployed Sep 17, 2026 by vercel[bot]
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