fix(e2e): serve MiniRouter in place instead of the non-existent --template#152
Merged
Conversation
…plate The router Playwright e2e scaffolded its demo via `swiflow init --template MiniRouter`, but InitCommand deliberately excludes MiniRouter (and RegionDemo / AsyncFetch) from the scaffoldable `--template` catalogue — they "exist for reading, not scaffolding." So the command failed at config load (`unknown template "MiniRouter"`), aborting the ENTIRE Playwright run before any spec executed — including on clean main. That's why the CI `playwright-e2e` job (default config, all servers) was red with no test signal. Fix: build examples/MiniRouter IN PLACE, matching the existing EdgeCases pattern (`swiflow dev --path <examples/X>`). MiniRouter's own Package.swift points at the repo's Swiflow via `../..`, so it compiles against local source with no scaffold. Applied to both the default config (CI) and the router-only config (which now calls `ensureCli()` directly, like the edgecases-only config, since it no longer goes through prepareDemo). Verified locally: `--config=playwright.router.config.ts` → 3/3 (Home renders, Link navigation, Back button). Unblocks the pipeline Playwright e2e for every PR. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📦 Bundle size
✅ Within budget (≤5% growth allowed). Baseline: Swift 6.3, WASM SDK 6.3-RELEASE, measured 2026-06-18. |
2 tasks
zzal
added a commit
that referenced
this pull request
Jul 6, 2026
The CI `playwright-e2e` job ran the default config, which has no testMatch and so runs ALL specs — but starts only 4 servers (counter/router/sw/edgecases). It never served SwiflowUIDemo (datatable/dropdown), RegionDemo (region), or the TodoCRUD backend, so those 16 specs failed "element not found." This was masked for ages by the MiniRouter config-load abort (fixed in #152); once that cleared, the gap surfaced. - Default config `testIgnore`s the 4 orphan spec groups — they collide on port :3004 (RegionDemo vs SwiflowUIDemo) so can't share the default config's parallel servers, and todocrud needs the real Bun+SQLite backend. - CI e2e step now runs three configs: `npm test` (default) then `test:regions` and `test:swiflowui`, sequentially, accumulating status so one red doesn't hide the rest. TodoCRUD stays in the separate run-e2e-backend job. - Added the missing `test:swiflowui` npm script (the swiflowui config existed but was never scripted, so datatable/dropdown had NEVER run against their server). - Fixed the latent bug that surfaced: `datatable.spec.ts` pager test used an unscoped getByRole("button", {name:"Next"}) that also matched the demo's wizard "Next" button — scoped it to `.sw-table__pager`. Verified locally: test:swiflowui 10/10, test:regions 1/1. The default config's served specs are the 40 that already passed in CI; todocrud unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
The CI
playwright-e2ejob (default config, all servers) was red with no test signal — and would be on any PR carrying therun-e2elabel, including cleanmain. Root cause: the router e2e scaffolds its demo viaswiflow init --template MiniRouter, butInitCommanddeliberately excludes MiniRouter (and RegionDemo / AsyncFetch) from the scaffoldable--templatecatalogue — they "exist for reading, not scaffolding." So the command fails at Playwright config load:That throws during
prepareDemo(), aborting the entire Playwright run before any spec executes.Fix
Build
examples/MiniRouterin place, matching the existing EdgeCases pattern (swiflow dev --path <examples/X>). MiniRouter's ownPackage.swiftpoints at the repo's Swiflow via../.., so it compiles against local source with no scaffold and no.e2e-cachecopy. Applied to:playwright.config.ts(the default config CI uses) —const ROUTER_DIR = join(REPO_ROOT, "examples", "MiniRouter"), served viaswiflow dev --path.playwright.router.config.ts(router-only) — same, and it now callsensureCli()directly (likeplaywright.edgecases.config.ts) since it no longer routes throughprepareDemo.No change to
harness.tsorInitCommand— the "MiniRouter is read-only, not scaffoldable" design is respected; only the e2e config's wrong assumption is corrected.Test plan
--config=playwright.router.config.ts): Home renders on load, Link navigation changes the hash + renders About, Back button restores Home.🤖 Generated with Claude Code