Skip to content

fix(e2e): serve MiniRouter in place instead of the non-existent --template#152

Merged
zzal merged 1 commit into
mainfrom
fix/router-e2e-minirouter
Jul 6, 2026
Merged

fix(e2e): serve MiniRouter in place instead of the non-existent --template#152
zzal merged 1 commit into
mainfrom
fix/router-e2e-minirouter

Conversation

@zzal

@zzal zzal commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

The CI playwright-e2e job (default config, all servers) was red with no test signal — and would be on any PR carrying the run-e2e label, including clean main. Root cause: the router e2e scaffolds 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 fails at Playwright config load:

Error: unknown template "MiniRouter" — available: EdgeCases, HelloWorld, MissionControl, QueryDemo, SwiflowUIDemo, TodoCRUD

That throws during prepareDemo(), aborting the entire Playwright run before any spec executes.

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 and no .e2e-cache copy. Applied to:

  • playwright.config.ts (the default config CI uses) — const ROUTER_DIR = join(REPO_ROOT, "examples", "MiniRouter"), served via swiflow dev --path.
  • playwright.router.config.ts (router-only) — same, and it now calls ensureCli() directly (like playwright.edgecases.config.ts) since it no longer routes through prepareDemo.

No change to harness.ts or InitCommand — the "MiniRouter is read-only, not scaffoldable" design is respected; only the e2e config's wrong assumption is corrected.

Test plan

  • Router Playwright suite 3/3 locally (--config=playwright.router.config.ts): Home renders on load, Link navigation changes the hash + renders About, Back button restores Home.
  • This unblocks the pipeline Playwright e2e for every PR (it was aborting the whole run at config load).

🤖 Generated with Claude Code

…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>
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

📦 Bundle size

Artifact Baseline This PR Δ
App.wasm 5.06 MB 5.15 MB +1.90%
App.wasm (gzip) 1.80 MB 1.84 MB +2.21%
JS runtime 54.5 KB 54.5 KB +0.00%
JS runtime (gzip) 11.3 KB 11.3 KB +0.00%
Total (gzip) 1.81 MB 1.85 MB +2.19%

✅ Within budget (≤5% growth allowed).

Baseline: Swift 6.3, WASM SDK 6.3-RELEASE, measured 2026-06-18.

@zzal zzal merged commit d98666e into main Jul 6, 2026
6 checks passed
@zzal zzal deleted the fix/router-e2e-minirouter branch July 6, 2026 18:38
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>
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