Skip to content

End-to-end tests: both apps in a real browser, in CI on every pull request - #33

Closed
Torgh wants to merge 4 commits into
mainfrom
e2e-tests
Closed

Torgh wants to merge 4 commits into
mainfrom
e2e-tests

Conversation

@Torgh

@Torgh Torgh commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Adds Playwright end-to-end tests. Until now, UI changes such as #21 (dragging, dialogs, maps) and the budget were only checked by hand in a browser.

What is tested (11 tests, about 30 s locally)

Desktop app (production build, next start):

  1. Demo trip: 7 days, “📝 2 to sort out”, “💰 €1,307 of €1,500”, a timing warning, the map's pins.
  2. Dragging: a card dragged with the mouse to another day stays there after a reload.
  3. Card editor:
    • adding a card;
    • the price hint warns about the missing currency in “1500” and reads “€12.50”;
    • Paid, saving (the header total goes up), deleting (it goes back).
  4. To sort out: the to-do list shows what is waiting and what is still to book.
  5. Budget dialog:
    • a Paid tick moves the totals;
    • switching to PLN converts the total and the limit, using the fixed test rates.
  6. Trip settings: a later last day adds a day.
  7. Map: a pin highlights its card.
  8. Export and print: the JSON export parses back with parseTripFile, and the print page shows the bookings and the total.
  9. Saving: “Saved on this PC”, and the trip file lands in the data folder.

Phone app (Vite build, Pixel 7 viewport):

  1. Days, the day's spend, “✓ paid”, swiping between days, the Budget tab, and a budget row leading to its day.
  2. Importing a .tripdeck.json file.

How it stays reliable

  • Offline, no keys. Requests leaving the machine are blocked in the browser. The map gets a plain style; the pins still show. Exchange rates are fixed (1 EUR = 4.25 PLN). The app's /api/route, /api/places, /api/elevation, /api/timezone and /api/ai answer 503, as they do offline, so the board shows straight-line estimates.
  • No keys in the builds. The apps are started with empty Google and Anthropic variables, which win over .env.local.
  • Separate data. The desktop app gets a temporary TRIPDECK_HOME set to “This PC” storage, so your ~/.tripdeck and OneDrive are never touched.
  • Errors fail tests. Any uncaught error or console.error in a page fails the test; blocked requests aside.
  • Service workers are blocked, so nothing slips past the stubs.

Checked

  • 11/11 pass locally (Edge on Windows), and 55/55 with --repeat-each=5 in parallel.
  • The tests catch real breakage. I broke two things on purpose: dropped the limit from the budget in the header, and broke swiping on the phone. 3 tests failed, as they should; the code was restored afterwards.
  • Typecheck (TS 7), lint and the 288 unit tests pass.

CI

  • New job “End-to-end tests (Playwright)”: it installs Chromium, runs bun run test:e2e and, on failure, uploads the report with screenshots and traces as an artifact (kept 7 days).
  • Once it has proven stable, it can be added to the required checks of protect-main.

Locally

bun run test:e2e. On Windows it uses the installed Edge. Elsewhere, run bunx playwright install chromium once.

🤖 Generated with Claude Code

Torgh and others added 4 commits October 23, 2026 00:04
…quest

Playwright builds and starts the desktop app (production build) and the
phone app (Vite build) and drives them:
- desktop: the demo trip (days, to-dos, budget, map), dragging a card to
  another day and keeping it after a reload, the card editor with price
  hints, Paid and delete, the to-do list, the budget dialog (paid ticks,
  currency and limit conversion), trip settings, a map pin highlighting
  its card, JSON export that parses back, the print page, and saving the
  trip to disk
- phone: days, swiping, the budget tab and a budget row leading to its
  day, and importing a trip file

They run offline and without keys: the browser gets a plain map style
and fixed exchange rates, and the app's route, place and AI lookups
answer as if offline. The data folder is a temporary one. Any uncaught
error in a page fails the test. CI uploads screenshots and traces of
failed tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Linux the card was cut off at the bottom of its day, so the mouse
selected text instead of starting a drag. The test now also checks that
the drag started.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The desktop app is tested in the browsers it supports: the installed
Chrome and Edge, and Playwright's Firefox. The phone app runs in
Android's WebView (Chromium), so Chrome stands in for it. CI runs one
job per browser, side by side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing a browser

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Torgh

Torgh commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

Dropping the end-to-end test idea for now.

@Torgh Torgh closed this Oct 23, 2026
@Torgh
Torgh deleted the e2e-tests branch October 23, 2026 14:25
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