6215: Add (real) E2E tests - #84
Open
gcgoncalves wants to merge 3 commits into
Open
Conversation
Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
marekdano
reviewed
Aug 26, 2026
marekdano
left a comment
Contributor
There was a problem hiding this comment.
The changes look good, just few comments
Nice piece of infra work — real-backend e2e coverage via a testing compose profile, with mocks bypassed only on the success path, is a solid design and the fixture branching (E2E_REAL_API) is clean.
Functionally-impacting
redis-datavolume gets wiped bye2e:docker:down.docker compose --profile testing down -vincludesappandredistoo (they carry no profile, so they're always in scope), and-vremovesredis-data— the same volume a plaindocker compose updev stack uses. Anyone runningnpm run e2e:dockeragainst a machine that also has the normal dev stack on this compose file will lose their local Redis data as a side effect. Consider a separate volume/project name for the testing profile, or call this out explicitly in the README as an accepted tradeoff.
Suggestions
seed.ts'sclearForcedPasswordChange(): the "already past forced password change" branch (precondition.status === 200on a login withBOOTSTRAP_PASSWORD) looks unreachable — once the password's been changed, logging in with the old bootstrap password should fail auth rather than succeed. Sincedown -vwipes the gateway container every run anyway, this reads as dead defensive code. Worth a comment explaining the scenario it guards, or dropping it.- The real-mode
mockSessioninapi-mock.tsno-opsmockUnauthorizedfor all specs, not just the ones touched here — a repo-wide behavior change riding on a small fixture edit. You've verified 217/217 pass, so likely fine, just flagging the blast radius.
Minor
e2e:docker:seeduses--env-file-if-existsand--experimental-strip-types— fairly recent Node flags. Worth confirming CI's pinned Node version supports them if this is the first place they're used.- Hardcoded testing-only secrets in
docker-compose.yml(JWT_SECRET_KEY,AUTH_ENCRYPTION_SECRET, bootstrap password) are clearly labeled not-for-prod and gated behind thetestingprofile — fine, just confirm your secret scanner (if any) won't flag them.
Everything else — CSRF token capture, workers=2 for real mode, the heading→Home-button assertion fix — looks solid and the reasoning is well-documented in comments.
Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
marekdano
reviewed
Aug 26, 2026
marekdano
left a comment
Contributor
There was a problem hiding this comment.
Worth addressing (non-blocking, but real)
e2e/seed/seed.ts:49— the precondition check only accepts200or403from the login attempt. If adocker:e2erun gets interrupted after the password's already been changed but before teardown, the next seed attempt gets a401and throws instead of recognizing "already seeded." Widening the check to treat401as "already done" would make local re-runs more forgiving.e2e/fixtures/auth.ts:24—pageandapiMockeach callrealLoginindependently in real-API mode. Any future test that uses both fixtures together would log in twice, andapiMock's CSRF capture wouldn't get wired up. Worth having one fixture compose the other so there's a single login per test.
Minor, for whenever
e2e/fixtures/api-mock.ts:114— the real-mode CSRF capture listener isn't awaited, so there's a small race wheregetRealCsrfToken()could still be unset when a test reads it.e2e/fixtures/api-mock.ts:171—mockUnauthorized()is a no-op underE2E_REAL_API=true; fine today since nothing uses it yet, just flagging so it doesn't quietly mask a future 401 test.Dockerfile:37and.env.example:70still mention the "testing profile" that this PR replaced withdocker-compose.e2e.yml— just a stale comment.
Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
marekdano
approved these changes
Aug 27, 2026
marekdano
left a comment
Contributor
There was a problem hiding this comment.
The PR looks good now! Thanks for addressing all issues.
LGTM 🚀
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.
Closes IBM/mcp-context-forge#6215
Summary
Adds
npm run e2e:docker: a self-contained real-backend e2e run. A new testing Compose profile brings up the UI + a real ContextForge gateway (ghcr.io/ibm/mcp-context-forge) + Redis, seeds a login user, runs the full suite against it, tears down after.217/217 passing, mocked and real.
Changes
docker-compose.yml/Dockerfile: new gateway service under a testing profile; VITE_ENABLE_TOOL_PREVIEW build arg.e2e/seed/seed.ts: clears the bootstrap admin's forced password-change so seeded creds work.api-mock.ts: real login now runs for every spec's defaultmockSession(), not justauth/. The ~11 mocked-data suites (plugins, tools, resources, …) now run authenticated too.password-change-required.spec.ts, a/dashboard/iheading assertion that only ever passed by matching an error string, worker-count contention against the sqlite-backed test gateway, and a stale-image bug ine2e:docker:up(missing--build).Known gap
Freshly-seeded gateway has zero servers/tools, blocked on an upstream role-bootstrap bug in the pinned image, not fixed here.
TODOleft inseed.ts.Testing
npm run e2eandnpm run e2e:dockerboth 217/217. Unit tests unaffected.