Skip to content

chore(test): run unit tests with vitest and add playwright e2e tests - #186

Open
brandyscarney wants to merge 11 commits into
chore/fix-lint-warningsfrom
chore/add-test-infrastructure
Open

brandyscarney wants to merge 11 commits into
chore/fix-lint-warningsfrom
chore/add-test-infrastructure

Conversation

@brandyscarney

@brandyscarney brandyscarney commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

What This Does

Sets up Vitest for the unit tests, adds Playwright end-to-end tests, runs both in CI, and removes unused dependencies.

New Behavior

  • npm run test:unit runs the unit tests once (Vitest). npm run test:unit:watch reruns them on changes.
  • npm run test:e2e runs the Playwright tests in Mobile Chrome (Pixel 7). It starts the dev server on port 4314, a port reserved for this app's e2e tests so it never reuses another app's server. The first time, install the browser with npx playwright install chromium.
  • npm test runs both.
  • npm run lint also type-checks the Playwright tests and playwright.config.ts. Playwright and ESLint don't type-check on their own, so a type error in an e2e spec would otherwise pass both lint and the e2e run.
  • The Test jobs in CI now run the unit tests, and every pull request also runs an E2E job on Linux, which uploads the Playwright HTML report.

Changes

  • Playwright config and a smoke spec in e2e/: the first visit shows the tutorial, and Skip opens the schedule.
  • Vitest with jsdom. The existing snapshot test had no runner; it's replaced with a test that renders the app and checks it opens the tutorial on first launch. It waits up to 5 seconds, since loading the data and routing can take longer than Testing Library's default 1 second on slow CI runners.
  • Test dependencies match the React tutorial app: Testing Library 9 → 16 and jest-dom 6 (via @testing-library/jest-dom/vitest). Removes @types/jest.
  • src/setupTests.ts cleans up Testing Library renders after each test and stubs matchMedia and scrollTo, which jsdom doesn't implement.
  • Vitest only collects tests from src/, and ESLint ignores Playwright's output folders.
  • tsconfig.e2e.json and a typecheck:e2e script (tsc -p tsconfig.e2e.json), run from lint before Prettier.
  • @types/node 26 as a dev dependency (for process.env in playwright.config.ts).
  • Replaces react-app-env.d.ts, a leftover Create React App reference to react-scripts, with vite-env.d.ts referencing vite/client, like the React tutorial app.
  • Removes unused dependencies: react-redux, @types/react-redux, and react-leaflet.
  • CI: the Test jobs run npm run test:unit, and the new E2E job runs npm run test:e2e, with Node from .nvmrc.
  • renovate.json: the testing group covers Testing Library, Vitest, jsdom, and Playwright.
  • A Testing section in CONTRIBUTING.md, listed in its table of contents.
  • Tests clear localStorage after each test, since Capacitor Preferences stores its data there on the web. The app test finds its data files relative to the test file instead of the working directory.

Notes

  • This PR sets up the test tooling with smoke tests. Tests for the app's features will come in a follow-up.
  • Matches the test setup in the React tutorial app.

@brandyscarney
brandyscarney added this pull request to stack #185 October 23, 2026 17:08
@brandyscarney
brandyscarney requested a review from a team as a code owner October 23, 2026 17:08
@brandyscarney
brandyscarney requested review from thetaPC and removed request for a team October 23, 2026 17:08
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-react-conference-app Ready Ready Preview Nov 11, 2026 9:43pm UTC

Request Review

@brandyscarney
brandyscarney force-pushed the chore/add-test-infrastructure branch from 34655d3 to fec7c98 Compare October 23, 2026 17:40
@brandyscarney
brandyscarney force-pushed the chore/add-test-infrastructure branch from bddbfe5 to 2d00ae8 Compare October 23, 2026 19:17
@brandyscarney
brandyscarney force-pushed the chore/add-test-infrastructure branch from 352617f to 04f0fab Compare November 9, 2026 21:30
@brandyscarney
brandyscarney force-pushed the chore/add-test-infrastructure branch from 32cebfc to e3ecfbc Compare November 11, 2026 20:23
@brandyscarney
brandyscarney force-pushed the chore/add-test-infrastructure branch from e3ecfbc to e28aa24 Compare November 11, 2026 20:27
@brandyscarney
brandyscarney force-pushed the chore/add-test-infrastructure branch from e28aa24 to a8aa35d Compare November 11, 2026 20:40
@brandyscarney
brandyscarney force-pushed the chore/add-test-infrastructure branch from a8aa35d to 11a1330 Compare November 11, 2026 20:54

This branch was successfully deployed

1 active deployment
Preview — f8bcee9c Deployed Nov 11, 2026 by vercel[bot]
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