Skip to content

test: real integration + E2E (Playwright) verification tiers - #1

Merged
asharahmed merged 2 commits into
mainfrom
test/verification-substrate
Jun 29, 2026
Merged

test: real integration + E2E (Playwright) verification tiers#1
asharahmed merged 2 commits into
mainfrom
test/verification-substrate

Conversation

@asharahmed

Copy link
Copy Markdown
Owner

Why

The auto-fix loop we're building (capture → Linear → agent) only ships a fix when tests prove it works end to end. That guarantee is worthless unless the test tiers are real. Today the repo has 64 pure-domain unit tests and zero integration/E2E — the test project couldn't even see the host. This PR builds the missing substrate.

Two tiers, both hitting the genuine pipeline — no mocks of the system under test, so a hollow test can't pass:

Integration tier — tests/Ravelin.IntegrationTests

  • WebApplicationFactory<Program> runs the real middleware pipeline (API-key auth → rate limit → endpoint → adapter → ScanReconciler → EF Core) against a real SQL Server via Testcontainers; Respawn resets domain data between tests.
  • Covers the dogfood ingestion endpoint: valid key persists a finding (with SLA deadline); clean report → 0 findings; no/bad key → 401 and writes nothing; malformed payload → 400, never an unhandled 500 (the exact bug class the agent loop will target).

E2E tier — tests/Ravelin.E2ETests

  • Launches the real published app as its own Kestrel process against a Testcontainers SQL Server, drives it with headless Chromium (Playwright).
  • Journeys: landing page boots the Blazor WASM runtime in a real browser; login as a seeded admin → /dashboard (real /api/auth/login → JWT → localStorage → authenticated API call).

Plumbing

  • Program.cs: public partial class Program so the factory can drive the host.
  • security.yml: new integration-tests and e2e-tests jobs (Docker is available on GitHub-hosted runners; the E2E job publishes the host + installs Chromium).
  • Bundles the dogfood SCA adapter the integration tests exercise (DotnetListAdapter + /api/ingest/dotnet + unit tests + the self-scan push step) — these were already in the working tree and the branch needs them to compile.

Verification

  • ✅ Full solution builds clean (0 warnings); 64/64 unit tests green.
  • ⚠️ The integration + E2E suites could not run locally (no Docker / no browsers on the dev box). This PR's CI is their first real run — that's the point of opening it.

What to watch on the first run

  • Blazor host booting under WebApplicationFactory (integration) and as a published process (E2E) — depends on static web assets being present; this is the most likely first-run wrinkle.
  • The login journey has the most surface (JWT env + the full client auth chain); the landing-page test is the high-confidence one.

Adds the verification substrate the auto-fix loop will gate on: tests that
exercise the genuine pipeline against a real database and a real browser,
not in-memory fakes. A fix isn't "done" until it's green here, end to end.

- Ravelin.IntegrationTests: WebApplicationFactory<Program> over the real
  middleware pipeline + a Testcontainers SQL Server (Respawn resets state
  between tests). Covers the dotnet ingestion endpoint end to end: valid key
  persists findings, bad/no key -> 401, malformed payload -> 400 (never an
  unhandled 500).
- Ravelin.E2ETests: launches the real published app as its own Kestrel
  process against a Testcontainers SQL Server and drives it with headless
  Chromium (Playwright). Landing-page WASM boot + login -> dashboard.
- Program.cs: expose `public partial class Program` for the factory.
- CI: new integration-tests and e2e-tests jobs in security.yml (Docker is
  available on GitHub-hosted runners).

Also lands the dogfood SCA adapter the integration tests exercise:
DotnetListAdapter + /api/ingest/dotnet route + unit tests + the security.yml
self-scan push step.
- build-test ran `dotnet test Ravelin.slnx`, which swept in the E2E project
  (no browsers/published app there) and failed it. Narrow that step to the
  unit test project; integration + E2E keep their own dedicated jobs.
- E2E launched the published app without a working directory, so the content
  root resolved to the test cwd and /_framework/* (the WASM bundle) 404'd —
  the runtime never booted and no page rendered. Pin WorkingDirectory +
  ASPNETCORE_CONTENTROOT to the app folder.
- Add browser diagnostics (failed responses, console errors, HTML snippet) so
  an E2E failure explains itself instead of surfacing as a bare timeout.
@asharahmed
asharahmed merged commit b4ec7ec into main Jun 29, 2026
8 of 10 checks passed
@asharahmed
asharahmed deleted the test/verification-substrate branch June 29, 2026 00:56
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