Skip to content

Add Playwright end-to-end tests against the mock-data app - #23

Merged
kippolitov merged 1 commit into
mainfrom
test/e2e-playwright
Oct 6, 2026
Merged

kippolitov merged 1 commit into
mainfrom
test/e2e-playwright

Conversation

@kippolitov

@kippolitov kippolitov commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Why

The project had no automated end-to-end tests. Browser-level checks were done by hand against npm run dev:mock, so nothing caught a broken flow across pages (for example, a dose logged on the dashboard not appearing on the calendar) unless someone walked through it.

What changes

13 Playwright tests in e2e/, run with npm run test:e2e (or npm run test:e2e:ui for the interactive runner). Playwright starts the app itself in mock mode on port 3100, so the tests need no Power Platform access, no secrets and no power.config.json.

Area Covered
Navigation sidebar reaches every page; a page opens directly from its URL
Medications add; Scheduled Day appears for weekly; switch to Inactive; delete with confirmation
Log intake logging an overdue dose clears it from the dashboard; a logged injection shows on the calendar
Calendar selecting a past day lists its logs; month navigation and Today
Analytics breakdown table; CSV export; the medication filter narrows the export

Supporting changes:

  • CI: a new e2e job in ci.yml, parallel to the existing ci job. It installs Chromium, runs the suite and uploads the Playwright report as an artifact. The existing job is untouched.
  • Vitest excludes e2e/, so the two runners don't pick up each other's files.
  • Type-check: e2e/ and playwright.config.ts are included in tsconfig.node.json.
  • .vscode/extensions.json recommends the Vitest and Playwright extensions, which is what makes both suites appear in the VS Code Testing panel.
  • .gitignore and the README cover the Playwright output folders and the new commands.

No application code changes.

Two things worth knowing when reading the tests

  • The browser clock is pinned to Wednesday 11 March 2026, noon UTC (e2e/fixtures.ts). The mock seed data is built relative to "now", so without this, which doses are due or overdue would depend on when the suite runs.
  • Mock data lives in browser memory and resets on a full page load. Tests that span pages move with the nav links, not page.goto().

Testing

  • npm run lint, tsc -b and the 164 Vitest tests pass.
  • The e2e suite passes locally, including three times in a row (--repeat-each=3).
  • It passes in a clean copy with CI=1 and without the local dev certificates or power.config.json, which is the state CI sees. The Power Apps Vite plugin logs a "missing power.config.json" error there; the dev server still starts.
  • It passes against a remotely connected browser, which is how the VS Code Playwright extension runs tests. This caught a real problem: the CSV tests first read the download through download.path(), which is unavailable in that mode. They now use saveAs().
  • The new e2e job passed on this PR's first CI run (55s), alongside the existing ci job, which includes actionlint on the edited workflow.

After merging

Merging to main triggers the usual Deploy to Dev. It redeploys the same app content, since nothing under src/ changed.

🤖 Generated with Claude Code

13 browser tests covering navigation, medications, intake logging, the
calendar and analytics. They run against `vite --mode mock`, so they need
no Power Platform access. The browser clock is pinned because the seed
data is built relative to "now".

- `npm run test:e2e` / `npm run test:e2e:ui`
- e2e/ is excluded from Vitest and included in the type-check
- CI gets a separate parallel `e2e` job that uploads the Playwright report
- .vscode/extensions.json recommends the Vitest and Playwright extensions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 6, 2026 06:20
@kippolitov
kippolitov merged commit 29ccd59 into main Oct 6, 2026
3 checks passed
@kippolitov
kippolitov deleted the test/e2e-playwright branch October 6, 2026 06:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The E2E job is outside the existing required ci merge check, so failures may not block merging.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds browser-level Playwright coverage for the mock-data application without requiring Power Platform access.

Changes:

  • Adds 13 deterministic end-to-end tests across core user flows.
  • Configures Playwright, TypeScript, Vitest, scripts, and documentation.
  • Runs E2E tests in CI and uploads reports.
File Description
vite.config.ts Excludes Playwright tests from Vitest.
tsconfig.node.json Type-checks Playwright configuration and tests.
README.md Documents E2E workflow and commands.
playwright.config.ts Configures Chromium and the mock server.
package.json Adds Playwright dependency and scripts.
package-lock.json Locks Playwright packages.
e2e/​navigation.spec.ts Tests navigation and direct URLs.
e2e/​medications.spec.ts Tests medication management.
e2e/​log-intake.spec.ts Tests logging flows across pages.
e2e/​fixtures.ts Pins time and provides locators.
e2e/​calendar.spec.ts Tests calendar details and navigation.
e2e/​analytics.spec.ts Tests analytics and CSV exports.
.vscode/​extensions.json Recommends testing extensions.
.gitignore Ignores Playwright output.
.github/​workflows/​ci.yml Adds the parallel E2E job.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/ci.yml

# Browser tests against the mock-data app (`vite --mode mock`): no Power
# Platform access and no secrets, so it runs as its own parallel job.
e2e:
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.

2 participants