Skip to content

test(e2e): Playwright coverage for all 4 example apps [closes #251]#282

Merged
EmersonBraun merged 1 commit intomainfrom
foundation/e2e-examples
Apr 15, 2026
Merged

test(e2e): Playwright coverage for all 4 example apps [closes #251]#282
EmersonBraun merged 1 commit intomainfrom
foundation/e2e-examples

Conversation

@EmersonBraun
Copy link
Copy Markdown
Owner

Summary

End-to-end Playwright tests for every example app in the monorepo. Closes #251.

Coverage

Example Type Test approach Status
example-runtime Node headless Spawn tsx, assert stdout ✅ PASS
example-ink Node terminal UI Spawn, capture first Ink frame ✅ PASS
example-react Vite + React SPA Dev server + page navigation ✅ PASS*
example-multi-agent Vite + React SPA Dev server + page navigation ✅ PASS*

* Browser mount assertions (chat UI renders, send message, tool call visible) are test.describe.skip-ed with TODO(#281). Root cause: @agentskit/core imports fs/promises which crashes browser consumers at runtime — see #281 for the tracking issue. The two SPA tests still exercise Vite startup + index HTML, catching bundle/build regressions independently.

Local result: 4 passed, 5 skipped, 0 failed.

Infrastructure

  • playwright.config.ts — sequential workers (examples share ports), chromium only, 60s timeout, github reporter in CI
  • tests/e2e/helpers/dev-server.ts — shared startDevServer + runNodeExample helpers with stdout-based ready detection and clean SIGTERM teardown
  • .github/workflows/e2e.yml — runs on every PR and push to main; uploads playwright-report/ + test-results/ artifacts (7-day retention)

Scripts

  • pnpm test:e2e — build packages + run all Playwright tests
  • pnpm test:e2e:ui — Playwright UI mode for local iteration

Why the fs/promises issue wasn't fixed in this PR

Scope discipline. Fixing it means moving loadTsConfig out of @agentskit/core into @agentskit/cli (or similar), which touches a separate package's public surface. Lands as its own PR; tracked in #281 at P0 priority for the Phase 0 launch.

Test plan

Refs #251 #281 #211

EmersonBraun added a commit that referenced this pull request Apr 15, 2026
…oses #281]

Manifesto principle 1 requires @agentskit/core to work in any environment
(Node, Deno, edge, browser). The previous implementation imported
node:fs/promises at module load via config.ts, which crashed every
browser consumer at runtime with 'Module fs/promises has been
externalized for browser compatibility.'

This PR relocates the two Node-only helpers:

  createFileMemory  (packages/core/src/memory.ts)
    -> fileChatMemory  (packages/memory/src/file-chat.ts)

  loadConfig + AgentsKitConfig + LoadConfigOptions  (packages/core/src/config.ts)
    -> @agentskit/cli (packages/cli/src/config.ts)

What stays in @agentskit/core (all universal):
  createInMemoryMemory     works in every environment
  createLocalStorageMemory already guards on typeof localStorage

Consumer migrations:
- Re-exports of createFileMemory from @agentskit/react and @agentskit/ink
  are dropped (they were always Node-only; browser consumers got a
  broken export)
- apps/example-ink switched to fileChatMemory from @agentskit/memory
- @agentskit/cli internals now import loadConfig from its own ./config

Tests relocated:
- packages/core/tests/config.test.ts  -> packages/cli/tests/config.test.ts
- packages/core/tests/memory.test.ts createFileMemory block split out
  -> packages/memory/tests/file-chat.test.ts

Changeset declares:
  @agentskit/core          major (breaking — exports removed)
  @agentskit/memory        minor (new fileChatMemory export)
  @agentskit/cli           minor (new loadConfig public export)
  @agentskit/react         minor (dropped re-export)
  @agentskit/ink           minor (dropped re-export)

Verified:
- packages/core/dist/*.js contains zero fs/path imports
- apps/example-react mounts in a real browser (was empty root before)
- pnpm build succeeds for every package
- Ink test failure is pre-existing (ink@7 incompat fixed in #265),
  not caused by this change

Unblocks the 5 browser-side E2E tests currently skipped in #282.

Closes #281
EmersonBraun added a commit that referenced this pull request Apr 15, 2026
…oses #281]

Manifesto principle 1 requires @agentskit/core to work in any environment
(Node, Deno, edge, browser). The previous implementation imported
node:fs/promises at module load via config.ts, which crashed every
browser consumer at runtime with 'Module fs/promises has been
externalized for browser compatibility.'

This PR relocates the two Node-only helpers:

  createFileMemory  (packages/core/src/memory.ts)
    -> fileChatMemory  (packages/memory/src/file-chat.ts)

  loadConfig + AgentsKitConfig + LoadConfigOptions  (packages/core/src/config.ts)
    -> @agentskit/cli (packages/cli/src/config.ts)

What stays in @agentskit/core (all universal):
  createInMemoryMemory     works in every environment
  createLocalStorageMemory already guards on typeof localStorage

Consumer migrations:
- Re-exports of createFileMemory from @agentskit/react and @agentskit/ink
  are dropped (they were always Node-only; browser consumers got a
  broken export)
- apps/example-ink switched to fileChatMemory from @agentskit/memory
- @agentskit/cli internals now import loadConfig from its own ./config

Tests relocated:
- packages/core/tests/config.test.ts  -> packages/cli/tests/config.test.ts
- packages/core/tests/memory.test.ts createFileMemory block split out
  -> packages/memory/tests/file-chat.test.ts

Changeset declares:
  @agentskit/core          major (breaking — exports removed)
  @agentskit/memory        minor (new fileChatMemory export)
  @agentskit/cli           minor (new loadConfig public export)
  @agentskit/react         minor (dropped re-export)
  @agentskit/ink           minor (dropped re-export)

Verified:
- packages/core/dist/*.js contains zero fs/path imports
- apps/example-react mounts in a real browser (was empty root before)
- pnpm build succeeds for every package
- Ink test failure is pre-existing (ink@7 incompat fixed in #265),
  not caused by this change

Unblocks the 5 browser-side E2E tests currently skipped in #282.

Closes #281
EmersonBraun added a commit that referenced this pull request Apr 15, 2026
…oses #281] (#283)

Manifesto principle 1 requires @agentskit/core to work in any environment
(Node, Deno, edge, browser). The previous implementation imported
node:fs/promises at module load via config.ts, which crashed every
browser consumer at runtime with 'Module fs/promises has been
externalized for browser compatibility.'

This PR relocates the two Node-only helpers:

  createFileMemory  (packages/core/src/memory.ts)
    -> fileChatMemory  (packages/memory/src/file-chat.ts)

  loadConfig + AgentsKitConfig + LoadConfigOptions  (packages/core/src/config.ts)
    -> @agentskit/cli (packages/cli/src/config.ts)

What stays in @agentskit/core (all universal):
  createInMemoryMemory     works in every environment
  createLocalStorageMemory already guards on typeof localStorage

Consumer migrations:
- Re-exports of createFileMemory from @agentskit/react and @agentskit/ink
  are dropped (they were always Node-only; browser consumers got a
  broken export)
- apps/example-ink switched to fileChatMemory from @agentskit/memory
- @agentskit/cli internals now import loadConfig from its own ./config

Tests relocated:
- packages/core/tests/config.test.ts  -> packages/cli/tests/config.test.ts
- packages/core/tests/memory.test.ts createFileMemory block split out
  -> packages/memory/tests/file-chat.test.ts

Changeset declares:
  @agentskit/core          major (breaking — exports removed)
  @agentskit/memory        minor (new fileChatMemory export)
  @agentskit/cli           minor (new loadConfig public export)
  @agentskit/react         minor (dropped re-export)
  @agentskit/ink           minor (dropped re-export)

Verified:
- packages/core/dist/*.js contains zero fs/path imports
- apps/example-react mounts in a real browser (was empty root before)
- pnpm build succeeds for every package
- Ink test failure is pre-existing (ink@7 incompat fixed in #265),
  not caused by this change

Unblocks the 5 browser-side E2E tests currently skipped in #282.

Closes #281
Closes #251. Adds end-to-end Playwright tests that exercise each example
app, ensuring real demos don't regress silently.

Coverage:

  example-runtime      Node headless — spawns tsx, asserts stdout     PASS
  example-ink          Node terminal UI — spawns, checks first frame  PASS
  example-react        Vite + React SPA — dev server, navigate        PASS*
  example-multi-agent  Vite + React SPA — dev server, navigate        PASS*

  * Browser-side mount tests (chat UI renders, send message) skipped
    with TODO(#281). @agentskit/core currently imports fs/promises
    which crashes browser consumers at runtime. The two SPA tests here
    still assert the Vite dev server starts and serves index HTML —
    catches bundle/build regressions. Full mount tests re-enable
    after #281 lands.

Infrastructure:
- playwright.config.ts — sequential workers (examples share ports),
  chromium only, 60s timeout, github reporter in CI
- tests/e2e/helpers/dev-server.ts — shared startDevServer + runNodeExample
  helpers with stdout-based ready detection and clean SIGTERM teardown
- .github/workflows/e2e.yml — runs on every PR and push to main, uploads
  playwright-report + test-results as artifacts (7-day retention)

Scripts:
- pnpm test:e2e     — builds packages + runs all Playwright tests
- pnpm test:e2e:ui  — Playwright UI mode for local iteration

Local result: 4 passed, 5 skipped, 0 failed.

Refs #251 #281 #211
@EmersonBraun EmersonBraun force-pushed the foundation/e2e-examples branch from 51c1956 to f65ea65 Compare April 15, 2026 12:27
@EmersonBraun EmersonBraun merged commit 626ba50 into main Apr 15, 2026
@EmersonBraun EmersonBraun deleted the foundation/e2e-examples branch April 15, 2026 12:27
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.

[P0.40] E2E Playwright on 4 apps/example-*

1 participant