feat(ui-test): Playwright ui tests foundation stage 0#2180
feat(ui-test): Playwright ui tests foundation stage 0#2180cjlg-soloio wants to merge 13 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Introduces a foundational Playwright E2E test setup for the UI, including a dependency-free stub backend and CI workflow, to enable end-to-end coverage of multi-step user flows against mocked API responses.
Changes:
- Added Playwright configuration, fixtures, and an initial smoke spec to validate the app loads against a stubbed backend.
- Implemented a standalone Node HTTP stub backend plus typed mock builders for specs.
- Wired Playwright into UI scripts, gitignore, and a dedicated GitHub Actions workflow.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/playwright/tsconfig.json | Adds Playwright-local TS config extending the UI tsconfig. |
| ui/playwright/tests/smoke.spec.ts | Adds initial Stage 0 smoke test asserting Agents page loads without error state/page errors. |
| ui/playwright/README.md | Documents Playwright scope, mocking approach, layout, and conventions. |
| ui/playwright/mocks/server.mjs | Adds dependency-free stub backend serving /api/* responses used by server actions. |
| ui/playwright/mocks/data.ts | Adds typed mock builders for assertions and future scenario plumbing. |
| ui/playwright/fixtures/test.ts | Adds shared fixture to reset stub and bypass onboarding via localStorage init script. |
| ui/playwright.config.ts | Adds Playwright runner config including webServer boot of stub + next dev. |
| ui/package.json | Adds Playwright test scripts and @playwright/test dev dependency. |
| ui/package-lock.json | Locks @playwright/test and updates Playwright packages. |
| ui/.gitignore | Ignores Playwright report/output directories. |
| .github/workflows/ui-playwright.yaml | Adds CI workflow to run Playwright tests on UI changes and upload reports. |
Files not reviewed (1)
- ui/package-lock.json: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4bed054 to
4e52362
Compare
|
dco is red |
08b3cfc to
5d1b617
Compare
Signed-off-by: Carlos Logroño Guerrero <carlos.logrono@solo.io>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: cjlg-soloio <carlos.logrono@solo.io> Signed-off-by: Carlos Logroño Guerrero <carlos.logrono@solo.io>
- Force single Playwright worker unconditionally (shared stub + Next server) - Default req.method/req.url before parsing in the stub server - Fail fast on stub reset failure in CI; stay non-fatal locally - Drop unused pull-requests:write permission from the workflow Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Logroño Guerrero <carlos.logrono@solo.io>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Logroño Guerrero <carlos.logrono@solo.io>
Pairs fullyParallel with workers: 1 so both stay off until per-test data isolation lands, preventing tests from silently racing against the shared stub backend if the worker count is raised. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Logroño Guerrero <carlos.logrono@solo.io>
- Pin STUB_PORT on the stub webServer so a shell-set STUB_PORT can't misbind it - Stop reusing the dev server so BACKEND_INTERNAL_URL always applies (no silent stub bypass) - Type ToolServerListEntry as the real RemoteMCPServerResponse for compile-time drift detection - Drop no-op **/*.mjs from the playwright tsconfig include Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Logroño Guerrero <carlos.logrono@solo.io>
081fdd1 to
a0a9d05
Compare
…ght video Resolve Charlesthebird's review on PR kagent-dev#2180: - Playwright workflow now reads node-version-file: ui/.nvmrc instead of a hardcoded major version. - Remove Cypress entirely: delete cypress.config.ts and cypress/e2e/smoke.cy.ts, drop the cypress and now-unused start-server-and-test devDeps plus the test:e2e/test:e2e:cypress scripts, and remove the dead CYPRESS_INSTALL_BINARY env from the ui-playwright, ci, and ui-chromatic workflows and the Dockerfile. - Enable Playwright video recording (video: "on"); artifacts already upload via the existing test-results step. - De-Cypress the Playwright README (Jest, Vitest, Storybook untouched). data.ts is intentionally kept — it is consumed by the stacked stage-2 PR. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Logroño Guerrero <carlos.logrono@solo.io>
Restore a conventional test:e2e entrypoint pointing at the Playwright suite, per review feedback on kagent-dev#2180. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Logroño Guerrero <carlos.logrono@solo.io>
|
@cjlg-soloio there are some CI failures: https://github.com/kagent-dev/kagent/actions/runs/29391678324/job/87276477369?pr=2180 |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Carlos Logroño Guerrero <carlos.logrono@solo.io>
|
Superseded by #2262. This PR's branch name contained parentheses ( |
### Description --- *🤖 written by Claude (start)* Follow-up to a review comment on #2180: pins the npm version via the `packageManager` field so `npm install` is reproducible and `ui/package-lock.json` stops picking up metadata churn across npm versions. `ui/.nvmrc` pins Node **24.13.0**, which bundles **npm 11.6.2** — so the field is set to `npm@11.6.2`, consistent with the Node version CI already reads from `.nvmrc`. ### Files **Modified** - `ui/package.json` — adds top-level `"packageManager": "npm@11.6.2"` - `ui/package-lock.json` — regenerated under npm 11.6.2 to match the pin; metadata-only diff (`peer`/`optional` flags), no dependency version changes ### Testing ``` cd ui corepack enable # so the pin is enforced locally npm --version # -> 11.6.2 npm pkg get packageManager # -> "npm@11.6.2" ``` ### Change type chore / cleanup — dev tooling only. No product or runtime code changed. ### Changelog `NONE` --- *🤖 written by Claude (end)* --------- Signed-off-by: Carlos Logroño Guerrero <carlos.logrono@solo.io> Signed-off-by: Nicholas Bucher <behappy54321@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Nicholas Bucher <behappy54321@gmail.com>
Description
Adds the Stage 0 foundation for Playwright page-level E2E testing of the kagent UI, running against a mocked backend with no cluster required.
The suite targets the one gap nothing else covers — multi-step user flows across components:
The core design challenge: the UI fetches data server-side via Next.js server actions, so browser-level
page.route("**/api/**")intercepts nothing. Instead, this PR boots a dependency-free stub backend and redirects Next's server-side fetch to it viaBACKEND_INTERNAL_URL— whichgetBackendUrl()inui/src/lib/utils.tsalready honors. Playwright'swebServerblock starts both the stub (:8899) andnext dev(:8001) automatically.This is foundation-only: config, stub backend, shared fixture, CI workflow, and a single smoke test. The helper/driver library and per-test scenarios land in Stage 1; feature flows in Stage 3 (see
ui/playwright/README.md).Files
New
ui/playwright.config.tsui/playwright/mocks/server.mjshttponly); serves happy-path payloads mirroringsrc/types/index.ts; exposes/__mock/health&/__mock/resetui/playwright/mocks/data.tsui/playwright/fixtures/test.tstest/expectfixture; resets stub per test and bypasses first-run onboardingui/playwright/tests/smoke.spec.tsui/playwright/tsconfig.jsonui/playwright/README.md.github/workflows/ui-playwright.yamlui/**); installs chromium, runstest:pw, uploads reportModified
ui/package.json—@playwright/testdev dep +test:pw/test:pw:ui/test:pw:debugscriptsui/package-lock.json— lockfile updatesui/.gitignore— ignoresplaywright-report,playwright/test-results,playwright/.cacheTesting
Playwright starts the stub backend and dev server automatically. The smoke test passes when the home page renders the Agents, no "Error Encountered" state appears, and no uncaught page errors occur. CI runs the same on any
ui/**change.Change type
test / ci — new test infrastructure and CI workflow. No product or runtime code changed.
Changelog
Stage 1 of 3 playwright tests for ui