Compare commits

...

414 Commits

Author SHA1 Message Date
Maurice dbf011f026 fix(ci): use the bound database for map defaults and retry preloads
Write both defaults in one guarded statement so a SQLite source imported by the Postgres suite needs no Postgres lock. Release a failed speculative chunk promise so opening the map can retry it.
2026-11-30 16:45:35 +01:00
Maurice 54c54d5e65 fix(ci): repair map fixtures and keep renderer dependencies layered
Use the engine write lock for map defaults and clean the metadata-free test snapshot with Kysely. Model the Leaflet bridge option, keep the renderer failure state below the settings store, and make the tile tests independent of the transpiler quote style.
2026-11-30 16:34:55 +01:00
Maurice 5c133bbf40 feat(maps): start new installations with MapLibre Liberty 2026-11-30 16:24:50 +01:00
Maurice f814b0000d feat(maps): keep GL maps responsive through style and GPU changes 2026-11-30 16:24:49 +01:00
Maurice 69eacd5316 feat(settings): pick your own map template or the theme style for MapLibre
The MapLibre style picker offers two more entries after the OpenFreeMap
styles: OpenFreeMap that follows the light or dark theme (trek:ofm-auto),
and the user's own map template (trek:template), which brings the template
field under the picker, and the CARTO key for a CARTO template. Where the
trip map will draw the template with the classic 2D map (Amap, a host the
CSP does not name) the form says so and the preview shows that map. The
preview draws exactly what the trip map will.

Every place the forms load or save a MapLibre style keeps a keyword now,
where it used to turn it into Liberty on the first unchanged save: the
user form on desktop and phone (load, save, the phone's mirrored field,
a provider switch there and back) and the admin defaults (provider switch,
preset pick, typed style). The rules live in mapSettingsModel, so both
shells render from one decision:

- the template keyword with an empty template saves Liberty;
- switching from Leaflet with a template and an empty MapLibre slot
  preselects the template, shown and not saved until Save;
- Leaflet never writes a keyword into the Mapbox slot, and Mapbox shows its
  default for one.

New strings in all locales.
2026-11-30 16:22:53 +01:00
Maurice d39d544297 fix(offline): raster tiles a GL map fetches get a service worker cache of their own
Leaflet loads a tile as an image without CORS and the prefetch fetches it
no-cors, so map-tiles holds opaque answers. A GL map reads tiles with a
CORS fetch and cannot use one: once Leaflet had drawn an OpenTopoMap tile,
the GL tour layer failed on the same URL, and a MapLibre template would
fail the same way on every prefetched tile.

A CORS request for a raster preset's tile now goes to map-tiles-gl, which
keeps only readable answers, ahead of the Leaflet rules; images and the
no-cors prefetch stay in map-tiles. The matcher is written into the
service worker by its source text, so its host list is inline, and a test
holds it to the hosts the CSP lets a GL map fetch. OpenHikingMap and
CyclOSM stay out, their usage policies allow no offline copy.

The prefetch takes exactly one way per user: a template MapLibre draws on
such a host is fetched with CORS into map-tiles-gl, at the density the map
asks for, everything else as before. Clearing offline maps drops both
caches, and the iOS trim keeps both within its budget.
2026-11-30 16:22:52 +01:00
Maurice 32879dd528 feat(maps): MapLibre draws the user's map template on trek:template
A MapLibre user could only draw OpenFreeMap styles; a raster template was
Leaflet's alone. With maplibre_style set to trek:template, MapLibre now
draws the template the trip map already resolves for Leaflet (CARTO key,
keyless fallback and dark default included), so both renderers show the
same map. No stored row holds the keyword, so every existing user sees
exactly the map they saw before, and Mapbox is untouched.

- glBasemap turns the basemap spec into a raster style document (256px
  tiles as Leaflet requests them, the provider's deepest zoom, the credit,
  OpenFreeMap glyphs for the map's own labels) and resolves trek:ofm-auto
  to Liberty or OpenFreeMap Dark with the colour scheme.
- glCanFetch decides whether a GL map may fetch a basemap here: https on a
  host the CSP names, the shipped ones or MAP_EXTRA_CONNECT_HOSTS from the
  app config. GCJ-02 tiles (Amap) and other hosts are drawn by Leaflet for
  that render, the setting untouched.
- rasterHealth watches the first tiles of a template map: a CSP refusal or
  twelve failures without a success move every map drawing that template
  to Leaflet for the session, with a pill that says so.
- useEffectiveMapEngine decides this on the engine that actually draws and
  runs the offline checks after it; a stored raster template keeps drawing
  offline where Leaflet would keep the same tiles.
- The journey map uses the same hook: the same template, the same fallback
  and now the offline basemap with its pill as the trip map has it.
- A MapLibre raster style stops at zoom 19 like Leaflet; the Mapbox options
  stay as they were.

The offline pill moves to BasemapPill for both maps. Dropping the unused
imports there lowers the eslint baseline.
2026-11-30 16:22:52 +01:00
Maurice dc008ad7a5 feat(shared): keywords for MapLibre's template and theme styles
The maplibre_style slot gains two values that name no style document:
trek:template, which has MapLibre draw the user's map template the way
Leaflet does, and trek:ofm-auto, OpenFreeMap Liberty in the light theme
and OpenFreeMap Dark in the dark one. No stored row holds either, so no
saved setting changes its meaning, and a client that predates them reads
them as a foreign style and draws the default.

mapConnectHostAllows reads a host-source entry the way the browser reads
the policy (a wildcard never covers its apex, no port means the default
one), so the client can ask whether a GL map may fetch a tile before it
tries.
2026-11-30 16:22:52 +01:00
Maurice 06cd140bd3 chore(maps): keep the new map types local and lower the knip baseline
BasemapSpec and EffectiveMapEngine are only named inside their own
modules so far, so they stay unexported until a caller needs the name.
The basemap spec reads the Tours raster zoom limits from mapDefaults, so
one export there is no longer unused; the knip baseline follows.
2026-11-30 16:22:52 +01:00
Maurice 33f6540ec3 feat(settings): keep the account's settings for a start without a connection
/api/settings is never cached, so an app started offline ran on
DEFAULT_SETTINGS until the server answered: Leaflet instead of the map
the user chose, and the default units. The answer the server gave last
time now stands in until the next one arrives.

- Dexie v18 adds accountSettings, one row in the signed-in user's own
  database, so another account on the device never reads it and logout
  deletes it with the database. The anonymous database never holds one.
  A new table only; the upgrade test covers it.
- loadSettings lays the kept answer over the defaults while nothing newer
  arrived and keeps every server answer. A key the server then leaves out
  goes back to its default, so the server stays the source of truth.
- A setting the server accepted is laid over the kept answer, so a change
  made online is what the next offline start shows. A refused save keeps
  nothing.

Keeping is best effort: where IndexedDB is refused the app starts on the
defaults as before.
2026-11-30 16:22:51 +01:00
Maurice 9cbbbdb2e9 refactor(maps): one hook decides which engine draws a map
MapViewAuto chose the renderer and the offline fallback inline, so the
journey map, which needs the same choice, could only copy it.
useEffectiveMapEngine now holds it: the user's provider where it can run
(Mapbox needs a token, both GL engines WebGL2), Leaflet where it cannot,
and offline the stored basemap with its pill, checked on the engine that
actually draws. It returns what to draw and never writes a setting.

The logic is the one MapViewAuto ran, moved and not changed, and the hook
is tested on the same cases as the trip map's offline suite. The header
comment no longer claims the Atlas uses Leaflet.
2026-11-30 16:22:51 +01:00
Maurice 6dafbc6d05 refactor(maps): build every GL map from one set of options
The trip map, the journey map and the settings preview each assembled
their own constructor options and their own 3D setup on load, and the
copies had drifted: the preview laid terrain under every style outside
the Standard family, while the trip map only under the satellite and
outdoor styles, so the preview showed a map the trip never drew.

glMapOptions builds the options for all three and applyGl3d sets up
terrain, buildings and the flattened Standard DEM. For Mapbox the options
are exactly the ones each map built before, key for key and in the same
order, which a test pins; the preview now follows the trip map's terrain
rule. The next steps tune MapLibre in this one place.

MapViewGL.tsx shrinks, and its size baseline follows.
2026-11-30 16:22:51 +01:00
Maurice 0a72ed5e76 feat(maps): describe the basemap once for every renderer
The Leaflet map read the resolved template and sniffed it again for the
datum and the credit, and a GL raster source would need the same template
with its placeholders decided. resolveBasemapSpec wraps resolveBasemap and
adds what a renderer needs: the template Leaflet takes as before, the tile
URLs a GL source takes ({s} as Leaflet's a/b/c shards, {r} as @2x on any
screen denser than one, {-y} as a TMS scheme), the tile size, the
provider's deepest zoom, the credit, the datum and the host.

The Leaflet map draws from the spec now, with the same template, credit
and datum as before, so nothing on screen changes. The tests cover every
template a user can have saved today.
2026-11-30 16:22:51 +01:00
Maurice d8a93af2f5 feat(maps): one shared list of the shipped tile hosts for the CSP and the client
A GL map fetches its style and its tiles, so it can only draw from a host
the server's connect-src names. The raster presets and OpenFreeMap were
written out in the middleware while the client kept its own idea of them,
and nothing held the two together.

The hosts, their reasons and the default OpenFreeMap style now live in
shared/src/maps/map-defaults.ts. The middleware builds those sources from
the list, and the client takes the default style from it, so the renderer
choice the next steps add reads the same hosts the policy allows.

The policy an install sends stays byte for byte the same: a test pins the
whole connect-src in its order.
2026-11-30 16:22:50 +01:00
Maurice b27b3f6563 docs(maps): classify MAP_EXTRA_CONNECT_HOSTS and separate its wiki section
The app-config README lists every variable as boot-stable or runtime-toggled;
the new one was missing. The CSP takes it when the app is built, so it is
boot-stable. The wiki section also lacked the rule that separates it from
Storage & Paths like every other section.
2026-11-30 16:22:50 +01:00
Maurice fdfc034a68 fix(settings): a managed install keeps a map provider somebody chose
With the operator's Mapbox token a managed install replaced every empty or
Leaflet provider with Mapbox, including a Leaflet the user picked and a
Leaflet default the admin set. A plain "only when empty" would switch
everyone whose Leaflet row only exists because the settings form writes
every field (#1634), so the choice is recorded instead, by the server alone:

- map_provider_chosen on the user's settings, set when a write changes the
  provider the user is shown (so saving the form unchanged is no choice,
  and leaving the Mapbox a managed install shows is one). A client patch
  naming the key is dropped on both routes, false included, so no client
  can set or clear it.
- map_provider_default_chosen in app_settings, set when the admin saves a
  map_provider default and removed when it is reset.

Mapbox now replaces an empty provider, or a Leaflet without the mark of
where it came from. No stored row is rewritten: rows without a mark read
exactly as before. The client Settings type gains the read-only field.
2026-11-30 16:22:50 +01:00
Maurice 51dc0e6a82 feat(maps): MAP_EXTRA_CONNECT_HOSTS adds the operator's map hosts to the CSP
A GL map fetches its tiles and its style, so a template on a host of the
operator's own (a self-hosted tile server) was refused by connect-src while
Leaflet drew it as images. The new variable lists such hosts; each entry
becomes an https source in connect-src and the same list reaches the client
as map_extra_connect_hosts in the app config, so the renderer choice and the
policy can never disagree.

The variable is owned by readEnv() like the rest of the maps namespace and
read once when the middleware is applied. The boot refuses an entry outside
the shared grammar; a path that skips the boot check drops it, so a bad
value never widens the policy. Unset, the CSP and the app config are as
before apart from an empty list.

Documented in .env.example, docker-compose.yml, the Helm values and
ConfigMap and the wiki. Making room for the app config field shrinks
auth.service.ts by one line, and its size baseline follows.
2026-11-30 16:22:50 +01:00
Maurice 6c68f6ebec feat(shared): host grammar for the operator's own map hosts
MAP_EXTRA_CONNECT_HOSTS lets an operator name tile and style hosts beyond
the ones TREK ships. The server adds them to the CSP connect-src and the
client will only ask a GL renderer to draw what that list names, so both
sides read entries through one grammar: a lower-case host name with at
least two labels, an optional port and an optional leading wildcard over
two or more labels. No scheme, path or user, so an entry can never widen
the policy past a single host family.

The parser returns the accepted hosts and the refused entries, for the
boot check, and the app config field gets a Zod contract.
2026-11-30 16:22:50 +01:00
Maurice dbf808362d ci(sonar): analyse the server tests in the server's own TypeScript program
The scan ran out of memory since the places work: the analyser keeps every
file it parsed until the end, finds only files named tsconfig.json, and
server/tsconfig.json leaves out tests/, so the server tests landed in a
catch-all program that parsed server/src and shared/src a second time,
about 9,400 files and some 2 GB. Naming the tsconfigs, with the server's
tsconfig.tests.json in place of tsconfig.json, keeps them in the program
that already parsed those files. No file leaves the analysis.
2026-11-30 14:04:47 +01:00
Maurice dc645b1205 fix(places): All saved acts on every copy of the place a row stands for
All saved shows a place kept in several lists once, but deleting that row
removed only the copy shown, so the next copy took its place, and the
status filter and counts read only that copy. The filters now look at
every copy before the places are shown once, the counts count a place
under each status its copies hold, and deleting or setting the status of
the row reaches every copy.
2026-11-30 13:28:01 +01:00
Maurice 73e3ac2606 fix(places): the closed-day tests parse, and the inspector keeps its size
A test title held an unescaped apostrophe, so the file did not parse. The
inspector maps a provider's week through one helper again, which keeps it
at its size baseline, and the counts type of the rail stays inside its file.
2026-11-30 13:28:00 +01:00
Maurice f15b9e73a0 fix(dashboard): the more-countries chip on the passport card is solid
The +N chip after the visited countries' flags sat on the last flag with a
see-through white, so that flag showed through it. It is now the same tone,
solid.
2026-11-30 13:21:03 +01:00
Maurice 7f2c6638a8 fix(places): a closed day from OSM reads closed, not off
OSM tags a closed day as off ("Mo off"), which the tag parser hands on
as "Monday: off", and the place view showed that word as the day's hours
and as today's line. A day the provider wrote as off or closed now reads
in the reader's own word for closed, in the place view and in the details
column of the place dialog.
2026-11-30 13:18:00 +01:00
Maurice 07d54d6f6e fix(maps): a place's marker photo is its community picture where it has one
An OSM or index place with a reviewed TREK Community picture showed it in
its gallery but only a category pin in the lists and on the map: the
marker photo asked Google and Wikimedia, never the community's pictures.
It now asks them first, the order the gallery shows them in, and only
while the TREK Places API is on.
2026-11-30 13:14:23 +01:00
Maurice 51c45d0573 feat(places): the picker shows how many places All places holds from the start
The count beside All places in the place dialog's picker appeared only
once All places was chosen and read. It is now read with the picker,
with one entry, the way the rail reads it.
2026-11-30 13:10:34 +01:00
Maurice 91bf941e4c fix(places): the picker's All lists and All places count places alike
All lists in the place dialog's picker now shows a place kept in several
lists once, as All saved does, and All places keeps the places of the
trip being planned, so it always holds at least what All lists holds and
its count matches the rail.
2026-11-30 13:09:02 +01:00
Maurice 2204e851fa feat(places): All saved shows each place once, All places shows its count
A place saved into several lists from the same trip place showed once per
list in All saved and counted that often, while All places groups the
copies as one place. All saved now shows such a place once, the first
copy read standing for it, and the rail counts All saved and All places
the way All places groups them, on the desktop and the phone.
2026-11-30 13:09:01 +01:00
Maurice b36b83a32e test(places): the saved place forms send no tags or notes
The desktop dialog and the phone sheet tests still expected label_ids and
notes in the edit form's patch, which the form no longer sends: the tags
card and the notes tab write those.
2026-11-30 13:09:01 +01:00
Maurice 101c4b5d7a feat(places): All places in the saved-place picker of the place dialog
The picker beside the add place form only offered the places of the
lists. Its list filter now also offers All places: the places of the
other trips beside the lists', each place once, read when chosen, with
the same search, status filter and distance order. The trip being
planned stays out, it has those places already. A pick fills the form
with the place's name, address, position and category.
2026-11-30 13:01:20 +01:00
Maurice e90380e2b4 fix(places): votes copied with a place keep when they were last changed
Saving a trip place into a list and copying a saved place into a trip
carried the votes with no change time, so each copy read as cast now and
could outrank a newer vote on another copy of the same place, moving the
entry's own vote, average, filter and sort. Both copies now carry the
source vote's time, as the vote carry-over already does.
2026-11-30 12:55:07 +01:00
Maurice 09ae971cc8 fix(places): an edit left open does not follow onto the next place
In All places the edit state outlived the place it was opened on, so on
the phone a draft started on one place and left open was saved onto the
next place the sheet showed. The form now closes when another place
opens.
2026-11-30 12:55:06 +01:00
Maurice 1435076cec fix(places): a saved place's edit form no longer undoes its tags and notes
The tags card and the notes tab write a list copy's labels and notes
directly, but the edit form still sent the label_ids and notes it was
seeded with when the place opened, so saving a name change laid the old
tags and note back over them. The form now sends only the fields it shows.
2026-11-30 12:55:06 +01:00
Maurice 501e4449ef refactor(places): one label for a rating badge
The list rows and the map pins wrote the average with their own copy of
the whole star or one decimal rule; both now read ratingBadge.
2026-11-30 12:34:50 +01:00
Maurice 7008427022 refactor(places): drop the unused note chooser from the origin notes
The composer opens the first writable trip or list and its chips switch it,
so the old "+ Note" toggle and its chooser state are read by no view.
2026-11-30 12:34:47 +01:00
Maurice 1997a49e3d chore(places): export only what other files use
The media targets, the rating label, the rating score constants, the rating
match and the copy editor types are read inside their own files only, which
lint:knip holds.
2026-11-30 00:33:35 +00:00
Maurice 8057688da3 fix(places): say why registering the join listeners writes nothing itself
onModuleInit only hands the list and trip joins their listener; each join
then carries the joiner's votes in a transaction of its own, which
lint:tx reads from the @txIndependent note.
2026-11-30 00:24:37 +00:00
Maurice 29ae0de1ef fix(places): the third CI run, no awaits in loops and an edit target that may be none
The rating order test pages through its cursor with a recursion and checks
the refused floors at once instead of awaiting in a loop, and the edit hook
types its first editable copy as possibly none, which the strict check reads
from a conditional rather than a narrowed assignment.
2026-11-30 00:16:23 +00:00
Maurice 1c9ac0b159 fix(places): the second CI run, split the library reads and test the rating order
The reads of what an entry of All places keeps beside its facts (tags,
notes, votes, planned days, bookings, list roles) move from
PlacesLibraryRepository into PlacesLibraryDetailsRepository, so neither
file passes the size limit. New end to end tests cover the rating filter,
the tab counts under it, the rating order and its cursor, and
list_all_places with both. The test types follow the vote shapes, the edit
target says it may be null, the bookings pair names the booking card that
now holds the booking model, and the size baselines drop to the measured
lengths.
2026-11-30 00:06:47 +00:00
Maurice 7104fa6dd4 fix(places): the first CI run on the place view and the copies in step
Imports the picture icon the media sections draw for "use as the place
picture", narrows the types the type check refused, moves the dropdown
open state and the media lightbox into one module each for both views,
replaces an await in a loop, and lowers the ratchet baselines to the counts
the run measured. The tests follow the place view: the vote route of a trip
place lives with the votes now, the history holds an entry per copy that
followed an edit, the rate_library_place tool has its broadcast case, and
the row tags of a list are dots behind the name.
2026-11-29 23:53:36 +00:00
Maurice 71392ec9c1 docs(mcp): copies in step, the rating filter and the voters of an entry
The place and saved place update tools say that the general facts follow
onto the other copies, list_all_places names min_rating, the rating sort
and the voters, and the tool count is current.
2026-11-29 23:36:43 +00:00
Maurice d6708f6ff2 feat(i18n): translate the new Places strings and drop the unused ones
The media, notes and tag strings of the place view and the rating sort in
every language; the strings nothing reads any more leave every locale.
2026-11-29 23:36:43 +00:00
Maurice 20e3d2d9ae test(places): cover the place view, the rating row and the rating filter
Tests for the vote by entry key in the api and the repository, the rating
row and its voters, the rating filter and sort on both views, the edit form
without a choice of copy, and the place view's sections, aligned with the
renamed tag strings.
2026-11-29 23:36:43 +00:00
Maurice d758f4c592 feat(places): one place view for All places and the lists
The desktop dialog and the phone sheet of a place show its overview, notes,
tours and bookings, photos and files and its history in tabs, with the tags
of each list and trip, a markdown notes editor, uploads and the place
picture. The rating bar of All places is the rating row the lists show,
with its voters, and votes once for every copy. All places filters by a
lowest rating and sorts by it, and the edit form changes the first copy the
reader may edit, which the server carries to the others.
2026-11-29 23:36:43 +00:00
Maurice 783c98f41e feat(places): one vote per person across copies, copies stay in step
A vote belongs to its person: cast or taken back on one copy of a place, it
lands on every copy of that place in the lists and trips the person may vote
on, in one transaction. A pass on the first start carries the existing votes
over, and whoever joins a list or a trip brings their latest vote onto its
copies of the places they voted on elsewhere, as inserts that never
overwrite.

An edit of the general facts of a place (name, description, address,
position, category, picture, website, phone) on a trip place or a saved
place is made on every other copy of it the editor may edit, with a history
entry per copy and an announcement per trip and list. Notes, tags, status
and votes stay with each copy, and a copy the editor may not edit is
skipped. REST and MCP take the same path; a token reaches only the kinds of
copies it holds write scope for.

The entry rating names its voters, the library list filters by a lowest
average vote and sorts by rating, and the tab counts honour the filter.
2026-11-29 23:36:43 +00:00
Maurice c24c724861 feat(places): contracts for the one vote per person and the rating filter
The entry rating of All places names its voters (user_id, username,
avatar_url, rating), the people the average counts. The library query takes
min_rating (1 to 5) and the sort rating, the vote by entry key has its
request and response schemas, and the personal place tags give way to the
tags of the lists and trips a place is in.
2026-11-29 23:36:42 +00:00
Maurice 2653f0cb07 docs(mcp): list the place history, activity and tag tools 2026-11-29 21:16:51 +01:00
Maurice c944ef6de5 test(places): cover the place sheet sections, tags, trip lists and the visited filter 2026-11-29 21:16:51 +01:00
Maurice d008331e5f feat(places): notes, visits, tours, history, tags and location in the place sheet, saved lists on the trip map
Both the desktop sheet and the phone sheet of All places show the place's
location as a badge, its notes per list, its visits from trips (hidden without
any), linked tours and bookings, its change history and the reader's own tags
with a tag filter. A trip map can show the places of linked lists and add one
to the trip. All places reloads after a list is added or removed.
2026-11-29 21:16:51 +01:00
Maurice 9abd16b907 feat(i18n): the new Places strings in every language 2026-11-29 21:16:51 +01:00
Maurice 382ba79584 feat(places): visits read from trips, change history, linked tours and bookings, personal tags
A visit is a place planned on a day of one of the reader's trips; nothing is kept
or confirmed by hand. A place keeps a log of changes to its details, links the
tours and bookings it is about, and carries tags private to the reader, which a
copy into a trip takes along only when picked. Contracts, routes, MCP tools and
migrations for both engines.
2026-11-29 21:16:50 +01:00
Maurice ab7468f028 fix(ci): the file error helper no longer shadows the modal's own errorText
The new switch over the file errors took the name of the component's local errorText, so the local constant was read before its declaration (TS2448, the import tests and an unused-var warning). It is fileErrorText now.
2026-11-29 18:39:54 +01:00
Maurice b1c7bd0a33 fix(ci): the file import's words resolve through t, the unused key count drops
The KML skip reasons and the file errors were looked up from plain maps, which lint:i18n-keys cannot follow, so the new map keys counted as unused. Both are switches over t() now; the older file error keys are reached as well, so collection.ts holds 29 unused keys instead of 35.
2026-11-29 18:29:37 +01:00
Maurice 2b0ef098fd fix(ci): one save-to-list mapping for both All places views
lint:dup found the trip place to save dialog mapping copied in the desktop and phone views of All places; it is now saveDraftOf in libraryPairs, with a test.
2026-11-29 18:16:27 +01:00
Maurice 587f5f6bb6 fix(ci): drop the stale theme exception and format the filter bar
AddPlaceToCollectionModal no longer holds its theme-lint-disable line, so its entry in theme-disable-baseline.json goes; LibraryFilterBar is formatted after its import moved to the component status model.
2026-11-29 18:06:28 +01:00
Maurice 026d593c8d fix(ci): layering and theme counts after the places changes
- LibraryFilterBar reads the list statuses from the component-level
  collectionStatus model instead of reaching into pages/.
- The phone filter kit moved out of MCollections with its raw text sizes; it
  now uses the type tiers (control, caption), so the user's text size applies.
- The cover of a place of All places on the phone keeps its scrim, close button
  and name colours in a small stylesheet, as the desktop sheet does.
- theme-baseline: ratingBadge back to the two corner-badge literals it holds,
  MapView, MapViewGL and MCollections lowered to what they hold now.
2026-11-29 16:48:45 +01:00
Maurice f99c7f5421 fix(ci): the second round of gates after the places changes
- index.css stays at its size: the map canvas colour moves to its own
  stylesheet.
- The rating badge on map markers takes its amber and white from a class in
  ratingBadge.css instead of inline literals; the theme entry drops with it.
- Strict mode: the identity a link joins is resolved without a widened union,
  the description of an entry's origins is string or undefined, and the map
  search rows are typed.
- knip: PLACE_NAME_ATTR is module private, the linked-by enum names the values
  the service writes, and the unlink contract is its own described schema
  rather than a second name for the use schema.
- The duplicates hook test reads toasts through a module mock instead of the
  window hook; react-hooks/refs is lowered to the count the run measured.
- Tests follow the rename to Places and the list icon on an edit.
2026-11-29 16:38:53 +01:00
Maurice bacc6a29a7 feat(places): review possible duplicates, and repair the client gates
All places offers the pairs that look like one place: both sides side by side
with what differs marked, "keep this one" to group them as one place of the
user's own (undo right after), and "not the same place" to set a pair aside for
good. Desktop dialog and phone sheet share usePlaceDuplicates; every locale has
the new strings.

What the last dev run flagged on the client:
- Tailwind's Prettier plugin had trimmed the leading space of conditional class
  names (col-filter-btn, col-lrow sel, col-split map-full, col-detail docked),
  so the filter row and the open row lost their styling; those classes are now
  joined so the formatter cannot glue them.
- The dock position lives in one helper for the lists and All places, which
  moves the measured-position markers there instead of adding new ones.
- usePlacesLibrary is split into filters, pages, detail and cover hooks that
  derive their loading state instead of setting it inside effects; the big
  sheets and views are cut into parts under the complexity limit, dynamic icons
  go through createElement, originName moves out of a component file.
- formatRange is guarded like in the packing export, the cover lookup skips
  places without a position.
- Tests follow the rename to Places, the category icon, the default list icon
  and the new trip collections store; react-hooks/refs is lowered to the count
  the run measured.
- The rating on a place is a round badge again, in the list and on the map.
2026-11-29 16:28:22 +01:00
Maurice 62232ec87e fix(places): undo, unlink and dismissals that hold after a key or access change
Review findings on the place identities and trip list links:

- The assistant offers PlacesLibraryMcp, PlaceIdentitiesMcp and
  TripCollectionsMcp with the collections group (done with the CI fix).
- Undoing a merge restores the entries as they were: the merge logs, in its
  moved_link_ids JSON, each link it moved and each link it made with the use
  that link names, and whether the merged side became an own place only for
  the merge. The undo deletes what the merge made and moves the rest back,
  and only touches a link still in the leading place naming the same use, so
  a link id SQLite hands out again never moves someone else's link. The
  sweep counts a merge as spent by the same rule. Same unreleased migration,
  no schema change.
- A use can be taken out of an own place by the user's own link row also
  once its trip or list is out of reach; the answer then holds no entry, and
  the place left can be merged again.
- A dismissed duplicate is kept by one use of each side (an own place by its
  first link) and matched by the uses each entry holds, so it stays out when
  an entry becomes an own place or a merge is undone.
- link() checks the named uses with one targeted read instead of reading
  every use of the user, and the library reads its rows in blocks of 500 ids.
- Saved place reorders and the trip tags of a copy run one statement after
  the other again; a copy takes the first spelling of a tag name, as before.
- Unlinking a list from a trip takes place_edit alone, so a link to a list
  the writer cannot open can be taken off; a member leaving or taken off the
  trip takes the links whose list nobody left on it can open.
- The linked lists and their map places sort by lower(name), then by id, the
  same on both engines.
- list_all_places names the own:<id> keys and identity_id (MCP and wiki); the
  undo, unlink and trip unlink descriptions say what they do now; README
  counts 451 tools.
2026-11-29 16:27:12 +01:00
Maurice 7a06db393f fix(ci): repair server and shared gates after the place identities change
Push run 46275645144 on dev (f69a4c1a2) was red in these jobs:

- Server types: UserPlacesRepository.create, UserPlaceMergesRepository.create
  and UserPlaceLinksRepository.insert shadowed MikroORM's EntityRepository
  methods with other signatures (TS2416), which also broke defineEntity on the
  three entities (TS2769). They are createOwn, record and insertUses now.
- Server lint: collections.service.ts had grown to 1411 lines against 1410.
  The trip tag lookup of a copy moved into collections.helpers.ts
  (tripTagIdsOf, tagKeyOf); the size baseline is lowered to the 1398 it holds.
- ASTCAP-001/002/005b: the trip chat core had taken in PlacesLibraryMcp,
  PlaceIdentitiesMcp and TripCollectionsMcp, so core and the tours group
  offered 132 tools against 128. They load with the collections group now.
- PLIB-001, PLIB-MCP-001 and the places library e2e: the two entries named
  Museum tie on the name and go by their anchor, which the expected order
  hard coded the other way. The fixture orders every tie by its anchors.
- ENT-003 and CLASSFIELD-002: the five new entities and their 18 NOT NULL
  columns without a default are counted.
- Shared tests: collections.ratingBadge was missing in 26 locales; each has
  its translation now.
2026-11-29 16:14:42 +01:00
Maurice f69a4c1a24 feat(places): own place identities, duplicate merging and lists linked to a trip
- A user can group the uses of one place (trip places and saved places) into a
  place identity of their own (user_places, user_place_links). It is personal:
  it groups their "All places" and is never written into a shared trip or list
  row. An identity without a use they can still reach is not shown, and one
  left without links is pruned on their next write and nightly.
- Possible duplicates are suggested server side (same provider id, or the same
  name at the same spot), each pair with what differs and whether the user may
  merge it. A merge joins two identities in one transaction and can be undone;
  a dismissed pair does not come back. No trip or list row is deleted or changed.
- A trip can link lists (trip_collection_links, needs place_edit and access to
  the list). A member sees a linked list only with their own access to it; the
  map layer lists its places and whether each is already in the trip.
  tripCollections:changed tells the members to read their view again.
- REST, MCP tools and client data layer for all of it; migrations on both
  engines, additive only.
- CI: the stage 1 to 2 places-library helper types, and the await-in-loop and
  non-null counts it had raised.
2026-11-29 15:57:05 +01:00
Maurice 01d327b502 feat(places): Places replaces Collections, with All places, place sheets and a calmer list
- Collections is Places now: /places opens "All places", every place of the
  trips and lists with where it comes from, the same filter row (where from,
  status, category, order), map bar (search, lock, list toggle) and place sheet
  as a list; /places/saved and /places/:id are the lists, and the old
  /collections links still land there. On the phone the same, with its own
  sheet. A place sheet shows each trip (planned day or trip dates, stay,
  booking, notes) and each list (status, labels, rating, notes) as one row
  that opens it.
- The rail: a calm "New list" with its plus tile, All places and All saved as
  views, a "My lists" heading, every name on one edge. Lists can carry one of
  24 symbols, shown in their colour in the rail and the editor.
- A saved place's row keeps to two lines: its category as an icon before the
  name, its average vote as a star on the picture. Map pins wear the same star.
- The place forms put the category in front of the name as a tile that opens
  the category list, instead of a row of chips.
- All saved gets a subtitle; the import dialog opens centred.
- Fixes: a pasted coordinate pair splits from either field of the place form;
  "more" in All places frees itself when a filter changes mid-load; place
  names on the trip map and the rating badge follow the reading direction.
2026-11-29 15:49:35 +01:00
Maurice 0ecca2b46c feat(places): read every place of the trips and lists in one view
A read-only overview of every place a user can reach: the saved places of
their lists and the places of their trips, viewer trips included, with tours,
tracks and the stops of a drive left out. A saved place and a trip place are
one entry only when the saved place came from that trip place, the trip is
still open to the user, and both agree (a provider id, or the same name at the
same spot); anything else stays apart. Every entry names where it comes from
and whether it may be changed there.

- GET /api/addons/collections/library/places: paged by cursor, search,
  category, kind, list, trip and status filters, counts per kind.
- GET /api/addons/collections/library/places/{trip|list}/🆔 one entry with
  what each origin keeps on its own (notes after the existing rights, labels,
  ratings, a trip's planned days, whether a stay or booking uses it).
- MCP tools list_all_places and get_library_place.

Nothing is written and nothing migrates; the rights are the existing list and
trip checks, read on every call.
2026-11-29 14:57:10 +01:00
Maurice 82165855c7 feat(collections): own order, KML/KMZ import, copy options, position search, place names on the trip map
- A list keeps its own order: drag a place by its grip (desktop and phone) or
  move it with the arrow keys. Reordering is off while a search or filter hides
  places and the list says why. New PUT /collections/:id/places/reorder and the
  MCP tool reorder_collection_places; new places go to the end. Client and
  server now order ties the same way (sort_order, oldest first, id).
- Copying saved places into a trip no longer takes their notes and tags along
  unasked. The picker offers both; a tag taken along becomes a trip tag (a trip
  tag of the same name is reused), never someone's personal tag.
- The source trip and place a saved place names are only kept when the user can
  open that trip and the place belongs to it.
- A KML or KMZ map can be read into a list: the dialog lists every placemark to
  keep or leave out and says which entries were skipped and why
  (POST /collections/map/read writes nothing; the import does).
- A saved place without coordinates says so and can be looked up on the map
  from its edit form, on the phone too, where a missing position could not be
  added at all. A typed address without a pick says it will not be on the map.
- The trip map can show the place names beside the pins (desktop and phone,
  both renderers). Names that would cover another pin or a control give way,
  the selected place and the planned stops first.
2026-11-29 14:57:00 +01:00
Maurice 177a0febe2 test(db): the Postgres engine migrates in a context of its own
SonarCloud counted the two new lines in PostgresEngine.schemaBootstrap as uncovered: the Postgres lane runs them but does not feed the coverage it reads. PGENGINE-BOOT-001/002 run the bootstrap against a stand-in ORM whose first statement records the request context it runs in, on its own and inside a caller's request.
2026-11-29 13:02:32 +01:00
Maurice 80853fcf03 fix(ci): the Postgres engine forks its context without reaching into nest
Server lint: src/db may not import src/nest, so the Postgres engine opens the request context with RequestContext.create itself, as demo-reset and the backup restore already do. Server types: the base EntityManager has no execute(); RESTORE-002 reads through the connection.
2026-11-29 12:31:02 +01:00
Maurice 67049c1065 fix(backup): a restore that migrates no longer breaks the request it runs in
Restoring a backup whose database was behind the running version migrated it inside the admin's HTTP request. A MikroORM migration's getEntityManager() pins the migration's transaction on the EntityManager of the context it runs in, which was the request's. Once the migrations committed, every later read on that request failed with "Transaction is already committed": the storage registry reload kept the pre-restore config (uploads, including the archive's own, went to the old backend), and the restore's audit row was lost.

Both engines now run their migrations in a request context of their own (runSchemaBootstrap on SQLite, bootstrapPostgresSchema on Postgres), so the transaction stays on a throwaway EntityManager, at boot and on restore alike. RESTORE-002 restores a file six migrations behind head inside a request and reads on through that request's EntityManager.

Closes #3264
2026-11-29 12:00:08 +01:00
Maurice f89ebf6882 feat(atlas): unvisited regions of a visited country almost clear when zoomed in
Zoomed in, a country with visited regions kept about a fifth of its colour under its other regions. It now keeps about a twentieth, as in the regions view, so only the regions really visited carry the country's colour.
2026-11-29 11:54:41 +01:00
Maurice 14443a17be feat(atlas): a regions view, and visited regions that stand out
A traveller who visited only Alberta saw all of Canada colored on the zoomed-out globe. A new layer switch, Regions instead of countries, keeps the coarse regions of every country with a visited region on screen at every zoom: the engine loads and holds them (setPinnedRegions), the renderer draws them at full strength with faint inner borders, and the country itself only tints faintly beneath them once they are drawn. The switch is remembered per device, on the desktop layers dialog and the phone sheet, in all 28 languages.

Also without the switch, a country with visited regions now steps far back once its regions fade in (to about a fifth instead of two thirds), so the regions really visited stand out from the rest of the country.
2026-11-29 11:53:46 +01:00
Maurice 00675c59b0 fix(ci): decouple realtime presence and test Atlas fill indices
Bind the realtime activity port to the existing SessionsService at app startup to remove the domain import cycle. Check the Atlas mesh through its triangle indices because degenerate rings can leave vertices that never contribute to the fill.
2026-11-29 11:06:16 +01:00
Maurice 96976d3ece test(atlas): settle the first CI round of the new Atlas tests
Client types: Array.at is past the lib target, typed mocks where a spy is called. Client lint: mock components named so hooks may run in them, state reported from effects instead of written into props, promises voided or awaited. Client tests: class order as passed, month names checked in Japanese whatever the ICU build, mesh vertex counts asserted by shape, the buffer growth case built from many small squares instead of one strip that took 15 s, the shooting star tests driving the sky's own schedule, and reduced motion mocked once so it no longer silences later tests. Server: the hidden-setting cases as it.each (no-await-in-loop), and the presence branches the realtime 100% threshold asks for.
2026-11-29 10:42:20 +01:00
Maurice ab0e6fda8b fix(atlas): give back every GPU object when the globe goes
dispose() freed the world and region layers only; the ocean, arcs, outline, pick texture and framebuffer, status textures, shared buffers and programs stayed on the context, which React keeps alive across a remount, so each visit to the Atlas left them behind.
2026-11-29 10:42:19 +01:00
Maurice 9018ee8980 test(atlas): cover the new Atlas from engine to hub views
SonarCloud measured 16.9% coverage on this PR's new code. Tests now cover the WebGL globe engine (boot, caching, input, camera, regions, prefetch) and renderer (against a fake WebGL2 context that reads the real shaders), the paint, labels, sky and pins, the central useAtlasGlobe hook and the hub hooks, the snapshot, account queue and Atlas repos, every desktop and phone hub view, the server's people, flights and mesh routes, the shared badge rules, and the new view transition, warm bags and kept planner maps.
2026-11-29 10:21:28 +01:00
Maurice 10ad92574d fix(ci): presence through the sessions domain, warm bags taken once, a slimmer planner page
Server lint: the realtime gateway injected the user_sessions repository, a table the sessions domain owns; it now asks SessionsService. The presence tests reuse the handshake's gateway instead of building one more by hand (test-new-service ratchet).

Client tests: the packing bags kept per trip leaked from one test (and one list) into the next; bags read ahead are now taken once as the list's first state, and only while bag tracking is on. The planner hook hands the page planMapKept, tourMapKept and the tour stage's class, so page tests that mock the hook keep working and TripPlannerPage is back at its size baseline (1127); the B4A wiring test reads the new condition.

Client lint: max-depth in src is down to 19, the baseline follows; the new websocket tests call onopen with ?. instead of a non-null assertion.
2026-11-29 10:13:53 +01:00
Maurice 5401728c41 feat(admin): online means a tab in front, and keeps last activity current
Online in the user list meant any open socket, so a tab left in the background showed as online for days while its last activity stood still. The client now sends a presence frame on connect and on every visibility change; only sockets whose tab is visible count as online (one that never sent the frame still counts, so older clients are unchanged). While a tab is in front, the gateway writes its session's last_seen_at at most every five minutes, on the frame and on the heartbeat, so last activity follows the online state.
2026-11-29 10:04:15 +01:00
Maurice 467287f138 perf(planner): tabs that open ready instead of building in front of the user
Two seconds after a trip opens, the code of every tab panel loads in the background, and the packing list's bags with it, which are kept per trip so Lists opens with its bag sidebar in place. The plan and tour planner maps stay mounted (hidden) once opened, so switching between them no longer starts a map again and flickers. Not on a narrow screen, where the plan tab portals its own controls over the page.
2026-11-29 10:04:15 +01:00
Maurice 64697fdb7f perf(vacay): read the calendar in parallel and keep it on screen
loadAll ran eight requests one after another, and the holidays fetched each calendar and year in turn, behind a full spinner on every visit. Plan and year settings now load together, then the years, then everything for the year at once; the holiday calendars are asked in parallel and laid out in the calendars' order. The spinner shows only for the first load; coming back keeps the calendar and refreshes it.
2026-11-29 10:04:14 +01:00
Maurice 7e3ce20e6b feat(client): calm page changes on the desktop and sections loaded ahead
The desktop now runs the View Transition the phone already had: one short cross-fade under a navbar that stands still. The route fallback holds the previous page until the new one is ready (at most 350 ms), so the full-screen spinner no longer flashes. Once signed in, the main sections' code loads in the background, so the first switch to one does not wait for it. The shared transition helpers move to utils/viewTransition.ts. The navbar tabs lose their title tooltips; their aria-label stays.
2026-11-29 10:04:14 +01:00
Maurice f8a7d674f9 perf(atlas): keep the globe's geometry for the next visit
Every visit read the manifest and the world file again and triangulated the countries in the worker, which showed the loading notice for about a second. The manifest and the built world meshes are now kept for the tab's lifetime, keyed by the content-hashed file name, so coming back puts the globe up at once. A page load starts empty, so a deploy's new geometry is read as before.
2026-11-29 10:04:13 +01:00
Maurice c3935ff027 fix(packing): a wider item window so the visibility choice fits
At 320 px the three options of "Visible to" ran past the window's edge and "Selected" was cut off. The window is 380 px wide now, still capped to the screen.
2026-11-29 09:41:30 +01:00
Maurice ce2b521ae7 feat(atlas): a neutral night sky and steadier globe details
- The globe, sky, glass and medals use black and neutral greys instead of
  blue tones; the atmosphere glow is a quarter of its former strength.
- No shooting stars on load: the visited set is compared only once the
  Atlas has loaded. Now and then a shooting star crosses on its own.
- The stars stand still while the Earth turns, and three constellations
  (Big Dipper, Orion, Cassiopeia) are drawn from their stars' real places,
  sized and tinted by brightness.
- Wishlist stripes are slices through the globe, so they stay on the land
  as it turns.
- Country names keep their own element while shown and hold their place
  against a near equal neighbour, so they no longer jump or flicker.
- The flat map fades into the sky towards its cut edges at the poles, and
  the view's latitude is held where those edges stay off screen.
2026-11-29 09:36:14 +01:00
Maurice 7eb2c9334b chore(knip): drop the hazard popup's unlisted entry
hazardPopup.ts typed against geojson without listing it; with
@types/geojson now a client dev dependency it is listed, so the baseline
entry goes.
2026-11-29 02:29:40 +01:00
Maurice cac5b5c501 fix(atlas): clear the knip findings of the globe Atlas
- The globe's geometry code types against geojson and
  topojson-specification; both are listed as client dev dependencies now
  (already installed through @types/topojson-client).
- Constants, helpers and types used only inside their own module lose
  their export.
- The GeoJSON types only the classic Atlas map read are removed; the knip
  baseline follows the lower counts in types.ts and offlineDb.ts.
2026-11-29 01:59:04 +01:00
Maurice a3db6e93bf fix(atlas): drop the keys the classic map left unused, tag the people reads
- lint:i18n-keys: common.reset, dawarich.bucket.visitedFrom and the two
  mobileAtlas keys were only read by the classic map and its popups; they
  go from every locale, and the atlas entry follows its lower count.
- lint:tx: AtlasPeopleService.profile also carries @txIndependent, so the
  method itself is no longer reported for its cache refresh reads.
2026-11-29 01:26:58 +01:00
Maurice e6ba039abc fix(atlas): share the wish form and tour figures, mark the people reads
- lint:dup: the add-a-wish form state and the tour figures of the hub were
  written twice, once per view; they live in useWishAddForm and
  tourHubFigures now, and both views read them.
- lint:tx: AtlasPeopleService.profile only writes through the region cache
  refreshes of the Atlas reads it calls, each complete on its own, so it is
  marked @txStandalone.
2026-11-29 00:53:28 +01:00
Maurice 6068c34c35 fix(atlas): keep auth.service at its size, finish the last ratchets
- The public config's feature switches, the Atlas comparison among them,
  move into a helper, so auth.service shrinks instead of growing past its
  size baseline (lowered to the new length).
- French "continents" in the many form is the French word too.
- useAtlasCountryActions no longer imports the API: off the offline list.
- The eslint baseline follows two lower counts.
2026-11-29 00:21:10 +01:00
Maurice 06b08cd9d5 fix(atlas): name the globe hook dependencies, cover the mesh routes
The second run of the globe Atlas was red on:

- Client lint: the engine getter is a stable callback now, so the hooks
  that call it name it (and the refs and setters they read); an unused
  navigate and a seven parameter label helper are gone.
- Atlas coverage: the mesh controller and the people and flights routes
  get unit tests, an unused region name helper is removed.
- The French "Atlas" is marked as the same word, index.css is back at its
  length, the server people service is formatted, and the baselines drop
  the deleted AtlasPage and follow the lower counts.
2026-11-28 23:48:47 +01:00
Maurice 10713e41cd fix(atlas): clear the client gates of the globe Atlas
Client lint, checks and tests were red on the globe Atlas:

- The views own the globe and sky refs and hand them into useAtlasGlobe,
  so reading its state while rendering no longer counts as reading refs.
- Helpers that shared a file with components move to their own modules
  (badge tiers, medal label, Dawarich notes, hub tabs, period label).
- The place search derives its loading state, the search resets its
  active row on input, and the two silenced hook dependencies are named.
- placeLabels, the hover chip and the overview figures are split up.
- Raw text sizes become type tiers, the badge unlock docks on --z-overlay.
- The stats card test follows the GlobeStat props; baselines lowered to
  the counts the run reported.
2026-11-28 23:14:17 +01:00
Maurice d78dc79e21 feat(i18n): the globe Atlas in every language 2026-11-28 22:35:20 +01:00
Maurice 4f8c3f045e feat(atlas): the globe Atlas with its hub, on desktop and phone
The Atlas page is now the globe. Everything the classic map offered
carries over: visited countries and regions, planned countries, the
wishlist with places and target dates, Dawarich, tours, plugin layers and
the place search. New:

- regions on the globe, with how much of a country has been seen
  (#2675, #316, #487)
- flight arcs (#1369, #2642)
- a hub with statistics, badges, wishlist, Dawarich, tours and travellers
- an instance ranking, traveller profiles and a compare overlay
- a timeline that plays back how the map grew
- phone layouts of their own: sheets, chips and swipe actions

The classic Leaflet Atlas and its phone screen are removed.
2026-11-28 22:35:20 +01:00
Maurice c7cb0bc067 feat(atlas): a WebGL globe engine
One shader morphs an orthographic globe into a flat map as the zoom
grows. Country and region meshes are built in a worker from the TopoJSON,
picked on the GPU and coloured from a status texture; borders, coasts and
flight arcs are instanced screen-space lines. Regions are fetched ahead of
the zoom and kept to a bounded set; labels avoid each other. Includes the
day and night line, the moon in its phase and the badge medals.
2026-11-28 22:35:11 +01:00
Maurice 68af65a2a6 feat(atlas): read and write the Atlas offline
The Atlas reads go network first and fall back to a snapshot kept in a new
Dexie table (v17, append-only). Marks, unmarks and wishlist deletes made
offline wait in their own account-level queue, replayed in order with an
idempotency key, and every read lays them over the kept answer.
2026-11-28 22:35:11 +01:00
Maurice 04d134755a feat(atlas): flight routes, travellers and badges on the server
- GET /api/addons/atlas/flights folds the user's flight bookings into
  routes, airports and totals for the globe's arcs (#1369, #2642).
- GET /api/addons/atlas/people answers the Atlas side of other travellers
  on the instance: counts, visited countries and earned badges, never
  trips, places or dates. A user hides themselves with the atlas_hidden
  setting; the admin switch atlas_compare_enabled turns it off for all.
- shared/src/atlas/atlas-badges.ts holds the badge rules, computed from the
  data a user already has, so nothing is stored.
- MCP: list_atlas_flight_routes, list_atlas_badges, list_atlas_travellers.
2026-11-28 22:35:11 +01:00
Maurice 8510d4a729 build(atlas): build the globe geometry from the bundled boundaries
scripts/build-atlas-mesh.mjs turns the admin-0 and admin-1 GeoJSON the
server already ships into TopoJSON at three levels of detail per world and
two per country's regions, smoothed, quantized and Brotli-packed under
content-hashed names, plus a manifest with every country's anchor, box and
region index. It runs at build time (npm run build, npm run dev when the
sources changed, and the Docker server stage); the output is not committed.

/api/addons/atlas/mesh serves the manifest and the files as they are
(immutable, a year), decompressing as a stream for a client without br.
2026-11-28 22:35:10 +01:00
Maurice 5989ba5f1f fix(map): draw a reopened trip's routes from the device at once
The rounds that pace their router requests told a cached leg from a request by how long it took, anything past 60 ms counting as a request. Since routes are kept on the device, a leg read back after a reload is an IndexedDB read, which on a page busy drawing the map often takes longer, so every leg waited out a request's pause and the trip filled in one leg a second as if it were routed again. The whole trip's route, the road trip day rounds and the join release now count whether a router actually answered. A relay that refused also kept its rest only in memory, so every reload asked it again for the first day; the rest now holds on the device until it ends.

Closes #3228
2026-11-28 22:21:09 +01:00
Maurice 7c0c749bcc fix(llm-parse): read a model answer whose keys carry stray whitespace
Small local models now and then write a key with a space around it, such as 'departureTime ', and the mappers look every field up by its exact name, so an imported booking lost its times. Every model answer now has its keys trimmed at the one place all of them pass through (parseLenientJson for a written answer, toReservationList for a filled tool call, and the Anthropic client's own root key lookup). Values stay as they are; an exact key wins over one that only trims to the same name.

Closes #3260
2026-11-28 22:21:09 +01:00
Maurice 94163f76e0 build(server): compile with SWC instead of tsc so the build fits a small container
tsc needed about 3.4 GB of heap for the server build, all of it for the type graph, while the build never failed on type errors anyway. An install that builds from source on a 4 GB container (the Proxmox script gives Node 75% of its memory) ran out of heap with 5.2.2. SWC compiles the files tsconfig.build.json names, one at a time and with the options read from it, in about a second and 130 MB; the type check stays with npm run typecheck in CI. Built with both on the same commit, dist holds the same 2390 files, and the server boots with the same 859 routes and 226 modules and answers the same requests the same way.
2026-11-28 20:41:56 +01:00
Maurice c39f739b7f fix(costs): ignore a settlement answer that lands after the ledger unmounted
A read still in flight when the Costs view closed set state on the gone component; in a torn-down test environment React then failed on the missing window and the run reported an unhandled error.
2026-11-28 19:21:59 +01:00
Maurice 7e9ab58a16 chore(deps): move vitest, its coverage providers and jest-dom to 5 together
Vitest 5 resolves only with coverage-v8 and coverage-istanbul of the same version, and jest-dom 8 is the first release whose matcher types merge with its Assertion. The sharded CI jobs read and write the blob reports under .vitest/blob, where 5 puts them, and clearMocks stays off as in 4.
2026-11-28 18:58:05 +01:00
Maurice 41772c0d8e fix(ssrf): answer a pinned lookup on a later tick so a failed connect cannot crash the server
Called back at once, a connect that fails right away (no route to an IPv6 address) tore the socket down while tls.connect was still setting it up; undici saw 'fetch failed' and the socket's own error then reached no listener and ended the process. The pinned lookup now answers on the next tick, as dns.lookup does.
2026-11-28 18:20:00 +01:00
Maurice d6ce33c51c chore(client): drop the React imports nothing reads
typescript-eslint 8.74 no longer takes the classic JSX pragma for the automatic runtime, so an unused default React import is reported now. The no-unused-vars baseline of the app code drops by the one it already counted.
2026-11-28 17:54:38 +01:00
Maurice edb1eab0c3 chore(server): drop the @types/bcryptjs stub now that bcryptjs ships its types 2026-11-28 17:40:25 +01:00
Maurice 91a37286ca fix(native): import @noble/hashes 2 through its .js subpaths 2026-11-28 17:40:24 +01:00
dependabot[bot] 382c1a78dc ci: bump SonarSource/sonarqube-scan-action
Bumps the actions-minor-and-patch group with 1 update: [SonarSource/sonarqube-scan-action](https://github.com/sonarsource/sonarqube-scan-action).


Updates `SonarSource/sonarqube-scan-action` from 8.5.0 to 8.5.1
- [Release notes](https://github.com/sonarsource/sonarqube-scan-action/releases)
- [Commits](https://github.com/sonarsource/sonarqube-scan-action/compare/59202af334b4ba7b5db01b701b8e79f8b3bef0f4...70bad232163b09d998ea0707ee80c0ec80798c16)

---
updated-dependencies:
- dependency-name: SonarSource/sonarqube-scan-action
  dependency-version: 8.5.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions-minor-and-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-28 17:38:10 +01:00
dependabot[bot] b3c2f0b7e2 chore(plugin-sdk): bump @types/node in /plugin-sdk
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.20.5 to 26.6.10.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 26.6.10
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-28 17:38:09 +01:00
dependabot[bot] c785a0950a chore(plugin-sdk): bump the plugin-sdk-minor-and-patch group
Bumps the plugin-sdk-minor-and-patch group in /plugin-sdk with 2 updates: [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) and [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest).


Updates `@vitest/coverage-v8` from 5.1.1 to 5.1.2
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md)
- [Commits](https://github.com/vitest-dev/vitest/commits/v5.1.2/packages/coverage-v8)

Updates `vitest` from 5.1.1 to 5.1.2
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md)
- [Commits](https://github.com/vitest-dev/vitest/commits/v5.1.2/packages/vitest)

---
updated-dependencies:
- dependency-name: "@vitest/coverage-v8"
  dependency-version: 5.1.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: plugin-sdk-minor-and-patch
- dependency-name: vitest
  dependency-version: 5.1.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: plugin-sdk-minor-and-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-28 17:38:09 +01:00
dependabot[bot] c8615e0362 chore(deps): bump @noble/hashes from 1.8.0 to 2.4.0
Bumps [@noble/hashes](https://github.com/paulmillr/noble-hashes) from 1.8.0 to 2.4.0.
- [Release notes](https://github.com/paulmillr/noble-hashes/releases)
- [Changelog](https://github.com/paulmillr/noble-hashes/blob/main/CHANGELOG.md)
- [Commits](https://github.com/paulmillr/noble-hashes/compare/1.8.0...2.4.0)

---
updated-dependencies:
- dependency-name: "@noble/hashes"
  dependency-version: 2.4.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-28 17:38:09 +01:00
dependabot[bot] bc6b56c84c chore(deps): bump bcryptjs and @types/bcryptjs
Bumps [bcryptjs](https://github.com/dcodeIO/bcrypt.js) and [@types/bcryptjs](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/bcryptjs). These dependencies needed to be updated together.

Updates `bcryptjs` from 2.4.3 to 3.0.3
- [Release notes](https://github.com/dcodeIO/bcrypt.js/releases)
- [Commits](https://github.com/dcodeIO/bcrypt.js/compare/2.4.3...v3.0.3)

Updates `@types/bcryptjs` from 2.4.6 to 3.0.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/bcryptjs)

---
updated-dependencies:
- dependency-name: bcryptjs
  dependency-version: 3.0.3
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: "@types/bcryptjs"
  dependency-version: 3.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-28 17:38:08 +01:00
dependabot[bot] c00b6dd636 chore(deps): bump the npm-minor-and-patch group across 1 directory with 6 updates
Bumps the npm-minor-and-patch group with 6 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@assistant-ui/react](https://github.com/assistant-ui/assistant-ui/tree/HEAD/packages/react) | `0.15.37` | `0.15.38` |
| [@trivago/prettier-plugin-sort-imports](https://github.com/trivago/prettier-plugin-sort-imports) | `6.0.2` | `6.0.3` |
| [@types/leaflet](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/leaflet) | `1.9.22` | `1.9.23` |
| [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) | `19.3.0` | `19.3.2` |
| [rollup-plugin-visualizer](https://github.com/btd/rollup-plugin-visualizer) | `7.1.3` | `7.3.0` |
| [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.73.0` | `8.74.0` |



Updates `@assistant-ui/react` from 0.15.37 to 0.15.38
- [Release notes](https://github.com/assistant-ui/assistant-ui/releases)
- [Changelog](https://github.com/assistant-ui/assistant-ui/blob/main/packages/react/CHANGELOG.md)
- [Commits](https://github.com/assistant-ui/assistant-ui/commits/@assistant-ui/react@0.15.38/packages/react)

Updates `@trivago/prettier-plugin-sort-imports` from 6.0.2 to 6.0.3
- [Release notes](https://github.com/trivago/prettier-plugin-sort-imports/releases)
- [Changelog](https://github.com/trivago/prettier-plugin-sort-imports/blob/main/CHANGELOG.md)
- [Commits](https://github.com/trivago/prettier-plugin-sort-imports/compare/v6.0.2...v6.0.3)

Updates `@types/leaflet` from 1.9.22 to 1.9.23
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/leaflet)

Updates `@types/react` from 19.3.0 to 19.3.2
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Updates `rollup-plugin-visualizer` from 7.1.3 to 7.3.0
- [Changelog](https://github.com/btd/rollup-plugin-visualizer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/btd/rollup-plugin-visualizer/compare/v7.1.3...v7.3.0)

Updates `typescript-eslint` from 8.73.0 to 8.74.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.74.0/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: "@assistant-ui/react"
  dependency-version: 0.15.38
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: "@trivago/prettier-plugin-sort-imports"
  dependency-version: 6.0.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: "@types/leaflet"
  dependency-version: 1.9.23
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: "@types/react"
  dependency-version: 19.3.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-and-patch
- dependency-name: rollup-plugin-visualizer
  dependency-version: 7.3.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
- dependency-name: typescript-eslint
  dependency-version: 8.74.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-and-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-28 17:38:08 +01:00
Maurice 7e01f9661b fix(help): name the wildcard of the help asset route for Express 5 2026-11-28 17:34:18 +01:00
Maurice dee1a361c3 fix(postgres): keep plugin columns named like PostgreSQL 19's new functions
Besides uuid, 19 brings error_on_null, tid_block, tid_offset and oid8 to
the catalog, and since the catalog list is the same for every server the
guard refused a plugin's s.error_on_null column on 14 to 18 too, where it
had always passed. error_on_null and the tuple id parts only read their
argument and join the allowlist, where PGPLUG-022 checks their overloads;
oid8 only converts, like oid, and joins the column names.
2026-11-28 17:33:56 +01:00
Maurice d94f97f9ae fix(postgres): let plugin SQL keep its uuid columns and casts on every server
PostgreSQL 19's catalog brings a uuid(bytea) conversion, and once its name
joined the catalog list the guard refused every uuid it read as a call or a
field: `t.uuid` and `uuid($1)` failed on 14 to 18 too, where they had
always passed. uuid joins the other type name conversions on the plugin
allowlist, so PGPLUG-022 checks its overloads on the 19 lane.
2026-11-28 17:33:56 +01:00
Maurice aad9272b2e fix(postgres): know PostgreSQL 19's catalog functions and refuse regdatabase
PostgreSQL 19 adds 41 functions to pg_catalog that the plugin guard's
catalog list did not hold, so PGPLUG-021 failed on the 19 lane and a plugin
could call the new ones the allowlist does not name. They are now in
catalog-functions.txt, taken from 19's pg_proc.dat; none of them joins the
plugin allowlist.

19 also adds the object identifier type regdatabase, whose input looks a
database of the cluster up by its name. A cast to it passed the guard, so a
plugin could probe which databases the server holds. It now joins the other
name lookup types, its array type with it.
2026-11-28 17:33:55 +01:00
Maurice 59f6e349bf feat(postgres): support PostgreSQL 19
PostgreSQL 19 was released on 19.11.2026, and TREK refused it at boot as
newer than the 14 to 18 it supported (discussion #3214). It now supports 14
to 19.

The image installs the version 19 client tools from PGDG's main component,
since the per-major component can trail a new release; a client handles
every server up to its own major, so pg_dump, pg_restore and psql 19 back up
and restore every supported server. The tools are looked for in the 19
directory first. Installs that pointed TREK_DB_PG_BIN_DIR at the old
/usr/lib/postgresql/18/bin keep working: the image keeps that path as a link
to the 19 tools. CI runs the Postgres lane on 14 and 19 instead of 14 and
18, so the job count stays the same, and the Docker job boots on 19. The
list of server functions and roles that reach the host was checked against
the release notes; PostgreSQL 19 adds none. The compose example stays on 18,
because an existing database stays on the major it was created with.
2026-11-28 17:33:55 +01:00
Jan Kleine dc4b7854d7 fix(helm): add home and sources to the chart so Renovate finds its release notes 2026-11-28 15:24:50 +01:00
github-actions[bot] a4446f16be chore: bump version to 5.2.2 [skip ci] 2026-11-28 13:20:02 +00:00
Maurice 058c3b3909 chore(notices): show 5.2.2 in the release notes modal 2026-11-28 13:19:26 +01:00
Maurice 7f3ead2c85 test(realtime): cover forgetting a closed session after a minute 2026-11-28 01:21:33 +01:00
Maurice 1553be3d5b refactor(auth): keep the per-address reset throttle in a module of its own
The reset link check grew the auth service past its size baseline.
2026-11-28 01:08:06 +01:00
Maurice fc891c16b2 chore(server): lower the test baseline of no-await-in-loop 2026-11-28 00:59:56 +01:00
Maurice bcad069705 test: keep the new tests within the lint and hand-built service ratchets 2026-11-28 00:55:51 +01:00
Maurice 610845e84d fix(realtime): refuse a ws token of a session whose sockets were just closed
A token minted shortly before its session ended could still open a socket
within its 30 seconds, and no later close would reach it.
2026-11-28 00:47:41 +01:00
Maurice 4705d88933 fix(native-release): let a held back APK go out by hand from its release tag
A run started by hand on a release tag publishes too, so a build held back
while its server was not released yet can follow once it is.
2026-11-28 00:45:52 +01:00
Maurice ed134fdef3 fix(oidc): count every back-channel logout at the door and give the attempt back when it was valid
Counting only the refused ones after the work let a burst of forged tokens run
past the limit while the provider's keys were still being fetched.
2026-11-28 00:45:24 +01:00
Maurice 8c5e7373d3 fix(android): paint the warm ground on a drawable of its own, so the window gets its theme colour back
Recolouring the decor view changed the theme's own colour drawable in place,
so restoring it once the server's page was up handed the window the warm
ground again.
2026-11-28 00:44:01 +01:00
Maurice 5b27624c33 fix(native-release): publish the Android APK for release tags only
A prerelease tag or a run started by hand is a testing build on the internal track, so it no longer replaces the public APK in liketrek/trek-android.
2026-11-28 00:35:11 +01:00
Maurice ac0f8f052d fix(android): give the window its normal colour back once the server's page is up
After a server was picked, the address screen's cream stayed behind the page for the whole session, so an older WebView showed it under the status bar with icons meant for a dark page.
2026-11-28 00:35:11 +01:00
Maurice 81b66d3170 fix(native): keep a chosen language on the app sign-in screen
The sign-in screen in the app now speaks the device language only when no language was chosen before, so the screen and the signed-in session match what the next launch shows.
2026-11-28 00:35:10 +01:00
Maurice 9bfdd10638 fix(native): hand a resumed browser sign-in over to the app like every other sign-in
When Android restarted the app during a system browser sign-in, the resumed sign-in waited on the web takeoff timer, so the sign-in screen faded to an empty page and the app rose in without its handover or success tap.
2026-11-28 00:35:10 +01:00
Maurice bbc9c72168 fix(map): ask Valhalla again for days drawn by OSRM only while the relay rested
The OSRM stand-in is kept only for a day Valhalla was asked and could not route, so a short rest or an offline session no longer keeps other days on OSRM for an hour.
2026-11-28 00:35:10 +01:00
Maurice 5c5c468489 fix(mobile): keep the photo viewers clear of a side notch in right to left languages
The screen insets stay on their own physical sides when the text runs right to left, so the close button no longer sits under the camera in landscape.
2026-11-28 00:35:09 +01:00
Maurice 5685cdfe13 fix(mobile): search a map link shared while the add-place sheet is already open
The shared link is put in the field and searched as given, instead of whatever the field held when the sheet opened.
2026-11-28 00:35:09 +01:00
Maurice 82ded80978 fix(mobile): read the stop being moved as it is now, so a change by a collaborator is not lost
The move list keeps only the stop's id and looks up its current day on every tap, and closes once the stop is gone from the place.
2026-11-28 00:35:09 +01:00
Maurice 46a2fd2bbb fix(mobile): place a timed stop moved to another day among every stored row of that day
The slot is counted over the stored rows, booked nights and hidden service stops included, as the desktop move does, so the stop no longer lands ahead of them.
2026-11-28 00:35:09 +01:00
Maurice ff676c8fc2 fix(bookings): move hotels and day-linked transports into Past once their days are over
A booking without a date of its own now reads its stay or linked day for that, as the date sort already does, so the Past section also opens once the whole trip is over.
2026-11-28 00:35:08 +01:00
Maurice 0b6a77eeb5 fix(weather): ask the forecast for the day east of UTC still reaches
Detailed weather for a trip day 16 UTC days out now asks Open-Meteo, whose range counts from the place's own date and still covers that day east of UTC; only a refusal falls back to last year's day, and that answer is cached for an hour instead of a day.
2026-11-28 00:35:08 +01:00
Maurice 7c6189f504 fix(assistant): leave room for the attached file tools when loading tool groups
A trip turn with an attached file adds read_attached_file and keep_attached_file to the session's tools, so loading groups now stops two short of the 128 tools OpenAI and Azure accept in one request.
2026-11-28 00:35:08 +01:00
Maurice 6bbe597719 fix(auth): bind a password reset link to the address it was mailed to
The reset request reads the account's address again inside the transaction that issues the link, and the link stores that address, so a link raced past an email change no longer resets the moved account. Links issued before this keep working until they expire.
2026-11-28 00:35:08 +01:00
Maurice 218304179c fix(oidc): count only refused back-channel logouts toward the rate limit
A realm-wide sign-out sends one validly signed logout per session from one address, and past 600 a minute the rest got 429 and stayed signed in. Only tokens that are refused count now, so a flood of bad tokens is still capped.
2026-11-28 00:33:50 +01:00
Maurice a6328cef3b fix(oidc): close the sockets of the sessions a back-channel logout ends by sid
A logout token naming the provider's session ended the TREK sessions but left their websockets open, so a signed-out tab kept receiving trip and journey broadcasts. Each ended session now closes its sockets, as the other revoke paths do.
2026-11-28 00:33:50 +01:00
Maurice 96d8b5c664 fix(sessions): close only the sockets of the session that ended
A ws token now carries the session it was minted under and the socket keeps it, so signing out on one device no longer drops the live socket of every other device. Ending all sessions still closes every socket of the account.
2026-11-28 00:33:42 +01:00
Maurice b5350287a4 fix(mobile): keep the shared place link type to its store, and expect notes on the desktop save 2026-11-27 23:56:19 +01:00
Maurice dbe0b847bd test(mobile): expect the past group among the empty transport groups 2026-11-27 23:49:42 +01:00
Maurice fc1022a452 chore(client): lower the theme baseline for the two photo viewers 2026-11-27 23:44:18 +01:00
Maurice 8b008a74fe fix(mobile): share the bookings tabs' sections, and fit two tests to the sheets they test
Both bookings tabs built the same status sections; listSections in the shared
filter hook now does it once. The photo sort test looks for the sheet in the
document, as the sheet is portalled to the body, and the saved place test
expects the notes the sheet now sends.
2026-11-27 23:39:30 +01:00
Maurice 1fa5c8cec2 fix(i18n): mark the French and Catalan word for notes as the same as in English 2026-11-27 23:31:23 +01:00
Maurice 443a4fd488 refactor(mobile): open what was shared into a trip from a hook of its own
The trip shell had grown past the 1000-line limit with the shared map link.
Both effects that open a shared item in the trip, the booking import and the
new place sheet, now live in useSharedIntoTrip beside the share store.
2026-11-27 23:27:17 +01:00
Maurice 8d5d34fbb3 feat(mobile): say in a trip's menu whether it is on the device
Whether a trip was kept for offline use was only to be found in the offline
settings. The trip's own menu now has an Offline entry that says it right
there: saved on this device as of the last sync, not saved yet, or not kept
here (switched off, or a finished trip nobody pinned). A tap opens the
offline settings, where everything else about it is.

Addresses discussion #1580.
2026-11-27 23:24:01 +01:00
Maurice 57fb2cf47b feat(mobile): add a place shared from Google Maps or Amap to a trip
A place shared from a maps app to TREK could only be kept among a trip's
links or read as a booking. A map link is now first offered as a place: after
the trip is picked, its new place sheet opens with the link in the search,
which looks it up at once through the existing resolver, so name, address
and position are filled in and only need saving. Other links are offered as
before.

Addresses discussion #2582.
2026-11-27 23:24:00 +01:00
Maurice 20d10d765d feat(mobile): number the stops of a day in the plan as their pins are
The map numbers a day's stops on their pins, the phone's plan did not, so
matching a pin to its row meant reading names. Each stop now carries its
number at the foot of its picture, in the pin's dark round. The count moved
into stopNumbersOfDay, which the map reads too, so a row and its pin always
agree, service stops passed over on both.

Addresses discussion #2584.
2026-11-27 23:24:00 +01:00
Maurice fd6d1969f5 feat(tours): open what a walk's stop has to tell under it
A city walk's stops showed only their names. A stop standing for a trip place
with a description, an address or a website now opens them under itself on a
tap of its name, marked by a small chevron, without leaving the walk. Stops
without anything more to say stay as they were.

Addresses discussion #3205.
2026-11-27 23:24:00 +01:00
Maurice 8c0cca536a feat(mobile): sort an entry's photos by dragging them on the phone
The phone's journal editor could only move a photo to the front. Its tiles
now take a long press and a drag into any place, through the photo order the
desktop editor already uses (saved at once, put back with a toast when the
save fails) and the touch bridge the plan's rows use. The faded tile is the
one moving, the ringed one where it lands. Moving to the front stays one tap.

Addresses discussion #2851.
2026-11-27 23:24:00 +01:00
Maurice dd1a117b92 feat(collections): show and edit the own notes of a saved place
A saved place has carried notes for a while (the API and the assistant write
them), but neither the phone sheet nor the desktop detail showed them, so
notes written there were invisible. Both now show them under the
description when there are any, and edit them beside it, through the shared
form hook.

Addresses discussion #3168.
2026-11-27 23:23:59 +01:00
Maurice 59b8d00373 feat(mobile): open journal entries to read them, with a pencil into the editor
On the phone everyone who may edit a journey got every entry straight in the
editor, so reading the journal meant scrolling a form and risking a stray
edit. An existing entry now opens as its read view: its date and time head
it, the story, place, the chosen mood and weather follow, and the entry's
settings (draft, route) and locked fields stay out of the way. A pencil in the
header switches to the editor without closing the sheet. New entries and
suggestions open in the editor as before, and a viewer's sheet is unchanged.

Addresses discussion #3007.
2026-11-27 23:23:59 +01:00
Maurice 9ea489ac97 feat(mobile): move a stop to another day from its day in the place sheet
On the phone a stop could only be removed from a day and added to another,
which lost its time and notes. A tap on the day in the place sheet now opens
the same short day list as adding, headed 'Move to another day', and moves
the stop there through the planner's move, so its time, notes and road trip
waypoints come along and a timed stop lands where its time belongs. No new
control in the plan's rows.

Addresses discussion #2583.
2026-11-27 23:23:59 +01:00
Maurice 17c56326e9 feat(mobile): fold transports and bookings that are over into a Past section
Mid-trip the transports and bookings tabs kept every flight already landed
and every check-in already done above what is still ahead. What is over (its
end, or its start where it has none, before the moment the tab opened, in
local wall-clock time) now stands in a Past section at the end, latest first.
It starts folded while something is still ahead and open once the whole trip
is over, to look back on. The desktop list is unchanged.

Addresses discussion #3156.
2026-11-27 23:23:59 +01:00
Maurice f3bdcf7ffb feat(mobile): open directions from a place's address and a booking's location
On the road the address is what the eye lands on. A tap on it in the place
sheet now does what the navigation button does (the preferred map app, or
the choice of apps), and the location row of a booking card opens
directions to it the same way, marked by a small arrow. The rest of the
booking card still opens the booking.

Addresses discussion #3213.
2026-11-27 23:23:59 +01:00
Maurice e7b900d309 fix(journey): open photos and videos full screen below the status bar, with the close button in reach
On a phone the journey's photo viewer opened inside the screen's own box
instead of over the whole screen, and its top bar, close button included, sat
under the status bar and a notch. It is now portalled to the page, its top
bar is a row of its own below the device's insets, the photo or video fills
what is left, and the page behind it no longer scrolls. The trip files
viewer, which shows videos too, keeps its header below the insets as well
and gets the same larger close button.
2026-11-27 23:23:58 +01:00
Maurice ffd9338217 fix(ci): give the Sonar upload five minutes instead of one
The release pull request's analysis report zips to about 77 MB, and the
scanner gave up on its upload to SonarCloud after the default 60 second
socket timeout three runs in a row (HttpTimeoutException on ce/submit), so
the scan never reached a quality gate.
2026-11-27 22:41:52 +01:00
Maurice 2186d8b230 test(oidc): narrow the logout token check with in, as the server compiles without strictNullChecks 2026-11-27 22:30:03 +01:00
Maurice 06aaddc34d feat(oidc): end TREK sessions when the identity provider signs a user out
OpenID Connect Back-Channel Logout 1.0: the provider calls
POST /api/auth/oidc/backchannel-logout with a logout token when a user signs
out there or an admin ends their session, and TREK ends the matching
sessions. Until now a session lived on for up to 30 days after access was
taken away at the provider.

- The token is checked as section 2.6 asks, through the verifier the login
  uses for the id_token (provider JWKS, issuer incl. a custom discovery URL,
  client id in aud), plus a recent iat, the logout event, a sub or sid, no
  nonce, an accepted typ and a jti not seen before (in-memory, bounded replay
  store; a jti whose sessions failed to end is released for the retry).
- The id_token's sid is stored on the session the SSO sign-in creates
  (nullable user_sessions.oidc_sid, both engines), and an app session handed
  off from that browser sign-in carries it too. A token with a sid ends those
  sessions only; a token with only a sub ends every session of the account.
- A valid token answers 200 with no-store also when it names nobody here; an
  invalid one 400 invalid_request, never 500, with the reason only in the
  server log. Public route with its allow-list entry, rate limited, audited
  as oidc.backchannel_logout.
- Always active: nothing changes until an admin enters the URL at the
  provider. Wiki: the URL, where it goes in Authentik, Keycloak and Pocket ID,
  and Keycloak's single token when an admin signs a user out.

Addresses discussion #3124.
2026-11-27 22:24:21 +01:00
Maurice 6f669920f1 test(realtime): wait for socket frames without awaiting in a loop
The room revocation suite polled for frames and joined its sockets one by
one, which the server lint counts as await in a loop against the tests'
baseline. It now waits on the frames as they arrive and joins in parallel.
2026-11-27 22:08:01 +01:00
Maurice 1fb20a542c fix(realtime): end a socket with its session and after a database swap
An open WebSocket outlived what it was opened with. Ending a user's
sessions (a password change or reset, an admin password change or MFA
reset, signing out other devices, a single session revoked) left their
sockets in every room and on their user channel, so a stolen session kept
listening. A backup restore or the demo reset put another database in place
while every socket stayed in its rooms, and on SQLite a restored id can
name another trip.

Ending a session now closes the user's sockets, and every reopen of the
database closes all of them; a client whose session still holds connects
again and joins what it may. A join asks once more from inside the room,
so a removal that committed while its first answer was on the way cannot
leave it behind. The trip recheck always names its trip, and its checks
are covered branch by branch.
2026-11-27 22:08:01 +01:00
Maurice d8be9a40e7 fix(realtime): take a socket out of a room once its access ends
A socket was let into a trip room or a journey's book room with one access
check and then trusted: delivery went by room membership alone. So a member
removed from a trip kept receiving every broadcast of it on the socket they
had already joined, a contributor taken off a journey kept the book's
pointers and presence and could still send pointers, and a deleted account's
sockets stayed in every room.

The gateway now installs the checks its joins run, and every write that ends
access asks the sockets already in again once it is committed and its own
event went out: a member removed or leaving (REST, MCP and plugin RPC), a
trip deleted, a contributor removed, a journey deleted, a trip's journal
link replaced, narrowed or removed. Open books are asked again with every
trip change, since a book can be open through a trip's journal. A socket
that no longer passes leaves the room, and a book that loses somebody tells
the others. A deleted account's sockets are closed. An answer that cannot be
had counts as no access.
2026-11-27 22:08:01 +01:00
Maurice 512584b4f1 fix(native): catch the status bar style call where the app has no status bar plugin
An unanswered rejection from StatusBar.setStyle surfaced in the sign-in
screen's tests, where the web build has no such plugin. Unimplemented is no
failure; anything else is reported as the other native calls are.
2026-11-27 21:48:56 +01:00
Maurice 985998e757 test(login): submit the app sign-in form with its required fields filled 2026-11-27 21:42:57 +01:00
Maurice 742c0dd72d fix(login): keep the app sign-in screen within the eslint ratchets
Split the other ways in out of one component (complexity), finish the async
handlers with void instead of handing promises to React, report a landscape
that fails to load instead of logging it, let the handover wait on settled
settings rather than catching them, and move the one-time code field's props
into a module of their own so MfaCodeStep only exports its component.
2026-11-27 21:42:56 +01:00
Maurice efd34df038 fix(login): name the SSO button SSO when the provider has no display name, as OIDC-only does 2026-11-27 21:42:56 +01:00
Maurice 321980c95b test(login): build the sign-in page's own config shape in the app screen tests 2026-11-27 21:42:56 +01:00
Maurice d4595269b5 refactor(login): both sign-in screens take their headings and labels from loginModel
LoginPage grew past its size baseline with the app's branch. Its heading,
subtitle and submit label chains now come from loginModel, which the app's
screen already used, so the file shrinks by 21 lines and the baseline follows.
The model translates the keys itself, written out, so the i18n key check
keeps seeing them.
2026-11-27 21:42:55 +01:00
Maurice 32de7adbf6 feat(native): app sign-in screen that continues the address screen
Inside the iOS and Android app the sign-in page looked like the web form it
is in a browser: a white card on grey, the web header and a language menu,
reached through a white page, a grey spinner and another white page, and left
through the 2.6 s takeoff animation.

- AppLogin: the address screen's landscape with the connected server on its
  glass card (Change leads back to the address screen), and its fields,
  buttons and type on the same warm page. Same useLogin hook, so password,
  remember me, forgot password, SSO, OIDC-only, passkey, demo, MFA, password
  change, registration and invites all stay as they are.
- The app speaks the device language with English as the fallback; no
  language menu there.
- Handover: theme-boot.js marks a page inside the app that nobody signed in
  to yet, which then starts on the address screen's colour, waits with its
  spinner, and fades the sign-in screen in. After signing in the screen steps
  back while the settings load and the app rises in, instead of the takeoff.
- Android: the WebView and window keep the address screen's colour across the
  restart onto the server, and the status bar icons stay readable where an
  older WebView lays the page out below the bar (shell and sign-in).
- loginModel holds the headings, button labels and SSO links both sign-in
  screens share.

The browser's sign-in page is unchanged.
2026-11-27 21:42:39 +01:00
Maurice fef7ac4587 fix(map): set the trip overview aside for the visit instead of switching it off
Making room for the day details went through the overview's remembered
switch, which the account keeps per trip and syncs to every device. A day
sheet on the phone, or two cards that did not fit on a narrow window, turned
the overview off everywhere without the traveller touching the pill.

The overview is now set aside for this visit only: the remembered switch
stays as it was, the pill shows it off and brings it back with one tap, and
a reload shows it again. The route overview hook keeps its declared return
type with the new hasPlannedRoute flag.
2026-11-27 21:07:07 +01:00
Luffy 7a57c58dd0 fix(map): prevent trip overview and day details from overlapping 2026-11-27 21:07:07 +01:00
Maurice 3dd63331bc fix(tours): format the dropdown changes and lower the hook ref baseline
The editor dropdown change drops the options ref useAnchoredPosition kept
for its measure callback, so the react-hooks/refs count falls by one and
the baseline follows it. The new and touched files are formatted, and the
new rail test gets its id like the rest of the file.
2026-11-27 20:51:46 +01:00
Luffy 20c8457f18 fix(tours): keep editor dropdowns inside the sidebar 2026-11-27 20:51:46 +01:00
Maurice eaef3c014e test(pdf): read the export's note cards without non-null assertions
The markdown test for the day notes reached its cards with three non-null
assertions, which the client lint counts against the tests' baseline. A
small lookup that fails with the missing selector reads them instead.
2026-11-27 20:35:01 +01:00
Maurice f02c0e088b fix(journey): keep the journal shown when a reload after a change fails
The journal views read the journal again after their own changes (saved
settings, a finished entry, an added trip, picked provider photos) by
calling loadJourney and dropping the promise. loadJourney rethrows every
failure, so a reload that failed, offline or timed out, became an unhandled
rejection with nothing shown to the user. In CI the same happened whenever a
test ended with such a read still open: the teardown runs the pending timers,
the request timeout fired, and the run failed on the unhandled error.

The store gets refreshJourney, which reads the journal and answers whether
the read landed instead of rejecting; a 404 still turns into notFound. The
shared journal hook hands it to the desktop and the phone view and to the
map layers in place of the raw loader, and the Studio uses it for its own
reads.
2026-11-27 20:27:29 +01:00
Maurice 2915ea573a fix(bookings): say what happens to an imported booking's cost on save
Reviewing an imported booking that carries a price shows the cost that
the save will link. Under it the dialog printed the create button's hint,
"Saves the booking, then opens the Costs editor", but this row is no
button: saving an imported booking adds the cost by itself, as the import
always has, and opens no editor. Following the hint, people waited for an
editor that never came.

The preview row now says the cost is added to Costs when the booking is
saved, in every language. The create button keeps its own hint.

Closes #3237
2026-11-27 20:13:31 +01:00
Maurice 407de33560 fix(booking-import): import a booking the document calls confirmed as confirmed
The mail import already wrote a booking as confirmed when its metadata held
reservationStatus, but nothing ever filled that field: the KItinerary mapper
dropped schema.org's reservationStatus, the AI reading was neither asked
for it nor given it in its response schema (a schema-bound provider fills
declared properties only), and the review form, the file import confirm
path and the assistant's import card all started every booking as pending.

The mapper now reads reservationStatus from every node, schema.org URL,
bare ReservationConfirmed or a plain word alike, and keeps it in the
item's metadata as TREK's word. The AI prompt and response schema ask for
it. One shared helper turns it into the status a booking is saved with:
confirmed when the document said so, pending otherwise, so a cancellation
or an unknown value still lands as pending. The review form prefill, the
mail import, the confirm path and the assistant card all use it.

Closes #3238
2026-11-27 20:08:19 +01:00
Maurice addcbe4801 fix(pdf): render markdown in day notes, booking notes and the day intro
The planner renders a day note's second line and a booking's notes as
markdown, and place texts in the PDF already went through the app's
sanitized markdown pipeline (#2692). Day notes, booking notes and the day
intro were still printed through escHtml, so the export showed the raw
syntax (asterisks, list dashes, rules) instead of the formatting.

They now use the same sanitized pipeline as bare markup inside their own
card, without the info row a place text gets, and drop the pre-line
whitespace that would double every markdown line break. Raw HTML in a
note is still printed as text.

Closes #3236
2026-11-27 19:58:00 +01:00
Maurice a9fd443b63 feat(db): present a Postgres client certificate from sslcert and sslkey in TREK_DB_URL
A Postgres server that authenticates clients by certificate could not be
used: TREK read only sslmode and sslrootcert from TREK_DB_URL, so neither
the connection pool nor pg_dump, pg_restore and psql ever offered a client
certificate (discussion #3215).

TREK_DB_URL now also takes libpq's sslcert and sslkey. Both must be given
together and only with a verifying sslmode, and each file must be readable,
or the boot refuses with the same kind of message as for sslrootcert. The
pool gets them as its TLS cert and key, the tools as PGSSLCERT and
PGSSLKEY. The Postgres wiki page shows the URL, how to mount the files with
Compose or the chart's extraVolumes, and libpq's rule for the key file's
permissions, which the backup tools enforce.
2026-11-26 23:35:18 +01:00
Maurice b8dffdbb13 fix(files): serve the stored offline copy when a live download stalls
Opening a document that was stored for offline use fetched it from the
server first and only fell back to the stored copy when the request
rejected. On a weak or stalled connection the request never rejects, so a
boarding pass already on the phone could spin indefinitely.

With a stored copy, the live download now gets five seconds, request and
body together; after that the stored copy is served and the download is
aborted. A connection that breaks while the body arrives serves the copy as
well. An HTTP error that comes back in time still surfaces over the copy,
and without a stored copy the download waits as long as it always did. The
test file is now formatted and leaves the format baseline.
2026-11-26 23:35:18 +01:00
Maurice 3b42ffa67b feat(helm): render extra Kubernetes objects from an extraObjects list
The chart had no way to ship objects of the operator's own next to TREK, so
a backup CronJob, a ConfigMap for it or any other helper had to live in a
second release or be applied by hand (discussion #3194). extraObjects takes
a list, empty by default so nothing renders, and renders each item through
tpl: a map as YAML, a string as written, so names such as
{{ .Release.Name }} resolve in both forms.

The values comment, the chart README and the Helm wiki page say that braces
are evaluated in both forms, that a backup job must mount the data volume
read only, and that it should copy TREK's own backup archives rather than
the live travel.db. Those archives carry the encryption key unless
ENCRYPTION_KEY comes from the environment, so their destination needs the
same protection as the volume. CI renders a variant with a CronJob in the
map form and a ConfigMap in the string form, checks it with kubeconform
-strict, and fails when a {{ is left unrendered.
2026-11-26 23:35:18 +01:00
Maurice 2ea1c99e31 ci(native): publish the Play-signed Android APK to liketrek/trek-android for installs outside Google Play
People who install apps from GitHub (Obtainium and the like) asked for the
Android app outside Google Play. After the Play upload, the release job now
fetches the universal APK Google Play builds of that same bundle, signed
with the Play app signing key, and publishes it with a checksum to
liketrek/trek-android: one release per app version, a newer build of the
same version replacing its APK. A phone can move between the Play install
and this APK without uninstalling, and Play Billing and push work in it
wherever Google Play services do.

It runs only inside the app builds that already happen, so a server release
without app changes publishes nothing. A build is held back while the app
needs a newer native API than the latest server release answers, so no APK
asks for a server that is not out yet. The APKs live in their own repository
so app releases never show up in the server's release list or update check.
2026-11-26 23:12:27 +01:00
Maurice d383d3527b fix(oauth): bind an authorization code to the session that consented, not to the password version
Reading the password version from the oauth domain meant injecting the
users repository, which the auth domain owns. The sessions domain answers
the same question and more: a password reset or change ends every session
of the user, and a sign-out ends the one that consented. The code now
carries that session's id and both token endpoints issue tokens for it
only while the session is active, checked in the transaction that writes
them. A token from before sessions were tracked has no session to check
and passes, as it does everywhere until it expires. A refused code is
audited as session_ended.
2026-11-26 22:46:15 +01:00
Maurice 05843c8e5b test(oauth): give the pending-code fixture its password version and format the controller test 2026-11-26 22:32:44 +01:00
Maurice 19270adef8 test(oauth): read the granted code without non-null assertions 2026-11-26 22:26:58 +01:00
Maurice f9ab280b7e fix(oauth): an authorization code mints tokens only while the password it was granted under holds
The consent page mints a two-minute authorization code from the cookie
session. A password reset or change revokes the user's OAuth tokens but
left such a pending code alone, so a code granted before the reset still
redeemed afterwards into a fresh token pair at either token endpoint.

The code now carries the password version of the session that consented,
and both token endpoints issue tokens for it only while that version is
still the account's, checked in the transaction that writes the tokens.
A refused code answers invalid_grant as any other and is audited as
password_changed.
2026-11-26 22:21:46 +01:00
Maurice c88d3abc5e fix(auth): a native app hand-off code redeems only while the session that minted it stands
The browser side of the native sign-in mints a one-time code from its
cookie session, and the app redeems it within a minute for a session of
its own. The code was bound to the account alone, so one minted before a
password reset, a sign-out or a revoked session still redeemed afterwards
into a fresh session, carrying access across the point where the account
took it back.

The code now carries the session it came from: its password version and,
for a tracked session, its id. Redeeming it mints a session only while the
password is unchanged and that session is still active, checked in the
same transaction that mints the new one.
2026-11-26 22:14:12 +01:00
Maurice 10d95a39ac fix(map): open a day the routing relay could not answer drawn, without waiting for it again
On an instance that routes its days with Valhalla (the TREK services by
default), a day the relay could not answer in time was drawn by OSRM and
kept only under the OSRM key. The next visit missed the Valhalla key, asked
the relay again and waited out its deadline, up to twelve seconds a day,
before the kept road showed, so every reload showed straight lines first.

OSRM's answer now stands in for such a day for an hour under a key of its
own, on the device only. Reopening the trip draws it at once; after the
hour the relay is asked again and its answer becomes the day's. Days that
avoid something keep asking Valhalla, since the stand-in drives the road
they mean to leave out.

Closes #3228
2026-11-26 22:09:59 +01:00
Maurice 7d802081ce test(assistant): replay the changed requests side by side in ANTH-010 2026-11-26 20:04:40 +01:00
Maurice 7586126797 fix(assistant): send Anthropic's thinking back only where the conversation before it is unchanged
Follow-up messages failed with HTTP 400 on Anthropic once a thread held an
answer that thought: the API binds each thinking block to everything the
request sends before it and refuses the request when any of that changed.
It changes in normal use: a tool group loaded later in the turn, an earlier
tool answer cut short once a new question follows, a held change applied
since, a trip card that moved on.

Each recorded step now keeps a fingerprint of what its request sent before
it (model, system blocks, tools, history). On replay its thinking blocks go
back only while that fingerprint still matches; otherwise the step goes back
without them, which the API accepts. Records written before this change
carry no fingerprint and go back without their thinking.

A refusal from Anthropic is now logged with the path its message names
(such as messages.1.content.0), without the rest of the message.

Closes #3094
2026-11-26 20:00:00 +01:00
Maurice 9fa2bef101 test(journey): keep the journey page suite's journal and handlers in its helper
The suite carried its sample journal and the journal's default handlers inline, and waiting for the reload in FE-PAGE-JOURNEYDETAIL-153 took it past its size limit. Both move to tests/helpers/journeyDetail.ts beside seedJourneyOwner; the file is 142 lines shorter and its size baseline follows.
2026-11-26 14:21:04 +01:00
Maurice ed1bba9371 test(client): finish moving the tests to msw 3
Two more window.location stand-ins sat on http://localhost while the
page runs on http://localhost:3000; they now use locationAt like the
rest, which brings back the plugin settings answer FE-COMP-
PLUGINSETTINGS-020 waits for. FE-PAGE-JOURNEYDETAIL-153 ended while the
journal reload it set off was still out, which timed out after the
test; it now waits for that read. The reload mocks in
versionHandover.test.ts carry the signatures of location.replace and
location.reload, as locationAt's overrides require.
2026-11-26 14:03:46 +01:00
Maurice 3c1cf8b347 chore(server): lower the strict baseline of the repository base class
MikroORM 7.2.12's typings leave trek-repository.ts with 4 strict errors instead of 8; the ratchet holds it there.
2026-11-26 14:03:46 +01:00
Maurice 1ed77870f9 test(db): see the unnamed temp files SQLite 3.54 opens on Linux
SQLite 3.54, which better-sqlite3 13.2.0 bundles, opens its temp files
with O_TMPFILE where the system has it. On Linux such a file has no
name: among the process's descriptors it reads <dir>/#<inode> (deleted)
instead of etilqs_<random>. The watcher only looked for the name, so
the control test saw nothing, and the test that TREK's own connection
never touches a temp file would have passed whatever happened. The
watcher now knows both forms; the control proves again that it sees
them.
2026-11-26 14:03:46 +01:00
Maurice 22ee4dbac7 ci(dependabot): let MikroORM and msw move again
Both are on their new versions now: MikroORM 7.2.12 with the OAuth
repositories writing the client the way it accepts, and the client tests
on msw 3. Their ignore entries go. better-sqlite3 and kysely, which
@mikro-orm/sqlite pins exactly, join the MikroORM group instead of being
ignored, so the three move in one pull request. cron and the musl rollup
pins stay held back for their own reasons.
2026-11-26 13:41:29 +01:00
Maurice 6926591112 fix(admin): a default setting reset right after typing is the value that stays
Typing a new Mapbox token or CARTO key and clicking that field's reset
link straight away sent two requests at once: the field's save on blur,
then the reset. Nothing ordered them, so when the server handled the
save last, the key typed a moment ago was stored again while the field
showed it cleared, on the desktop tab and on the phone screen alike.

The hook both shells share now sends its writes one after another, in
the order they were made (useWritesInOrder; a write that fails does not
hold up the next). FE-ADMIN-DUS-032 types, clicks reset at once and
makes the save the slower request; it fails without the order.
FE-HOOK-WRITES-001 to 003 cover the helper.
2026-11-26 13:41:28 +01:00
Maurice 66382e791b fix(admin): keep the dev notification buttons mounted while the panel updates
The desktop panel declared its button component inside its render, so
every state change (each lookup landing, each send starting and ending)
made a new component type and React remounted every button: focus and
hover were lost, and a click that arrived during a re-render went to a
button that was no longer there. Btn now lives at module level and takes
the send in flight as a prop, as the phone panel's Btn already does.
FE-ADMIN-DEVNOTIF-017 holds a button across the lookups landing and
expects the same element; it fails with the old panel.
2026-11-26 13:41:28 +01:00
Maurice 32837afe2e chore(deps-dev): bump msw from 2.15.0 to 3.0.8 and move the client tests to it
msw 3 renames onUnhandledRequest to onUnhandledFrame and reports every
network frame there; the setup judges the HTTP frames as before (another
origin is an error, the page's own a warning).

It also resolves a relative handler, and its fetch interceptor a
relative URL, against location.href at the time of the request, while
jsdom's XHR sends to the document's own address. Tests that replaced
window.location with a stand-in on http://localhost while the page runs
on http://localhost:3000 sent their requests past every handler.
tests/helpers/location.ts builds such stand-ins on the page's own origin
(locationAt, pageUrl), and every one of them now uses it.

msw no longer escapes fake timers, and responses are timed differently,
which surfaced tests that ended with work still running: a held request
answering in the next test, a lookup still out when the assertions ran,
a reload switched by counting reads. Each of those now waits for, or
releases, what it started, and answers by what happened rather than by
a count.

The day panel suites share their setup through
tests/helpers/dayDetailPanel.ts instead of a copy each, which keeps the
larger one under its size limit.
2026-11-26 13:15:45 +01:00
Maurice 05f4c84885 test(reservations): cover the traveller insert that ignores existing rows
ReservationTravelers.insertIgnore had no test of its own. MikroORM 7.2.10 changed how upsertMany with a composite conflict key matches rows read back after a conflict, which is exactly the case of a traveller already on the booking next to a new one in one call. RS9-001 to RS9-004 pin that case, a duplicate id, another booking's row and an empty list; the first two fail with a plain insert.
2026-11-26 12:57:32 +01:00
Maurice 6905729ab6 chore(deps): bump MikroORM from 7.2.8 to 7.2.12 with better-sqlite3 13.2.0 and kysely 0.29.9
From 7.2.9 on, MikroORM reads a bare value given for a relation as the
target's primary key. The client relation of oauth_tokens and
oauth_consents points at oauth_clients.client_id, a unique column that
is not the primary key, so every token mint and every consent grant was
refused ("Cannot set OauthTokens.client to a reference of OauthClients
without the value of OauthClients.client_id"): every OAuth and MCP
sign-in would have failed.

insertToken now hands the referenced column itself to the relation
(oauthClientRef), which MikroORM writes to client_id as it is.
upsertGrant writes the row with Kysely's onConflict on
UNIQUE(client_id, user_id), because em.upsert takes that same value as
the data of a new OauthClients entity. The test fixtures that seed
tokens and consents use the same helper. Reading client_id back is
unchanged; the repository tests seed clients whose primary key differs
from their client_id, one of them a decoy whose primary key equals
another client's client_id.

The lockfile resolves the MikroORM tree from scratch, so there is one
@mikro-orm/core again instead of a second copy next to @mikro-orm/nestjs.
better-sqlite3 13.2.0 ships prebuilt binaries for every platform the
image builds, musl included.
2026-11-26 12:39:43 +01:00
Maurice 85aa1c91ff test(booking-import): check the upload limits the route sets, not Nest's whole set
NestJS 11.2.12 adds its default parts limit to every multer interceptor, so the options hold one more key than the route names.
2026-11-26 11:26:35 +01:00
Maurice de9901d941 refactor(files): drop the drop zone's noClick option, which is its default
Keeps useFileManager within the function length limit now that it names noPaste; react-dropzone's noClick defaults to false, so a click still opens the picker.
2026-11-26 11:26:35 +01:00
Maurice 95a0cd2f77 ci(dependabot): hold back the updates that cannot move on their own
The last grouped update showed which packages break when Dependabot moves
them alone: MikroORM from 7.2.9 on refuses the OAuth repositories'
foreign key writes, better-sqlite3 and kysely are pinned by
@mikro-orm/sqlite, cron by @nestjs/schedule, the musl rollup pins have
to follow the installed rollup, and msw 3 is a migration of the client
tests. Each is held back with its reason and moves by hand. The rules
name the version update types rather than the whole package wherever
that is enough, and a security advisory for any of them still shows in
the Security tab.
2026-11-26 11:15:46 +01:00
Maurice f922068a8e chore(deps): bump express from 4.22.3 to 5.3.0 and @types/express to 5.0.6
Nest already serves every request through Express 5. Only the parsers,
the static handler and their types still came from the direct Express 4
dependency, so this moves those three and keeps their behaviour:

- body-parser 2 leaves req.body undefined when it did not read a body,
  where body-parser 1 left an empty object. A bodyless POST to a route
  whose fields are all optional answered 400, and a plugin route got
  null. emptyBodyDefault restores the empty object for everything but
  /mcp, which stays raw (BOOT-009, PACK-3T-004).
- serve-static 2 no longer exposes its mime table. The Brotli copy of
  an asset is typed through mime-types 3 with the fallback send uses,
  so it keeps the Content-Type of the original file (PRECOMP-001).
- @types/express 5 types a route param as string or string[]; the
  photo route names its single :filename param.

The MCP SDK resolves the same Express 5.3 now; Nest keeps the 5.2.1 it
pins.
2026-11-26 11:09:32 +01:00
Maurice 5c5d85ef60 chore(deps): bump NestJS to 11.2.12, @nestjs/swagger to 11.4.8 and jimp to 1.7.0
The NestJS part of the grouped Dependabot update, without the packages
that cannot move yet: MikroORM stays on 7.2.8 together with the
better-sqlite3 and kysely versions it pins, cron stays on the 4.4.0
that @nestjs/schedule pins exactly, and the musl rollup pins stay on
the rollup version the lockfile installs.

What changed in Nest does not reach TREK's own paths: TrekWsAdapter
builds its server and binds every handler itself, so the new WsAdapter
defaults do not apply, and the new limit of 1000 multipart parts per
request is far above what the upload routes receive.
2026-11-26 11:04:58 +01:00
Maurice d83e98366b chore(deps): bump react-dropzone from 14.4.1 to 20.2.1
react-dropzone 19.2 turned on a paste handler of its own on the drop
zone. The file panel already uploads pasted files once for the whole
panel, after the upload permission check, so a paste while the zone
had focus sent every file twice. The zone's paste handling is switched
off with noPaste; FE-COMP-FILEMANAGER-039 pastes on the zone itself
and expects a single upload.

prop-types and loose-envify leave the lockfile with the old version.
2026-11-26 11:03:21 +01:00
Maurice 756eae39ff chore(deps-dev): bump @types/node from 25.9.8 to 26.6.11
Type definitions only; the image and .nvmrc stay on Node 24. npm drops the stale peer flag from the optional rollup binaries while it rewrites the lockfile; nothing installs with --omit=peer.
2026-11-26 11:02:10 +01:00
Maurice 4f66a344ca fix(auth): retire password reset links when the account's email or password changes
A reset link is a credential sent to the address the account had when it
was asked for. It stayed valid for its full hour after the account moved
to another address or got a new password, so a link sent to the old
mailbox could still set a password on the account.

Changing the email in the user's own settings, changing the password,
and an admin changing a user's email or setting a password now consume
every live reset link of that user, in the same transaction as the
change. Saving the same address, or it in another case, keeps the link,
and a link asked for afterwards works as before.
2026-11-26 10:17:13 +01:00
Maurice 96b2778c2f fix(native): keep the server picker clear of Android's navigation bar
On Android the web view can report env(safe-area-inset-*) as 0 while the
app draws edge to edge, so the buttons at the foot of the app's first
screens sat under the three-button navigation bar and the logo under the
status bar. Capacitor's SystemBars plugin writes the real insets to the
page as --safe-area-inset-*; the first screens now read them as one more
floor next to env() and the insets iOS measures itself. Where Capacitor
lays the web view out between the bars it writes 0, and in a browser the
variables are unset, so nothing changes there.

Closes #3221
2026-11-26 10:10:22 +01:00
Maurice 98c883b4e8 test(assistant): load the tool cap's groups without awaiting in a loop
The cap suite added eleven no-await-in-loop and two non-null assertion
warnings to the server tests, past the lint ratchet. Independent sessions
now run side by side and the sequential loads go through a recursive
helper.
2026-11-25 22:48:57 +01:00
Maurice df82208bd5 fix(assistant): keep every step within the 128 tools OpenAI and Azure accept
A trip chat offered 130 tools in its first step and up to 359 with every
group loaded. OpenAI's APIs and Azure refuse a request with more than 128
function tools (array_above_max_length), so the trip assistant failed at
once on an OpenAI style or Azure Foundry connection, while Anthropic and
the ChatGPT login took the longer list.

The trip's bookings, its packing lists and to-dos, changes to its budget
and its tags now load as groups like the addons do, which brings the core
to 63 tools, so any one group fits beside it. Loading a group that would
pass the limit unloads the one used longest ago, a call to one of its
tools loads it again, and groups asked for together that do not fit are
named so the model loads them later. The groups that are part of the trip
carry no domain on their change cards. Reading the costs stays in the
core.
2026-11-25 22:34:41 +01:00
Maurice 18867d9499 fix(weather): answer the day 16 days out with climate instead of an error
The detailed weather took the forecast path for any day whose distance
from now was at most 16 days, measured as a fraction of a day. Open-Meteo's
forecast reaches today + 15 calendar days, and the day 16 out lies 15.x
days from now, so it was asked of the forecast, refused with a 400, and
the day showed "No weather data". The cutoff now counts calendar days and
sends anything past today + 15 to the climate path. The forecast measures
its range from the place's own date, which trails UTC in the Americas for
part of the day, so a refusal of that range also falls back to climate.

Closes #3216
2026-11-25 22:21:16 +01:00
github-actions[bot] 13910464e5 chore: bump version to 5.2.1 [skip ci] 2026-11-25 13:18:29 +00:00
Maurice 903868c08c feat(release): show the iOS and Android apps in the 5.2.1 notice, the account settings and the user menu
The release notice moves to 5.2.1 and gets a tile across the release column
with the App Store and Google Play cards, each with a QR code that opens the
store page. The headliner, intro, footnote and note texts are shorter so the
tile fits, in every locale.

Settings > Account shows the same store cards in its right column, except
inside the native app itself. The user menu footer adds round links to
Patreon, Ko-fi and Buy Me a Coffee beside Discord, left out on managed
installs and in the native apps like every donation link.
2026-11-25 13:32:18 +01:00
Maurice 434baaf6fd fix(native-auth): send the app's SSO sign-in through the identity provider every time
The app signs in through a browser sheet that shares the system browser's
cookies. When that browser still held a TREK session from an earlier
sign-in, the hand-off page skipped the identity provider and offered to
continue at once, so a provider set to demand re-authentication (Pocket ID's
"requires re-authentication") was never asked, and signing out of the app
and in again with SSO asked for nothing.

The SSO button now always goes through the identity provider. It decides as
before: a provider with a running session lets the user through, one that
demands re-authentication asks for it. A sign-in with a password or passkey
still continues with the browser's session after the explicit tap.

Refs #3014
2026-11-25 10:52:34 +01:00
Maurice d9d901e52d fix(ci): lower the client non-null baseline and arm the wait before PMEDIA-006 advances
Client lint was red because the day plan change took 13 non-null assertions
out of DayPlanSidebar: the count is 354 now, so the baseline goes down to it.

Server tests 6/10 timed out in PMEDIA-006. The test advanced the fake clock
right after asking for the rendition, but the wait it meant to run out is only
armed once the copy has started; on a slow runner the clock moved past a timer
that did not exist yet and the test hung for 15 seconds. It now waits for the
copy to start first, as PMEDIA-006b already does.
2026-11-25 10:37:46 +01:00
Maurice 50cb9364f6 fix(atlas): count the cities the address parser used to miss
The Atlas reads a place's city from its address text, and several common
address shapes lost it:

- The TREK index writes "street, postcode, locality" with no country, and the
  parser always dropped the last part as the country, so a place picked from
  TREK's own search counted no city.
- A city that is its own region (Berlin, Wien, Malé) was skipped as the region
  even where it stands beside its postcode, which is how such an address names
  its city.
- An atoll or a state written with its generic word ("Kaafu Atoll" for the
  region Kaafu) was not recognised as the region and counted as the city of
  every island in it.
- Country names came from a short English and German list, so "Maldives",
  "Österreich" or "Italia" could be counted as a city.

The locality of a postcode-and-locality tail now counts, a region-named part
with a postcode counts when no part before it names a city, a region matches
with its generic word, and countries are recognised by their name in every
language TREK speaks. A region named without a postcode (a mountain in
"Bayern", a resort in "Kaafu") still counts no city, and the lines the parser
already read right read the same.

Closes #3200
2026-11-25 10:29:09 +01:00
Maurice b6c50eb146 fix(wallet): date a booking's pass by its stay or linked day when it has no time of its own
The Wallet pass took its date only from the booking's own time or, for a
journey, its departure stop. A hotel whose check-in and check-out live on its
stay, and a booking linked to a day that carries only a clock, have neither,
so Wallet answered "Give the booking a date first" for a booking the app
shows with its dates. A TestFlight tester hit it with a hotel booked from
8 to 11 January.

The pass context now reads the dates of the days a booking is linked to and,
for a hotel, the first and last day of its stay with its check-in and
check-out times. The pass falls back to them in the order the app uses
(bookingDates): the booking's own time first, then the stay or the linked
day, with the booking's or the stay's clock. A booking with no date anywhere
is still refused.
2026-11-25 10:25:10 +01:00
Maurice c1c77d89b5 fix(day-plan): make the legs from a booking or the hotel tappable on the phone
On the phone timeline only a leg that leaves a stop opened the travel mode
menu. The leg from the morning hotel to the first stop, the leg from the last
stop back to the hotel and the leg from a booking's arrival to the next stop
stayed inert, although the desktop day plan already changes them through the
stop at their other end. A TestFlight tester could not tap the walk from their
train's arrival to the hotel.

The timeline now knows which stop owns each of these legs: the first stop's
incoming mode for the morning hotel leg and for a leg out of a booking, the
last stop's outgoing mode for the evening hotel leg. Tapping them in edit mode
opens the same menu as on the desktop, and the phone sets the incoming mode
the way the desktop does.

A leg no stop owns, such as a booking's arrival to the hotel, has no mode to
store. It follows the day default, and on both the phone and the desktop it
now offers the public transit search where a trip has dates, instead of
reacting to nothing.
2026-11-25 10:21:43 +01:00
Maurice 70af8132ef fix(booking-import): let the model choose when a document names several booking types
The keyword table that picks the extraction schema took the first pattern
that matched, with transport tested first since #2076. A hotel confirmation
that mentioned the airport bus, the train station or the cruise port was
therefore extracted with the bus, train or ferry schema. Those schemas have
no hotel name, address or check-in and check-out, so the model returned a
transport booking without the stay's data and the import dropped it.

The keywords now only decide alone when a document names one type. When it
names several, the model gets the union schema narrowed to exactly those
types, with each type's field meanings, and picks. The flight gate is
unchanged: flight numbers still take the flight path only when no other
transport is named. Event words decide only when nothing else is named,
since "ticket" is printed on every transport ticket, and the lodging
pattern also knows motel, accommodation, apartment, guest house, Unterkunft
and Ferienwohnung.
2026-11-25 10:09:24 +01:00
Maurice 85182d2f52 chore(deps): group MikroORM and NestJS updates, hold NestJS majors
Each family releases in lockstep and now arrives as one PR. NestJS majors wait until nestjs-zod supports NestJS 12.
2026-11-25 00:10:14 +01:00
Maurice c65e9bf76e fix(auth): move passkeys to SimpleWebAuthn 14, which no longer fetches a CRL a client names
@simplewebauthn/server 13.3.3 fetched the CRL address in an android-key
attestation certificate before it checked the chain or the signature, with
no timeout or size cap, so anyone signed in could make the server request
any URL by registering a passkey. 14.1.0 only checks revocation for a chain
it validated against Google's pinned roots.

14.x refuses an expected origin with a path, a trailing slash or an
uppercase host and an RP ID that is not lower case, where 13.x only failed
to match them. The configured origins are now reduced to the origin the
browser reports and the RP ID is lower-cased, so such settings keep
working; an origins list in which nothing parses leaves passkeys
unconfigured instead of falling back to APP_URL. Verification gets the
algorithm list the options offer, and stored transports are read as plain
strings.

Stored credentials keep their format. typescript-eslint moves to 8.73.0.
2026-11-25 00:10:14 +01:00
Maurice 3754518d37 fix(ai): say why ChatGPT refused a sign-in, and start a fresh one after any refusal
Every refusal of the code by OpenAI's token endpoint came back as "The
sign-in took too long", and the endpoint's own error was dropped without a
log line. Only invalid_grant means the code ran out or was used already; any
other refusal (invalid_client, a redirect or resource mismatch) now names
its OAuth error in the answer and in a warning with the endpoint's
description, so an admin can see what went wrong.

The server takes a sign-in once whatever it answers, but the panel only
started a fresh one after "expired", so the next try after any other
refusal used a spent sign-in. It now starts a fresh one after every refusal
the server sent; offline and a wrong address keep the one in progress, as
neither reached it.

The address the sign-in window ends on is also taken without http://, the
way the hint under the field and the address bar show it.

Closes #3196
2026-11-24 23:59:33 +01:00
Maurice eed5f75487 docs(readme): space Data sources like the other sections 2026-11-24 23:56:08 +01:00
Maurice f29112698e docs(readme): show See all features as a plain heading
The graphic card goes again; the toggle now reads as a third-level heading.
2026-11-24 23:54:54 +01:00
Maurice d556d706b7 docs(readme): drop the feature tile grid, make See all features a card
The Plan, track, share tile grid goes. The See all features toggle is now a card in the style of the app cards, light and dark, with the feature areas as small chips and a chevron, so the full list is easier to spot.
2026-11-24 23:53:58 +01:00
Maurice 71673085bb docs(readme): make the app store cards flatter
A smaller QR code, and the store's mark beside the first line instead of in a box of its own, so each card is about a quarter less tall.
2026-11-24 23:51:05 +01:00
Maurice 19a01d493b docs(readme): set the sponsor line in normal text size 2026-11-24 23:49:59 +01:00
Maurice 462f08727c docs(readme): shorten the sponsor and AI notes, drop the PWA section
The sponsor line at the top goes; the dataforest cloud block further down is now its logo under a small POWERED BY and one line. The AI usage section is one sentence with its link. The PWA install steps and their link in the quick navigation go, since the store apps now sit at the top.
2026-11-24 23:49:20 +01:00
Maurice 58298703e1 docs(readme): drop the line under the app cards 2026-11-24 23:48:23 +01:00
Maurice 17e75947f0 docs(readme): drop the Docker badge 2026-11-24 23:47:36 +01:00
Maurice 4f1e29b02c docs(readme): drop the Sonar and CI status badges 2026-11-24 23:46:48 +01:00
Maurice d1ee3ceccb docs(readme): show the app stores as cards with their QR code
Two cards, one per store, in a light and a dark version that follow GitHub's theme: the QR code on white on the left, the store's mark and name on the right. They replace the bordered table and the two shield badges, and each card links to its store.
2026-11-24 23:45:47 +01:00
Maurice 69a976e942 docs(readme): put the iOS and Android apps near the top, shorten the sponsor section
A QR code and a store button for the App Store and Google Play sit right
under the introduction, with a line that the app connects to your own TREK
server and a link to the Native Apps page. The QR codes are SVGs on a white
ground, so they scan in GitHub's light and dark theme alike.

The dataforest cloud section keeps its logo and every sponsor link but says
the same in one paragraph instead of four.
2026-11-24 23:41:22 +01:00
Maurice f928f4b1ca fix(postgres): connect over a Unix socket
TREK_DB_URL could not name a Unix socket. MikroORM builds the pool from the
URL's own host and drops a host parameter, so
postgresql://trek@localhost/trek?host=/var/run/postgresql connected to
localhost over TCP. A percent-encoded socket path as the host reached the
pool, but the client tools got it undecoded in PGHOST, so backups, restores
and the safety copy before a migration failed.

The server address is now read once, the way libpq reads a connection URL:
a host or port parameter takes the place of the URL's own, and a host
written into the URL is percent-decoded. The pool and the client tools both
get that address. The wiki and .env.example show the socket form.
2026-11-24 23:15:34 +01:00
Maurice aa79d6286a fix(paddle): read the Geofabrik region list again
The admin's paddle region picker failed with "The list of regions cannot be
fetched right now". Geofabrik's index now writes a continent's parent as
null instead of leaving the key out, and the schema took only a string or
nothing, so the whole list was refused over nine entries.

The optional fields now take null as well, and the entries are read one by
one: an entry in a shape TREK does not know costs only that region and is
counted in a warning. A list of which nothing can be read is still refused.

Closes #3195
2026-11-24 22:32:17 +01:00
Maurice eeff0398a7 fix(mail-import): retry a busy AI provider and never drop a booking mail in silence
A forwarded booking mail whose AI read failed in passing (a 503 "high
demand", a rate limit, a timeout) was settled at once with an inbox entry
nobody read again, and a manual import printed "no reservations found"
under the AI error as if the file held none.

Both LLM clients now send a failed request again up to twice, honouring
Retry-After within the request timeout. The mail pipeline puts such a mail
back in the queue and keeps the inbox entry only after its last try, and
these attempts no longer count toward the daily AI limit.

The mail prompt now names the answer's shape, { "bookings": [...] }, for
providers that get no tool. An answer in another shape used to read as
"not a booking" and the mail was discarded without a trace; it now ends
as a failed read the person sees in the inbox.

The import warnings lose their dashes, and the image sets LANG=C.UTF-8 so
KItinerary stops warning about the C locale on every run.
2026-11-24 13:30:22 +01:00
Maurice 7fe4fbb683 fix(plugins): mark a plugin that waits for re-consent as failed at boot
A plugin whose files now declare permissions it was never granted is
refused before its process starts, so the supervisor's status hook never
ran and the row kept the 'active' it had from the last run. The plugin
list and the navigation kept offering it while its page answered
"Plugin not available". The boot now stores the refusal as the plugin's
error, so Admin > Plugins says why and the navigation drops it.
2026-11-24 13:20:36 +01:00
Maurice afbeef64c2 style(notices): format the release notice strings with Prettier
The 5.2.0 release modal copy kept short strings on their own line, which
lint:format rejects for files outside its baseline.
2026-11-24 12:23:59 +01:00
Maurice 293ec89db4 fix(map): pin mapbox-gl to 3.32.0 so vector tiles load beside maplibre-gl
mapbox-gl 3.33 and later read the worker class registry key before they
handle Set and Error. maplibre-gl, which ships in the same bundle, stamps
that key on both built-ins, so mapbox-gl looks up a registry entry it never
made and every vector tile fails with "Cannot read properties of undefined
(reading 'omit')". The Mapbox basemap stays blank while raster layers such
as satellite still load. 5.2.0 shipped mapbox-gl 3.35.2; 3.36.0-rc.1 still
has the same order.

Pin the last release that handles the built-ins first, keep Dependabot off
3.33 and later, and add a test that reads the shipped serializer and fails
on a version with the registry read first.
2026-11-24 00:04:19 +01:00
github-actions[bot] 8809654a43 chore: bump version to 5.2.0 [skip ci] 2026-11-23 21:40:14 +00:00
Maurice f1d8995d66 chore(deps): hold typescript-eslint at 8.72, lower the knip baseline
typescript-eslint 8.74 reports more no-unused-vars and lifts the client
warning count past its baseline; it gets its own round. knip 6.48 finds
two fewer unused exports and types, so their entries go down with it.
2026-11-23 21:57:06 +01:00
Maurice aab09afc53 fix(notices): pass the Patreon handler in the modal test, logical sides in the card drawings, no non-null assertions 2026-11-23 21:25:39 +01:00
Maurice 34e28d082d chore(deps): bump the npm minor and patch group, MikroORM held
Takes Dependabot's group update except MikroORM, which stays on 7.2.8:
7.2.9 broke the Postgres probe on OauthTokens.insertToken and
OauthConsents.upsertGrant, and 7.2.11 gets its own round. The rollup
musl pins stay with the rollup version the lockfile resolves. The
Playwright container moves to v1.65.1-noble with its digest, as the
lockfile now pins @playwright/test 1.65.1.
2026-11-23 21:19:18 +01:00
Maurice e6d682b99e chore(plugin-sdk): bump the plugin-sdk minor and patch group 2026-11-23 21:19:17 +01:00
Maurice cb1d400251 ci: bump docker/scout-action from 1.29.0 to 1.30.0 2026-11-23 21:19:17 +01:00
Maurice bcdcd69a64 feat(notices): 5.2.0 release modal and Patreon for monthly support
The release modal now shows 5.2.0: booking mails that land in the trip,
live flight status and the new trip PDF, each with its own drawn card,
and links the 5.2.0 release notes. The maintainer note and the support
block are rewritten, shorter and without the sponsor wording.

Patreon joins Buy Me a Coffee and Ko-fi as the monthly way to support
TREK: a full-width button in the release and thank-you notices (a new
optional tertiaryCta on the notice contract), a tile in About and in the
admin GitHub panel on desktop and phone, the README badges and
FUNDING.yml. Like the other donation links it stays hidden inside the
native apps.
2026-11-23 21:15:54 +01:00
Maurice d18a4b2180 fix(flight-live): keep a late inbound aircraft holding near the origin from reading as departed
After the scheduled time an aircraft near the origin that neither climbs nor descends is taken for the leg only when it was on the ground at the origin before or flies away from it.
2026-11-23 20:02:10 +01:00
Maurice 4519430610 fix(plugins): bind the single-array args form on Postgres as on SQLite
A plugin that passed its values as one array had the whole array bound to $1 on Postgres. The array is now spread when it fills the statement's placeholders, unless a placeholder takes an array itself.
2026-11-23 19:59:41 +01:00
Maurice b3845dbdfc fix(memories): wait for a public media copy just under the proxy timeout
No public page retries a 503 by itself, so a first view of a large video that took over 10 s showed a dead player. The request now waits up to 50 s before answering come back later.
2026-11-23 19:57:47 +01:00
Maurice e6a5ba095d docs(postgres): a backup restores into the same or a newer major only
The restore now refuses a dump from a newer PostgreSQL major, so the guide and the compose file no longer promise restores across every major.
2026-11-23 19:57:21 +01:00
Maurice 7a643d5f75 feat(plugin-sdk): let the mock host switch Documents off like the real host
With documentsAddonEnabled: false, files.* works only on attached files and files.create needs a link target, so a plugin's tests see what the host does on a trip with Documents off. The plugin guide says the same.
2026-11-23 19:57:20 +01:00
Maurice 4498f68cc9 fix(mcp): end live sessions again when documents is switched off
The doc-sync tools still gate on documents through instanceAddonGate, which the parity scan did not see, so documents is back on the list and the scan now reads that gate too.
2026-11-23 19:56:08 +01:00
Maurice 429a2fb017 fix(help): leave the guides a managed install cannot follow out of its help
A managed install offers no connection to a server the reader runs (photo libraries, AirTrail, Dawarich, wanderer) and no assistant or AI setup of its own, so the help no longer shows their guides there.
2026-11-23 19:55:53 +01:00
Maurice 07eeae8486 fix(dashboard): name Etc/GMT world clocks by their real offset
An Etc/GMT zone counts westward as positive, so Etc/GMT-4 is four hours ahead of UTC. The clock's title and the zone picker printed the id's own sign, and someone who picked GMT+4 got a clock four hours behind UTC; both now read the real offset, on the desktop and the phone.

Closes #3175
2026-11-23 19:42:40 +01:00
Maurice c8adf6e1da ci(client): give the client typecheck the heap the strict check already has
The whole program outgrew Node's default heap and the typecheck ran out of memory.
2026-11-23 19:40:15 +01:00
Maurice 44c7026e74 feat(i18n): translate the updated help center into every locale 2026-11-23 19:30:08 +01:00
Maurice b185375762 feat(help): bring every help center guide up to date and add guides for the new features
Every guide was checked against the current app, its text and script corrected where the UI had moved on, and its pictures rendered again in the library's style. New guides cover the trip assistant and setting up AI, tags on places, KML for Google My Maps, totals-only costs, split by shares, costs in another currency, receipts from trip files, per-trip addons, editing the trip in Trip settings, booking mails and their notices, live flight status, the collections map lock, album date ranges, the journey satellite layer, the folding place card, a tour's route in a map app and more.
2026-11-23 19:30:07 +01:00
Maurice ea8202948d chore(help-media): let many media runs share one built client
E2E_WEB_PREVIEW serves client/dist with vite preview instead of a dev server per run; a dozen dev servers compiling the app at once timed out the setup login. The README also notes that mocked services need page.context().route once the service worker controls the page.
2026-11-23 19:30:05 +01:00
Maurice 7065e18454 fix(memories): answer 503 while a large public copy is still being made
A request now waits at most ten seconds for the location-free copy and is otherwise told to come back with Retry-After while the copy goes on being made, so a long video no longer holds the first request past a reverse proxy's timeout. Nothing but the copy is ever sent.
2026-11-23 17:33:00 +01:00
Maurice c4326ec545 fix(backup): refuse a Postgres dump from a newer server major before restoring it
The restore reads the server version the dump was taken from in its table of contents and refuses, naming both majors, before anything is cleared, from the admin restore (400) and from RESTORE_FROM_BACKUP alike.
2026-11-23 17:33:00 +01:00
Maurice b03597957c fix(db): let the primary key index serve MikroORM find orders on Postgres
A find ordered by its entity's own primary key now renders the NULL position the btree holds, so ORDER BY id DESC LIMIT n reads the index instead of sorting every matching row. A key is never NULL, so the rows come back in the same order.
2026-11-23 17:33:00 +01:00
Maurice 97da0c5ba6 fix(plugins): send file events for attached files while Documents is off
A file that belongs to a booking, place, expense, note or message stays readable with Documents off, so its events now reach subscribed plugins too; loose files still wait for Documents, and a trip's events keep their order.
2026-11-23 17:30:23 +01:00
Maurice e1147504c2 fix(files): refuse a plugin upload that attaches nothing while Documents is off
files.list hides loose files on such a trip, so files.create now needs a reservation_id or place_id there instead of writing a file the plugin cannot list back.
2026-11-23 17:20:52 +01:00
Maurice b2ba89fe4f fix(immich): keep a public video's location check across its range requests
The verdict is held for five minutes per owner and asset, so a seek no longer asks Immich twice before it streams, and an Immich that times out or fails answers 502 instead of 404. A located video Immich did not transcode still never plays.
2026-11-23 17:18:25 +01:00
Maurice eb32eb1690 fix(flight-live): take a departure near the origin without a vertical rate
After the scheduled time an airborne aircraft within 60 km of the origin is the leg unless it is clearly descending, so a level climb-out or a feed without rates still records departed_at and the delay.
2026-11-23 17:15:56 +01:00
Maurice 5588b7efbb fix(dawarich): read unnamed stays again in turns across runs
Each run now goes on after the last unnamed stay it read, so stays beyond the first twenty get their reread even when the first ones never resolve.
2026-11-23 17:13:57 +01:00
Maurice 20c86f3a44 refactor(auth): hand the trip tags over through the trip members repository
Kept out of MaintenanceRepository, whose raw SQL strings are pinned.
2026-11-23 16:44:45 +01:00
Maurice 3cef8eae5e chore(native): keep the page script list private to the offline shell 2026-11-23 16:41:11 +01:00
Maurice 6e0c2b894d refactor(auth): hand a deleted user's trip tags over through the maintenance repository
The account deletion no longer reaches into the tags domain, which closed an import cycle between the two.
2026-11-23 16:34:51 +01:00
Maurice 0fe536bbd2 fix(mcp): type the input refusal as the Error it is, so the strict build reads it 2026-11-23 16:29:35 +01:00
Maurice 96fa7ca4e8 refactor(server): keep the fixes within the size and strict ratchets
The admin settings audit summary moves to auth.helpers, the booking stay check to DayAccommodationsRepository.idOnTrip, the strict typings declare the MCP SDK types module, and the useAdmin test leaves the format baseline.
2026-11-23 16:23:21 +01:00
Maurice 8a9f5367b1 chore(lint): keep the fixes within the lint ratchets
No promise in a condition, sequential awaits through a reduce instead of a loop, no non-null assertions or any in the new tests, an awaited act, one options object for a stop edit and a handled rejection for the offline copy.
2026-11-23 16:09:59 +01:00
Maurice f6d52727f7 test(mcp): follow the mail tools and file tools that left their addon gates
Documents leaves the list of addons whose switch ends MCP sessions, since no tool waits for it any more.
2026-11-23 16:04:29 +01:00
Maurice 38381bc03a refactor(costs): let the summary card tell an unknown balance itself
Keeps the Costs panel within its size budget.
2026-11-23 16:02:38 +01:00
Maurice af88aef35e fix(server): resolve the MCP SDK types module at runtime
The tool registry imports McpError from @modelcontextprotocol/sdk/types, which Node only finds through the tsconfig path list the other SDK modules use.
2026-11-23 16:02:37 +01:00
Maurice 0aa53b81e1 docs(wiki): say when a public journey link plays an Immich video 2026-11-23 15:54:13 +01:00
Maurice 4b6911b51f fix(plugins): bind a Buffer in the single-array bind form of ctx.db as its bytes 2026-11-23 15:53:58 +01:00
Maurice 907fc95b00 fix(plugins): let a file write past Documents off only for the targets it writes
files.update and files.createLink took any target key in the call as an attachment, also one they never store.
2026-11-23 15:53:58 +01:00
Maurice 1c6bdb4129 fix(immich): keep a shared journey from streaming an Immich video original with its location
A public link now plays an Immich video only when the asset has no recorded location or Immich serves its own transcode, which it writes without metadata; the original file of a located video is refused with a 404.
2026-11-23 15:45:28 +01:00
Maurice 503b82a149 docs(wiki): say key rotation re-encrypts Wanderer tokens and where the key file goes
The rotation script has covered wanderer_connections.token since it learned to, and writes the key file beside a DB_PATH database or else into the data directory; the page now says so.
2026-11-23 15:45:28 +01:00
Maurice 8349c5066b fix(dawarich): name stays never read before reading unnamed ones again
Unnamed stays are now read again at the end of a run, from the budget the others left and at most 20 per window, so new stays get their names and a Dawarich without a geocoder is not asked about every stay on each run.
2026-11-23 15:45:28 +01:00
Maurice 5e8cc0b90a fix(mail-ingest): read a transfer booking with a numeric code instead of filing it as a forwarding confirmation
Outside Gmail and Outlook senders, only a subject naming mail forwarding counts, so a bare 'transfert' in a shuttle or airport transfer confirmation no longer hides the booking.
2026-11-23 15:45:27 +01:00
Maurice 950942f7b9 fix(backup): refuse a Postgres restore of another schema or past the size limit with a 400
The admin restore now writes and checks the restore script while it verifies the archive, so a dump without TREK's tables in the target schema or one expanding past BACKUP_MAX_DECOMPRESSED_MB is refused before a pre-restore copy is kept, and the restore runs the checked script.
2026-11-23 15:45:27 +01:00
Maurice ac5c91bcaf fix(plugins): bind a Buffer a plugin passes to its own database as bytes
A Buffer crosses the plugin IPC as its JSON form, so db.query, db.exec and db.tx now turn that form back into the bytes before binding, as the plugin docs promise.
2026-11-23 15:45:27 +01:00
Maurice 10f0cb7d04 fix(flight-live): keep a late earlier sector from reading as this flight departing
Until a leg has departed, an aircraft in the air that is no nearer the destination than the origin is now stays the earlier sector's after the scheduled departure too, unless it is climbing out near the origin.
2026-11-23 15:45:27 +01:00
Maurice 08f3a8fe0b fix(flight-live): tell each booking of a flight its own delay once it is late
Bookings sharing a tracked flight can hold different departure times, so the delay notice now goes to each booking when its own delay crosses the line instead of being spent on the first one.
2026-11-23 15:45:27 +01:00
Maurice 091ad0f23d fix(collab): keep the keyboard open after sending a chat message
The send button in the trip chat cancels its mousedown like the note format bar, so the native app no longer closes the keyboard after every message.
2026-11-23 15:45:26 +01:00
Maurice 2b21407cf9 fix(admin): open the tab a link names while the admin page is already open
The active tab now follows ?tab= when only the query changes, so a help guide's go to screen link reaches the Services tab from the Security tab.
2026-11-23 15:45:26 +01:00
Maurice 464d5aa902 fix(native-share): read every trip's Collaboration when the share sheet opens and keep it settled
A Collaboration switch on a trip not open on this device now counts for a shared link, and a later reload of a trip's list no longer hides the trips or saves a refused link again.
2026-11-23 15:45:26 +01:00
Maurice b9637ff90c fix(trip-addons): let a second reader wait for the trip's list being read
A read started while another one runs now answers with that read's list instead of the one held before, so the offline sync no longer skips the Tours and Road trip caches next to a planner load.
2026-11-23 15:45:26 +01:00
Maurice 918efe35fe fix(costs): show the owe and owed cards as unknown instead of settled while the balances are
A failed read, a read still running or flows in another currency no longer print zero with the settled line on desktop and phone. Flows the server answered in the trip currency are converted at the rate the read sent along.
2026-11-23 15:45:26 +01:00
Maurice a0c41bce0a fix(notifications): list the wanderer hints for users whose trip switched Tours on
The user's matrix decides that row by the same per-user Tours rule the wanderer watch sends by, so a user who gets the hints can see and switch them.
2026-11-23 15:45:25 +01:00
Maurice 1a6639eb74 fix(trips): end a plugin-added member's MCP sessions where the trip opened an addon
trips.addMember now calls reattachJoinedMember like the REST, MCP and invite joins, so the new member's session lists the trip's addon tools.
2026-11-23 15:45:25 +01:00
Maurice 807c6a16b4 fix(plugins): handle a failed addon read while an earlier trip event still waits
The addon read of a queued plugin event now settles to off on its own, so a rejection that comes before the earlier event's turn can no longer go unhandled and stop the server.
2026-11-23 15:45:25 +01:00
Maurice 5d7d6072f7 fix(mail-ingest): refresh MCP sessions when an admin switches the mail import
The mail import tools are listed only while the import is on, so a save that changes mail_ingest_enabled now ends the live MCP sessions, as the addon switches do.
2026-11-23 15:45:25 +01:00
Maurice 4cd3f3d650 fix(files): serve a plugin the files a trip keeps while Documents is off
The plugin file surface follows the REST rule: the list and reads keep booking, place, expense, note and message files, a write on a loose file goes through when it attaches it, and uploads and deletes stay open.
2026-11-23 15:45:25 +01:00
Maurice a0d66eb898 fix(files): attach a loose file while the trip has Documents off
update and link go through when the request itself attaches the file to a booking, place, stop or expense, on REST and MCP alike, and upload_trip_file takes budget_item_id like the REST upload.
2026-11-23 15:45:24 +01:00
Maurice 8a2045c619 fix(mail-ingest): attach a booking's documents while the trip has Documents off
A booking's files belong to the booking, so the mail's documents now reach it whatever the Documents switch says; a mail filed without a booking still needs Documents.
2026-11-23 15:17:02 +01:00
Maurice 34d5fba437 fix(plugins): deliver a trip's core events to plugins in emission order
The addon check in front of the event sink made each family event wait for
its own read, so on Postgres a later snapshot could overtake an earlier one,
and a trip event could arrive before the budget event emitted ahead of it.
The reads still run side by side, but a trip's events now leave in order.
2026-11-23 15:15:37 +01:00
Maurice 8b9de04960 fix(wanderer): offer the connection and run the watch where a trip switched Tours on
With Tours off for the instance, a trip that switched it on opened the wanderer
import, but Settings hid the connection and the watch cron never ran. The addon
feed now tells each user whether wanderer applies to them, and the watch looks
for every user who has Tours on somewhere; the others only take their turn.
2026-11-23 15:15:36 +01:00
Maurice c289541c43 fix(notifications): list the paddle region request for admins while any trip has Tours on
The admin matrix decided a trip addon by the admin's own trips, so with Tours
off for the instance and on for a member's trip the paddle region request still
reached admins but had no row to switch it. Admin-scoped rows now follow the
addon being on for the instance or any trip.
2026-11-23 15:15:36 +01:00
Maurice 146f46c5e3 fix(addons): give a member who joins a trip with an opened addon a new MCP session
A trip that switched on an addon the instance has off ended the MCP sessions
of the members it had then, but somebody added later, or joining through the
invite link, kept a session without that addon's tools. Joining now ends it too.
2026-11-23 15:15:36 +01:00
Maurice 8709f67ff4 fix(trip-members): leave expenses out of a guest deletion while Costs is off
Deleting a guest re-sent every expense that named them as budget:updated,
even on a trip with Costs switched off, so each member's offline cache took
rows the bundle keeps out. The re-split expenses now go out only while the
trip has Costs on.
2026-11-23 15:15:36 +01:00
Maurice 363889b97a docs(plugin-sdk): state the transaction-control and NUL rules of ctx.db
A plugin's own database refuses BEGIN/COMMIT in every call and NUL in SQL,
bound values and migration ids on every engine; the guide and the ctx.db types
now say so and point at ctx.db.tx() and Buffer binding instead.
2026-11-23 15:15:36 +01:00
Maurice 48e54d5a62 fix(files): keep booking, place and expense files reachable with Documents off
The Documents addon now gates only the file manager: the list leaves out loose
files, and the trash, starring and loose files answer 404, while uploads, deletes
and every file a booking, place, expense, note or message carries stay reachable
over REST, the download route, MCP and the offline bundle.
2026-11-23 15:15:36 +01:00
Maurice d83841f53b ci(postgres): restore with the 18 client tools the image ships
The backup round trip now runs with pg_restore 18 against both lane servers, so a setting an older server does not know fails the lane.
2026-11-23 15:12:16 +01:00
Maurice 485fb93f78 fix(helm): render when an upgrade reuses values from before the database block
The templates read the database settings through a default dict, so helm upgrade --reuse-values from a release without them no longer stops on a nil pointer; CI renders the chart with the block removed.
2026-11-23 15:11:40 +01:00
Maurice ca367d9cfc docs(postgres): name the Docker Compose version the Postgres compose file needs
The file creates TREK's role from an inline config, which Compose reads only from 2.23.1 on; the file header and the wiki now say so, with the error an older Compose prints.
2026-11-23 15:11:40 +01:00
Maurice 9ae99b42ec fix(ci): give the release mirror a recovery hint that works
With no push run for the dev head, the mirror now says to push a new commit to dev; a run started by hand is not a push run and never satisfied it.
2026-11-23 15:11:40 +01:00
Maurice 8fb720ea49 fix(mcp): validate a tool or prompt field again once NUL stripping changed it
The SDK validates the arguments before the input mapper drops NUL characters, so a field the mapper changes is now checked against its own schema again and a name of nothing but NUL is refused over MCP as it is over REST.
2026-11-23 15:11:39 +01:00
Maurice 1fb1b102e8 fix(dawarich): name an unnamed stay once Dawarich has geocoded its points
A stay stored as 'Unnamed stay' because none of its points was geocoded yet is now read again on the next sync, so a slow background geocoder or a stay from before the upgrade gets its town once Dawarich knows it.
2026-11-23 15:11:39 +01:00
Maurice a604f84899 fix(memories): send share link viewers the Immich preview instead of the original file
A public view of an Immich image now asks for the preview rendition, which Immich re-encodes without the stored metadata, so photo locations no longer go out with share links; owners still get the fullsize original.
2026-11-23 15:11:39 +01:00
Maurice e7e3592d97 fix(flight-live): tell a delay only to the bookings it is late for
Bookings that share one flight state can hold different scheduled times, so the delay notice now goes only to the legs whose own departure is at least fifteen minutes late instead of telling the others it is delayed by 0 minutes.
2026-11-23 15:11:39 +01:00
Maurice 8e51410251 fix(flight-live): do not read an earlier sector's aircraft as this flight having departed
Before the scheduled departure, an aircraft in the air that is no nearer the destination than the origin is now stays unpicked, so booking only the later sector of a through flight no longer sends the departure notice hours early.
2026-11-23 15:11:39 +01:00
Maurice 22c3381044 fix(tags): keep a trip's tags when the member who created them deletes their account
The trip tags a deleted user created now pass to each trip's owner before the user row goes, so the tag and its place assignments no longer cascade away for everyone else on the trip.
2026-11-23 15:11:38 +01:00
Maurice 25ded7319a fix(ios): hand a widget launch link to the UI only once
A tap that launched the app went to the UI as a held quick action and to
Capacitor as the launch URL, which a server UI before appLinks followed
as well, pushing the page twice. Capacitor now gets the launch without it.
2026-11-23 15:11:38 +01:00
Maurice b6006c8265 fix(ios): hide the status bar beside a corner element only on an iPhone
The status bar goes for the iPhone Duo's status capsule; an iPad's window
controls give the same corner signal and no longer hide its bar. The corner
insets still reach the page on every device.
2026-11-23 15:11:38 +01:00
Maurice bd215b7ec7 fix(ios): open the offline copy when an update rechecks an unreachable server
The recheck after an update ran on every bridge, also on the one the
offline start restarts, and moved the server it had just put back out
again, so the app looped between the address screen and a restart.
2026-11-23 15:11:38 +01:00
Maurice 98a05fa1fd fix(ios): read widget and watch dates in the Gregorian calendar
The app writes its days as Gregorian yyyy-MM-dd, but the widgets and the
watch built their keys in the device's calendar, so a Buddhist or Japanese
calendar matched no trip day and dropped every dated booking.
2026-11-23 15:11:38 +01:00
Maurice 0e918820c3 fix(widgets): keep every stop of the day the snapshot was written on
The days ahead keep only their first 16 stops, and the widget read today
from that list too, so on a busy day it showed the wrong next stop. The
full day the app wrote now stays in place on its own date.
2026-11-23 15:11:38 +01:00
Maurice a701d89fb9 fix(android): keep the start page's boot scripts in the offline copy
theme-boot.js and shell-guard.js come from the public folder, which the
build manifest does not list, so an offline start waited on the unreachable
server for them before the first paint. They are now stored and refreshed
on every launch.
2026-11-23 15:11:37 +01:00
Maurice 4fead3259d fix(android): keep a sign-in proxy's page out of the offline copy
The copy now only stores answers that come from the server itself and no
HTML in place of a script or stylesheet, so a proxy's login page no longer
replaces the stored UI.
2026-11-23 15:11:37 +01:00
Maurice 4fd8f3987f fix(planner): treat the trip opened before as still loading when another one opens
The store kept the previous trip until loadTrip ran after the first render, so the desktop planner mounted with that trip under the new id for a frame.
2026-11-23 15:11:37 +01:00
Maurice 855ec37935 fix(mail-ingest): read the inbox again when it changes while a read is on its way
A reload asked for during a read was dropped and the older answer overwrote the newer count, and an entry decided meanwhile came back with it.
2026-11-23 15:11:37 +01:00
Maurice 310e5fba8f fix(mail-ingest): forget the mail import of an account on sign-out
The store kept the forwarding address, the inbox and the badge count across a logout, so the next account on the same tab saw them until its own read landed, or for good when that read failed.
2026-11-23 15:11:37 +01:00
Maurice 8f5324c901 fix(pdf): draw the cover route of a long road trip without spreading every point into one call
The bounds came from Math.min and Math.max over all routed points, which throws past the engine's argument limit and failed the whole export on Safari and the iOS app.
2026-11-23 15:11:36 +01:00
Maurice 97c0d992c8 fix(pdf): order a day's bookings in the overview by the clock in 12h too
The booking list sorted on the printed time, so for a 12h reader 1:00 PM and 10:00 AM came before 9:30 AM.
2026-11-23 15:11:36 +01:00
Maurice cd32f07bf5 fix(roadtrip): offer and save a visit's stay under the day plan right on the desktop
The rail and the inspector offered the stay to anyone who may edit places, while a saved visit's stay needs day_edit, so the dialog closed without saving and the stop popup wrote half its change before a 403. Refusals now say so before anything is written.
2026-11-23 15:11:36 +01:00
Maurice 3c00544e93 fix(native): keep the keyboard open for controls that hold the focus in their field
A tap away blurred the field on touchend, before the sign toggle or the note format bar could cancel their mousedown, so the keypad closed mid entry. The field now lets go only once the tap's pointerdown and mousedown pass uncancelled.
2026-11-23 15:11:36 +01:00
Maurice dec3058777 fix(help): show the settings help on the admin Security and Services tabs
Both tabs fell back to the admin overview without guides, and the guides for API keys, providers and file types opened the Security tab instead of Services.
2026-11-23 15:11:36 +01:00
Maurice e459ec6e60 fix(mail-ingest): ask before closing the booking mail setup with changes not saved
The setup only keeps its fields through its own Save, yet Close, the close mark, the backdrop and the phone sheet dropped them without a word. Now each way out asks, and discarding puts the saved values back.
2026-11-23 15:11:36 +01:00
Maurice ba45dbc874 fix(admin): draw no divider under an addon whose sub-rows render nothing
A switched-off booking mail import passed false as its only child, which Children.count counts, so an empty list with a top border showed under the row.
2026-11-23 15:11:35 +01:00
Maurice fa8e1b68bd fix(mail-ingest): set an inbox entry aside once its booking is saved through Fill in yourself
The entry stayed pending after the prefilled booking was saved, kept its Add action and counted in the badge, so it could be added a second time.
2026-11-23 15:11:35 +01:00
Maurice 755ca865a4 fix(mail-ingest): open the prefilled form again for an entry asked for twice in the same trip
The guard kept the last handled entry after the link left the address, so a second Fill in yourself for it in the open trip did nothing.
2026-11-23 15:11:35 +01:00
Maurice a3caa9ca1a fix(costs): count only balances read in the shown currency in the owe and owed cards
After a currency switch the cards kept summing the flows of the previous currency, offline or while the new read ran, and printed them in the new one.
2026-11-23 15:11:35 +01:00
Maurice 344580d343 fix(share): decide what a shared link is for once the trips' Collab is read
The share sheet waits for the trip list and each trip's own Collaboration before
it acts on the share sheet's trip, and reads only the addon lists it does not hold.
2026-11-23 15:11:35 +01:00
Maurice 36ea9bdb3e fix(trip-addons): keep a pushed addon list over an older sync read
The sync reads a trip's addons through the store's load, so a tripAddons:changed
push that lands during the read stays on screen and in the offline copy.
2026-11-23 15:11:34 +01:00
Maurice c3d60e1c43 fix(sync): read the open trip's addons again after the socket reconnects
A tripAddons:changed push is not replayed, so a switch made while the socket was
down now reaches the member on the reconnect refetch.
2026-11-23 15:11:34 +01:00
Maurice 769293a554 fix(trip-addons): read the trip's lists again when their addon is switched back on
The sections of an addon that was off were read as empty, so switching Lists,
Costs or Documents back on while the trip is open now reads the trip again.
2026-11-23 15:11:34 +01:00
Maurice 56ce66f666 fix(offline): park a queued delete that a switched-off addon refuses
The 404 a route answers while its addon is off keeps the entity on the server, so
the queued delete is parked as failed and offered for retry instead of dropped.
2026-11-23 15:11:34 +01:00
Maurice fd10ce2876 fix(plugins): show a trip page that replaces a core tab while that tab's addon is off
A trip-page plugin that replaces Lists, Costs, Documents or Collab is a stand-in
for the core tab, so its own tab stays on the trip whatever that addon is set to.
2026-11-23 15:11:34 +01:00
Maurice 9d4e52ddfc perf(db): let Postgres serve ORDER BY id from the primary key
A Kysely ORDER BY on the id of a table the statement reads in its FROM no longer gets SQLite's NULL position, which no primary key row needs and which kept Postgres from reading paged latest-first lists such as the audit log off the index.
2026-11-23 15:11:34 +01:00
Maurice 52a6fbbc92 fix(scripts): read the server's .env in the admin reset and the key rotation
Both scripts now load server/.env as the server does, so an install whose TREK_DB_URL lives there resets the admin and rotates the key in its Postgres database instead of in a SQLite file left behind by the move.
2026-11-23 15:11:33 +01:00
Maurice de1c3b8ea6 fix(scripts): rotate the SQLite file TREK_DB_FILE names
The key rotation now opens the database the server runs on when TREK_DB_FILE is set, writes the new key to the key file the server reads, and refuses DB_PATH and TREK_DB_FILE naming different files.
2026-11-23 15:11:33 +01:00
Maurice 60885627b1 fix(scripts): rotate the wanderer token with the encryption key
The key rotation now re-encrypts wanderer_connections.token, so a wanderer connection keeps working after the key changes instead of calling out without its token.
2026-11-23 15:11:33 +01:00
Maurice 9c454a04e1 fix(db): keep plugin index names when moving plugin data to Postgres
The move now creates each index a plugin named under that name, so a later plugin migration that drops or alters it by name finds it on a moved install as on a fresh one.
2026-11-23 15:11:33 +01:00
Maurice 6a6c403860 fix(db): keep booking to stay links of old installs when moving to Postgres
An install from before April 2026 stores reservations.accommodation_id as an INTEGER, so the move now writes such a stay id as the '<id>.0' text TREK compares it as, instead of '14', which no longer matched the stay on Postgres.
2026-11-23 15:11:33 +01:00
Maurice e51902a03b fix(reservations): drop a stay id from another trip when a booking is created
Create now checks that the linked stay belongs to the trip, as update already does, instead of storing a link to a stay that does not exist there.
2026-11-23 15:11:33 +01:00
Maurice 3a2645a3e4 fix(db): match a booking to its stay on Postgres without failing on odd ids
The Postgres stay match now casts the leading digits of the stored text as bigint, the way SQLite reads it, so a non-numeric or oversized accommodation_id no longer fails the calendar, share and stay reads for every trip.
2026-11-23 15:11:32 +01:00
Maurice bf8677a28c fix(backup): name the client tool when pg_restore cannot read a Postgres dump
A missing pg_restore, or one older than the pg_dump that wrote the archive, was reported as an invalid dump. The refusal now says which tool to install or point TREK_DB_PG_BIN_DIR at.
2026-11-23 15:11:32 +01:00
Maurice 89da19e535 fix(backup): refuse a Postgres restore the role or tools cannot run before anything is copied
The admin restore now answers a privileged role, old client tools or an unreachable server with a 400 naming the reason, before it keeps a pre-restore dump. RESTORE_FROM_BACKUP checks the same before it unpacks the archive, and removes the unpacked copy when the load fails.
2026-11-23 15:11:32 +01:00
Maurice e630e92183 fix(backup): clear a Postgres schema holding views or functions over TREK's tables
A table dropped with CASCADE takes its views and functions along, and the clear then rendered their stale oids as bare numbers and failed the restore. Rows whose object is already gone are now skipped.
2026-11-23 15:11:32 +01:00
Maurice bb2b4a1f5a fix(backup): restore Postgres backups into PostgreSQL 14, 15 and 16
pg_restore 17 and later write SET transaction_timeout at the top of every script, which older servers refuse under ON_ERROR_STOP. The restore now leaves settings the target server does not know out of the script while it streams.
2026-11-23 15:11:32 +01:00
Maurice 626e19c534 fix(mail-ingest): keep bookings the data names that the AI left out
When the AI returned fewer bookings than the machine-readable data, the others were dropped without an entry.
2026-11-23 15:11:31 +01:00
Maurice 8f5988ee33 fix(mail-ingest): match each AI leg to the data leg it agrees with
Under one booking reference every leg after the first was compared with the first and went to the inbox as a disagreement.
2026-11-23 15:11:31 +01:00
Maurice 4cef885e12 fix(mail-ingest): never queue a mail again for a failure after its commit
An error in the announcements, documents or notices after a mail was written sent it back to the queue, which duplicated its entries or marked it failed.
2026-11-23 15:11:31 +01:00
Maurice 303d161ecf fix(mail-ingest): keep a booking that fails the item shape in the inbox
Such a booking made the whole mail fail and retry instead of waiting to be filled in by hand. A reference read as a number is now read as its text.
2026-11-23 15:11:31 +01:00
Maurice eaa557343e fix(mail-ingest): compare look-alike bookings at their wall time on any server zone
The window around a booking's start went through the host time zone, so on a server outside UTC it missed a booking at the same local time and added it twice.
2026-11-23 15:11:31 +01:00
Maurice dea903f011 fix(booking-import): treat a booking a forwarded mail added as already imported
The file and assistant import only looked for bookings the file import wrote, so the same booking arrived twice when it had come in by mail first.
2026-11-23 15:11:30 +01:00
Maurice 91edf0c565 fix(mail-ingest): announce a place a mail created with its whole row
The open planners of the trip received only the new place's id and kept a nameless place without coordinates until a reload. The broadcast now carries the row the place routes send.
2026-11-23 15:11:30 +01:00
Maurice 403b7d2f93 fix(mail-ingest): make the own address once when two views ask for it together
The first look at the settings made the address outside a transaction and always revoked the live one, so two requests at once could leave a view showing a revoked address. It is now checked and made in one transaction and never replaces an address it finds.
2026-11-23 15:11:30 +01:00
Maurice 5d4cfec3b6 fix(mail-ingest): list the mail import tools only while the import is on
Every mail tool answered 'Mail import is not available' on installs that never switched the import on, which is the default, so they are now gated like the addon tools.
2026-11-23 15:11:30 +01:00
Maurice b9608bf684 fix(mail-ingest): keep the webhook open for real deliveries while bodies trickle in
The webhook now limits the memory the bodies being read hold instead of the number of open requests, and gives up on a body still arriving after a minute, so a few slow requests no longer turn every delivery away.
2026-11-23 15:11:29 +01:00
Maurice 3b65da7626 fix(mail-ingest): read transfer bookings instead of filing them as forwarding confirmations
A forwarding subject now counts only from Gmail or Microsoft or together with a code in the body, so 'Votre transfert est confirmé' is read as a booking. The subject and From header are also matched in linear time.
2026-11-23 15:11:29 +01:00
Maurice 327539df14 fix(mail-ingest): read forwarded attributions and HTML tags in linear time
A long line of reply verbs, or HTML with line break, script or style tags that never close, made the mail walk backtrack once per word and block the server. Attribution lines past 500 characters are no longer tested.
2026-11-23 15:11:29 +01:00
Maurice 965b519f23 test(notes): wait for the caret frame before typing in the numbered list test 2026-11-23 12:11:46 +01:00
Maurice 3ec7cc73b2 fix(notes): number list items in order from the format toolbar
The numbered list button always inserted '1. ' and only on the caret's line, so writing a list item by item left 1. 1. 1. in the field. It now continues from the item above and formats every line of a multi-line selection (bullets and quotes too).
2026-11-23 12:05:03 +01:00
Maurice 493571c559 fix(android): log the address and sender of a page that fails with an HTTP error
When the server's page came back with an error status, the app went to the
address screen with "HTTP 503" and logged nothing, not even which page it
was. A report could then not tell the server, a proxy in front of it and
something on the phone apart: the reporter's Cloudflare and Traefik logs
show no 503, and the page was not requested at all.

Every main-frame HTTP error is now logged under TrekShell with the page's
address (without its query, where a sign-in page carries a challenge), the
status, the reason phrase and the headers that name whoever answered
(Server, Via, CF-Ray, Content-Type). An answer with none of them says so,
which points at something on the phone. What the app does with the error
is unchanged.

Refs #3014
2026-11-22 22:58:02 +01:00
Maurice 4212fcdfc8 style(i18n): format the new PDF strings with an apostrophe
lint:format in shared: Prettier writes a string holding an apostrophe in
double quotes; the Catalan, French and Dutch PDF strings now follow it.
2026-11-22 22:39:01 +01:00
Maurice 28f750f7c4 fix(pdf): give formatMoney a locale, lower the strict entry of the export
lint:strict: a place's price passed the export's locale, which can be
undefined, to formatMoney; it falls back to en like the export's other
money figures. The rewritten TripPDF.tsx holds 1 strict error instead of 38,
and its entry is lowered to that.
2026-11-22 22:28:09 +01:00
Maurice 8c9cf4a80c fix(pdf): handle a failed cover bake where it happens, lower the eslint baseline
Client types: the overview test used Array.prototype.at, which the client's
lib setting does not include; it reads the last cell with slice instead.

Client lint: the export swallowed a failed cover bake with .catch(() => null).
bakePdfCover now catches a canvas that will not draw or encode itself and says
why, so the export calls it plainly. The rewrite also leaves fewer warnings,
and the baseline is lowered to the counts the run measured: complexity 216,
no-explicit-any 138, no-unused-vars 117, and in the tests
no-non-null-assertion 1872.
2026-11-22 22:19:51 +01:00
Maurice b33d592325 perf(pdf): draw the first pages once, not on every scroll
The cover and the route overview stuttered in the preview and in the saved
file, in every viewer:

- The cover photo was embedded at its upload size, 4000 px and more, under
  a translucent gradient across the whole page, which every viewer had to
  composite again on each redraw. The export now crops the photo to the
  page at print size (A4 at 150 dpi) and paints the shade into it, one flat
  JPEG. A photo from another origin keeps the photo and the gradient.
- The route overview drew every point of the routed roads, about 35,000 on
  a two-week trip and most of them on the same pixel, twice each (casing
  and line). Points that round onto the one before are dropped and the rest
  thinned within a third of a pixel (Douglas-Peucker): about 900 points,
  the same shape on paper.
- The cover's glass is a tinted fill without a backdrop blur, and the
  casing under the cover route is opaque.

Also spells out the span and status keys so the key check can follow them,
keeps types nothing imports private, and drops the export's theme and rtl
baseline entries, which reach zero.
2026-11-22 22:10:52 +01:00
Maurice 590b174dd1 feat(pdf): draw the trip's route on the cover, keep its figures on one line
The cover gains the trip's own shape: every routed day drawn in its map
colour on a glass card beside the title, a band of the days' colours with
the first and last date under it, and the dates on a pill above the title.
The figures sit in one row and never break inside a number.

Print engines leave out a backdrop blur, so the glass gets a tinted fill
that reads on paper; the blur stays for the preview. The dates of the day
overview are aligned to the start.
2026-11-22 21:52:27 +01:00
Maurice 2a833c4ba9 fix(pdf): keep a note's second line in its card, fill the preview width
A day note's time field is the free line the day plan prints under its
text, not a clock: it printed in the narrow time column and broke into a
word per line. It stays in the card again, and the time column is empty.

The preview showed the A4 sheet at its print width inside the wider
dialog, with a pale band on either side; on screen the document now fills
the frame, as it did before. The stops column of the day overview is
centred under its pin.

Tests for the day's cards, the cover and overview, and the new preview
switches.
2026-11-22 21:43:34 +01:00
Maurice a5de1bc52d feat(pdf): redesign the trip PDF
The trip PDF gets a new layout in the app's current look, with nothing it
printed before left out and more of each place on the page.

- Cover: the trip photo full bleed, title and dates over it, the trip's
  figures on frosted tiles.
- Overview: the route map, every day at a glance (colour, date, plan, the
  night's stay, stops, cost) and all bookings and stays with their codes.
- Days: the header in the day's map colour, a photo strip of the day's
  stops, where the night is spent, then the plan as a timeline with the
  times on the left.
- Places: photo or category tile, category, duration, price, rating, tags,
  address, coordinates, description, notes, opening hours of that day,
  phone, website, e-mail and the members going. The rating, e-mail, hours
  and reservation note come from the trip's place, since the assignment
  only carries a projection of it.
- Bookings: route first, then airline, number, seat or platform as badges,
  each leg with its own code, status and the booking's code.
- A second row of switches in the preview: overview, photos, coordinates,
  and contact and hours, next to page per day, large text and transport
  notes. Each one is a class on the document and remembered.

The document is split into modules for its helpers, icons, stylesheet,
cover and overview, and the day, so the export itself only gathers the data.
2026-11-22 21:34:29 +01:00
Maurice 1b20214a7f fix(planner): show the drive to a rental car's return and away from its pickup
On the day a rental car is picked up the route ended at the desk, and on the
day it is returned it started at the return, the way it does for an overnight
train. The drive with the car itself showed nowhere: a stop planned before the
return got no travel time to it, in the day plan on the phone and the desktop
and on the map, and neither did the first stop after the pickup.

A car or bicycle rental is now a stop the day's drive passes through on those
two days. Bookings that are ridden keep their one-sided endpoint, and two
bookings back to back still get no drive between them (#1394).
2026-11-22 19:48:34 +01:00
Maurice 3e8496dce6 feat(ios): hide the status bar where a corner capsule was measured
On a window where the app measured an element in a top corner, an iPhone
Duo's status capsule, it now hides the status bar, which is meant to take
the capsule away; whatever still covers the corner stays in the safe area
the page keeps clear of. Each window size keeps its answer once seen, so
hiding the bar never brings it back, and the folded and unfolded displays
decide on their own. Devices without such an element are not affected.
2026-11-22 19:36:31 +01:00
Maurice ea1b75e639 fix(mobile): keep every screen clear of the iPhone Duo's status capsule
The capsule in a top corner was handled screen by screen: the m-corner-*
classes and --m-corner-clear put bars beside it and lifted content below
it, so every layer that did not opt in sat under it, and testers found it
on almost every page.

It now counts as safe area in mobile.css. Upright the top inset reaches
below the capsule and the sides keep their full width; on a wide window
its side is given up over the whole height instead. The per-screen
handling and corner.css are gone. Control rows a screen places itself and
layers that fill the window keep to the side insets through m-safe-row and
m-safe-trail, and the trip's pane keeps its content off the capsule's side
on a wide window. On every other device the insets come out as before.
2026-11-22 19:36:31 +01:00
Maurice c0f6551cf4 test(server): send the API key requests without awaiting in a loop
Server lint counted one no-await-in-loop warning over the tests baseline, from the loop in the new API key test.
2026-11-22 18:24:15 +01:00
Maurice 1fdf74e7f2 fix(auth): mark an address the account moved before an admin saved it
Both backfills of email_self_asserted skip any account with an
admin.user_update row naming email. The edit dialog sends the email on every
save, so a role change made long after an account moved its own address kept
it at 0, and a verified SSO sign-in with that address still linked into it.

A new migration reads the address each admin save found (targetUser): an
account is marked when every save already found its current address, or when
the last save that found another one sent no email. A save that may have typed
the current address in still leaves the account alone, since the audit rows
cannot tell it from a change the account made itself before 5.0.0. Only rows
still at 0 are touched and nothing is cleared.
2026-11-22 18:15:51 +01:00
Maurice c7de823c78 fix(auth): renew a session cookie only after it verifies on its own
SessionRenewalInterceptor took req.user as proof that the trek_session cookie
had been verified. On a route with its own guard chain that does not hold:
ApiTokenGuard authenticates a public API key and sets req.user, and the cookie
sent beside it is never checked. Past half its lifetime such a cookie was
decoded without its signature and renewed, so a holder of a read-only key
could come away with a signed session of the key's owner.

The interceptor now runs the cookie through the guards' own check (signature,
expiry, password version, active session) before it renews, requires it to
name the request's user, and renews nothing on a request a public API key
authenticated.
2026-11-22 18:15:51 +01:00
Maurice 49b9ffc77d fix(client): keep the seat change clear of the sheet's held ref and of non-null assertions
Client lint was red: passing the ref-held reservation to bookingSeats added a react-hooks/refs warning in MTransportSheet, so the sheet now reads the seats from the legs it already has (seatsOfLegs). The new PDF test used a non-null assertion.
2026-11-21 15:45:04 +01:00
Maurice 7006891ce0 style(server): format the legs-only seat test
Server lint was red: lint:format found the new update_transport cases in tools-transports.test.ts unformatted.
2026-11-21 15:37:00 +01:00
Maurice 4d01439c75 test(server): type the created transport in the legs-only seat test
Server lint was red: the new MCP test cast its result to any, one no-explicit-any warning over the tests baseline.
2026-11-21 15:29:53 +01:00
Maurice adb6a2c80d fix(planner): show each leg's own seat on a flight with a stop
A flight with a stop saves a seat per leg, but every view read the
booking's flat seat, which mirrors the first leg's. A seat booked only on
the second leg showed nowhere, and one on the first leg showed on both.
#2701 had fixed this for trains only.

- getFlightLegs reads each leg's seat. The first leg falls back to the flat
  seat, as the booking form does, so older bookings keep theirs.
- bookingSeats lists the seat of every leg that has one with its route.
  The detail views (the phone's transport sheet, the booking detail) show
  each leg's seat under its route ("Seat IST → JFK"), and a leg opened
  from its row shows its own. The cards and field grids (bookings list,
  the phone's Bookings and Transports tabs, the day plan's transport
  detail) hold every seat in one Seat cell, so a card cutting its grid
  short no longer drops the second leg's.
- The day plan's flight leg rows carry their seat, and the PDF prints a
  flight's seat, direct or per leg.
- The watch and the Wallet pass name every leg's seat of the booking.
- A legs-only MCP update sets the flat seat, airline and flight number
  (train number and platform) again from the new first leg, so a seat
  taken off the first leg does not live on in the flat seat. A flat value
  the stored first leg never had stays.

Closes #3158
2026-11-21 15:24:52 +01:00
Maurice 1824cc77ec fix(ci): bring the per-trip addon tests and ratchets in step
The second run of #3157 was red in six jobs:
- Server types: ReminderJobsService takes AddonsService now; RJOB-007 built
  it with five arguments.
- Server tests 2/10: the doc-sync job tests stubbed AddonsService without
  isEnabledForTrip, which the sync asks per trip now.
- Client tests 4/10: toursPermissions mocked useAuthStore as a bare
  selector; tripAddonsStore keys its lists by account through getState.
- Server lint (knip): TripAddonRow was exported without a reader outside
  its file.
- Client lint and Client types: no-unused-vars and the strict errors in
  useTripPlanner.ts went down by one, so their entries are lowered.
2026-11-21 14:00:02 +01:00
Maurice 9e2805fc89 chore(lint): lower the server no-unused-vars baseline to 34
Server lint was red: the per-trip addon change left one unused variable fewer in src, and the ratchet fails on an entry above the count.
2026-11-21 13:28:06 +01:00
Maurice 77380ea5cf docs(wiki): describe the trip settings' Addons area and its MCP tools 2026-11-21 13:23:09 +01:00
Maurice 9956c58dd5 feat(client): follow and switch a trip's own addons
- The trip's addon list is read through tripAddonsRepo into
  tripAddonsStore (per account and trip, kept in Dexie version 16 for
  offline), refreshed when the connection returns and live on
  tripAddons:changed.
- The planner's tabs, dock, rail and deep links, the cost, tour and list
  readers, the PDF export, the share link options, the widgets and the
  watch follow the trip instead of the instance switch.
- Trip settings gets an Addons area for the owner, on the desktop dialog
  and the phone sheet, on one useTripAddonRows hook: each trip addon with
  its switch, marked "This trip only" while it differs from the instance.
  Switching back to the instance's value drops the trip's choice.
  Switching needs a connection.
2026-11-21 13:23:09 +01:00
Maurice 3f38621024 feat(server): let a trip owner switch trip addons for one trip
A trip can now turn a trip addon (lists, costs, documents, collab, road
trip, tours) on or off for itself, whatever the instance switch says. No
row in the new trip_addon_overrides table means the trip follows the
instance; a row is the owner's choice. Going back to the instance setting
deletes the row, and no addon data is touched either way.

- GET/PUT /api/trips/:tripId/addons[/:addonId] (every member reads, the
  owner writes) and the MCP tools get_trip_addons and set_trip_addon, on
  the shared tripAddons contract; tripAddons:changed tells the members.
- Every trip-scoped addon surface asks the trip: REST through
  TripAddonGuard, MCP through a per-call gate on the named or pinned trip,
  plugin RPC and events, the share link, the offline bundle, reminders,
  doc sync, the assistant (tools, keep_attached_file), booking costs, the
  trip summary prompt, and the cross-trip tour reads (library, Atlas
  stats, collection save).
- Routes without a trip open while the addon is on in any of the user's
  trips. Switching an addon on that the instance has off ends the members'
  MCP sessions so they reconnect with its tools.
- A copied trip takes its owner's choices along.

Behaviour changes: an anonymous call to an addon route that is off now
gets 401 instead of 404, and with an instance switch off the packing,
todo and files plugin RPC methods, the files MCP tools, todo reminder
mails, core plugin events, plugin view contributions, the share link's
lists, costs and chat sections and the offline bundle's lists follow it.
2026-11-21 13:23:09 +01:00
Maurice 2f7b8357ce fix(server): schema-qualify the table the move asks Postgres for its sequence
Server Postgres 18 3/3 was red on dev: PGMOVENUL-007 failed with relation "information_schema_catalog_name" does not exist. readTargetSchema called pg_get_serial_sequence(format('%I', table_name), ...) over information_schema.columns, and Postgres does not promise to apply the table_schema filter first, so the call could see rows of information_schema itself, whose bare names do not resolve on the search path. The name now carries its schema, so the call answers for every row whatever the plan. The fake Postgres of the move tests matches the new text.
2026-11-21 11:30:06 +01:00
Maurice 6861687b1f fix(server): queue the backfill's updates instead of awaiting them in a loop
Server lint was red on dev: lint:warnings counted 557 no-await-in-loop warnings in src against a baseline of 556, from the UPDATE the new admin-made account backfill awaited per account. The updates are now queued with addSql, the way the Ireland counties migration queues its row writes, with the id checked to be an integer. The migration does the same as before; it has not shipped in a release.
2026-11-21 11:22:47 +01:00
Maurice 8fc9fe7945 fix(auth): mark an address an admin-made account changed itself, so SSO no longer links to it
The 5.0.0 backfill (Migration20200101042800) set email_self_asserted only for accounts whose address moved away from their user.register audit row. An account created in Admin > Users has only an admin.user_create row, so it kept 0 even when the account had changed its own address in its settings before the upgrade, and a verified SSO sign-in asserting that address was still linked into it.

A new migration applies the same rule with the address in the admin.user_create row as the baseline: an admin-made account whose address is none it was created or registered with, and whose email no admin edited, is marked. Only rows still at 0 are touched and nothing is cleared. The shipped migration stays as it is.
2026-11-21 11:12:34 +01:00
Maurice f668eee227 test(client): drop the two new non-null assertions in the addon card tests
Client lint was red: lint:warnings counted 1877 no-non-null-assertion warnings in tests against a baseline of 1875, both from closest('section')! in FE-ADMIN-ADDON-045 and 046. Cast to HTMLElement like the other card lookups in the file.
2026-11-21 10:59:35 +01:00
Maurice 711015d5fd feat(admin): live flight status, booking mail import and paddle water data as rows of the addon cards
The addons page listed the trip, global and integration addons and then three
loose cards under them: live flight status, the booking mail import and the
paddle water data. They now sit where they belong, as rows of the cards:

- Live flight status is a row of the trip card, with its switch, locked when
  FLIGHT_LIVE_ENABLED holds it.
- The booking mail import is a row of the integration card with its switch;
  while it is on, "Set up mail import" opens the transport, address, AI
  allowance, test and status in a dialog, the way AI is set up.
- The paddle water data are a row under the Tours addon that opens the
  regions in a dialog, counting the open requests, else the regions.

The phone follows with the same rows and bottom sheets. The setup row and the
setup dialog are shared components (AddonSetupRow, AddonSetupDialog on the
desktop, MAdminOptionRow and MAdminSetupRow on the phone), the card counts
stay the addons' own, and the settings tab loses its features part.
2026-11-21 00:23:13 +01:00
Maurice 6ebd5cf0c7 fix(mobile): a road trip stage draws only its own rides, not the drive's flight home
The phone's road trip tab shows one stage at a time, but its map drew the
arcs of every ride that seams the whole drive, plus every booking switched on
for any day. A flight home on the 12th then crossed the map of the stage on
the 9th, with its airport label, as if it were part of that day.

The stage now draws the rides that seam its own drive, whatever day they were
booked on, and of the bookings switched on by hand only those that run on the
stage's day. The all-days view and the desktop, which shows the whole drive,
are unchanged.
2026-11-20 23:00:52 +01:00
Maurice 8ab7547edf fix(calendar): a booking linked to a plan stop gets its zone and is exported once
The calendar feed and the .ics export wrote a restaurant booking linked to a
plan stop twice, and the booking's copy without a time zone:

- The zone of a booking came only from its own place. A booking whose place
  is its linked stop (reservations.assignment_id) had none, so its DTSTART and
  DTEND went out as floating times and calendar apps placed them in the
  device's zone, an hour early for a London lunch read in Paris. The zone now
  comes from the booking's place, then its linked stop's place, then the zone
  all stops of its day or of the trip agree on. Transports keep their
  endpoint zones and still float when those are unknown, since either end can
  be in another zone.
- The stop and its booking were both emitted (trek-assign-<id> and
  trek-res-<id>). As for hotels, a stop whose booking yields a timed event on
  the same day is no longer emitted on its own; the booking event takes over
  the stop's place as LOCATION, its notes and, when it has none, its end. A
  booking without a clock, on another day, or still staged leaves the stop as
  it was, so no event is lost.

The VTIMEZONE builder moved unchanged into calendar-timezones.helpers.ts to
keep the service under the size cap.

Closes #3150
2026-11-20 22:19:11 +01:00
Maurice f599892a4b test(server): delete the tracked uploads together, not one await per loop turn 2026-11-20 21:49:40 +01:00
Maurice 1436cec35c test(server): suites remove only the uploads they stored, not whole shared folders
files, security, collections, journey and trips cleaned up by removing a whole
uploads category folder (uploads/files, covers, places, journey). Every suite
that boots the app writes into the same uploads tree, and on the Postgres lane
several run at once, so that removal took the files of the suite running
beside it: ATTE2E-008 then failed with "storage object not found" for its
attached file.

A small helper wraps StorageService.put on the app's instance, records what
the suite stores and deletes exactly that afterwards. The journey upload tests
that counted the files in uploads/journey (and so also counted what another
suite wrote there) now check that every object they stored is gone again.
2026-11-20 21:45:05 +01:00
Maurice fe90502955 fix(mobile): show stay names whole in the day card's chip strip
The stay chips in the day card's header shrank to fit beside the day pill and
the weather, so a name could end after one or two letters (H..., Br...). They
now keep their size and show the whole name; the strip scrolls sideways
instead, with its ends fading while more waits behind them.
2026-11-20 19:29:57 +01:00
Maurice 0431741ad7 fix(widgets): size the timeline's time column to the longest time shown
The day timeline in the trip widgets gave every time a fixed 38 pt column,
enough for 09:30 but not for a 12-hour clock: 5:45 AM was cut to 5:4... at
every widget size. The column now takes the width of the longest visible time
(and the now marker's label), at least the old 38 pt, so the dots still stand
in one line.
2026-11-20 19:29:56 +01:00
Maurice fa99940945 test(platform): a share-token photo whose copy fails to build is a 404 2026-11-20 19:15:48 +01:00
Maurice 09316025c3 test(share): sweep tests in the thumbnail job, tx and strict baselines follow the resolver split 2026-11-20 18:33:42 +01:00
Maurice 100313cfa9 fix(share): compare the pending rendition build with undefined 2026-11-20 18:23:20 +01:00
Maurice 411ec4af59 fix(share): keep private data and photo locations out of public trip and journey links
Public trip and journey share links handed out more than the owner chose to
share:

- A travel-only trip link still returned every day's title, and every link with
  the map returned the free-text day notes the shared page never shows. Days now
  go out through a public projection without notes, and travel-only links carry
  no day titles. Day notes, packing, budget and chat use explicit field lists
  too, and the category list holds only the categories the shared places use,
  without creator ids.
- The public journey payload spread whole entry and photo rows, including
  storage keys (file_path, thumbnail_path) and internal fields. It is now built
  from allow-lists and pinned by a strict response contract.
- /uploads/journey served every entry photo, original and video to anyone who
  knew the file name, so a URL kept working after a share link was revoked or
  the gallery switched off. It now serves journey covers and other non-entry
  objects only; entry media go through the token-checked proxy.
- Anonymous byte paths served stored originals unchanged, so EXIF GPS left the
  server even with map sharing off. Every public path (journey share proxy,
  covers, trip share photos, public uploads) now sends a copy with location
  data blanked in place (EXIF GPS, XMP and IPTC location, MP4/MOV location
  atoms), falling back to a metadata-free re-encode or a 404, never the raw
  file. Owners and members still get their originals.
- An entry's visibility field never decided the share link but was offered by
  MCP and the assistant as if it did. It is now documented as having no effect
  and no longer shown as a privacy label; is_draft keeps an entry off the link.
2026-11-20 18:18:50 +01:00
Maurice ec7f5e0585 test(atlas): cache the test places' regions in one go rather than an awaited loop 2026-11-19 22:11:29 +01:00
Maurice 8e38749bc3 fix(transit): show every stop name and each ride's arrival in the folded-out itinerary
The same gap as on the phone (#3139) in the desktop day plan's folded-out
transit row and the assistant's transit card: each ride cut its stop names
to one line and showed only its departure, and a walk cut its target. The
names and the walk target now wrap, and each ride shows its arrival under
its departure. The phone's booking sheet lets the route line under its
title wrap too.
2026-11-19 21:57:28 +01:00
Maurice 2c17edd74c docs(docker): the entrypoint drops to node with setpriv, say so beside its copy 2026-11-19 21:57:28 +01:00
Maurice c5e2afc21b fix(atlas): count places and cities the same way on the Atlas page and in the stats API
The Atlas page showed 100 cities and 169 places where GET /api/v1/stats
and the dashboard's passport card showed 66 and 164 for the same account.
The two sides counted with their own code. The Atlas page took the address
part right before the country as the city, which is often the region
(Bavaria for Munich, Nuremberg and Regensburg alike), and counted a bare
place name with no comma as a city. The stats side read its places with a
DISTINCT over address, coordinates and region only, so two places that
looked alike (the same hotel on two trips, places with neither address nor
coordinates) counted once, and its city reader skipped every address part
with a digit, so "10178 Berlin" never counted as Berlin.

Both now take places and cities from one method: every place counts once,
a city is read with cityFromAddress, which skips the region (#1115) and now
reads a city written beside its postcode (German, French, US, Japanese,
Dutch, British and Canadian forms) while a street with its house number
still does not count, and two spellings that differ only in case are one
city. The Atlas page, the passport card, /api/v1/stats and the MCP atlas
tool follow it. The response shapes are unchanged.

Closes #3137
2026-11-19 21:57:28 +01:00
Maurice 502e6916d9 fix(docker): start under rootful Podman on hosts that block gosu's signals
Started as root, the entrypoint dropped to the node user with gosu. gosu is
a Go program, and Go changes a process's ids by sending every runtime thread
a realtime signal and spinning until each one has answered, with no limit.
On a host whose security module drops that signal inside the container
(AppArmor on recent Ubuntu, under rootful Podman) gosu spun at full CPU
forever, before Node printed a line: no logs, no database, port 3000 never
served. Running as uid 1000 worked only because that path skips gosu.

The entrypoint now drops privileges with setpriv from util-linux, which is
already in the image: single-threaded C that makes the same id changes
without any signal. Node still runs as uid and gid 1000 with no
capabilities and HOME=/home/node. gosu stays in the image for anyone who
calls it by hand.

Closes #3135
2026-11-19 21:57:28 +01:00
Maurice 61674cf918 fix(transit): show every stop name and each ride's arrival in the journey details
The expanded transit card on the phone cut a ride's "from -> to" line to
one line, so a long first stop pushed the destination out of sight, and
it showed only the departure of each ride. The phone's booking sheet and
the desktop leg list (booking dialog, booking card, journey modal) cut
the stop names and the sheet title the same way.

The detail views now let stop names, walk targets and the booking title
wrap instead of truncating, and the expanded card shows each ride's
arrival time under its departure. The collapsed card still shortens its
headline, since expanding it shows everything.

Closes #3139
2026-11-19 21:57:28 +01:00
Maurice ac01925be7 fix(mobile): show a place's full name in its details sheet
The details sheet cut the place name to one line, and nothing in the
sheet showed the rest; only the edit form did. The sheet is where a
place is read in full, so the name now wraps onto as many lines as it
needs, as the desktop inspector already does. The address under it
wrapped before and still does.

Closes #3140
2026-11-19 21:57:28 +01:00
4153 changed files with 151705 additions and 30823 deletions
+1
View File
@@ -1,2 +1,3 @@
patreon: mauriceboe
ko_fi: mauriceboe
buy_me_a_coffee: mauriceboe
+33
View File
@@ -26,15 +26,48 @@ updates:
prefix: chore(deps)
prefix-development: chore(deps-dev)
groups:
# Packages that release in lockstep move together, so a PR never pins
# half of them on one version and half on the next.
# better-sqlite3 and kysely are pinned exactly by @mikro-orm/sqlite and
# share its connection, so they move with MikroORM.
mikro-orm:
patterns: ['@mikro-orm/*', better-sqlite3, kysely]
update-types: [minor, patch]
nestjs:
patterns: ['@nestjs/*']
update-types: [minor, patch]
npm-minor-and-patch:
update-types: [minor, patch]
ignore:
# nestjs-zod, which validates every request body, does not support
# NestJS 12 yet. The framework moves by hand once it does.
- dependency-name: '@nestjs/*'
update-types: [version-update:semver-major]
# TypeScript 7 is the native compiler and has no JavaScript API yet:
# typescript-eslint, the coverage instrumenter and the Postgres probe all
# call into it (readConfigFile, ScriptTarget). It moves by hand once the
# tooling supports it.
- dependency-name: typescript
update-types: [version-update:semver-major]
# mapbox-gl 3.33 and later read the worker registry key before handling
# Set and Error, and maplibre-gl, bundled beside it, stamps that key on
# both built-ins: every vector tile then fails with "reading 'omit'".
# glWorkerRegistry.test.ts fails on a version with that order; it moves
# by hand once mapbox-gl checks the built-ins first again.
- dependency-name: mapbox-gl
versions: ['>=3.33.0']
# The packages below move by hand, each for its reason. A security
# advisory for one of them still shows up in the Security tab, where it
# is handled together with that reason.
#
# Pinned exactly by @nestjs/schedule; a newer cron of our own would be a
# second copy whose CronJob the scheduler does not accept.
- dependency-name: cron
update-types: [version-update:semver-major, version-update:semver-minor, version-update:semver-patch]
# Root pins that must name the rollup version the lockfile installs (the
# Alpine image needs the musl binaries).
- dependency-name: '@rollup/rollup-linux-*-musl'
update-types: [version-update:semver-major, version-update:semver-minor, version-update:semver-patch]
# plugin-sdk is standalone with a lockfile of its own and ships to npm.
- package-ecosystem: npm
+55 -1
View File
@@ -105,9 +105,63 @@ jobs:
track: ${{ inputs.track || 'internal' }}
status: draft
# The same build for installs outside Google Play: the universal APK Google
# Play makes of this bundle, signed with the Play app signing key, published
# to liketrek/trek-android for Obtainium (wiki/Native-Apps.md). Only for a
# release tag, and held back while the app needs a server version that is
# not released yet.
- name: Whether the latest server release serves this build
id: released
env:
GH_TOKEN: ${{ github.token }}
run: |
tag=$(gh api "repos/$GITHUB_REPOSITORY/releases/latest" --jq .tag_name)
git fetch --depth=1 origin "refs/tags/$tag:refs/tags/$tag"
git show "$tag:server/src/nest/health/features.controller.ts" > "$RUNNER_TEMP/released-features.ts"
node scripts/ci/android-apk-release.mjs guard "$RUNNER_TEMP/released-features.ts" >> "$GITHUB_OUTPUT"
- name: Universal APK from Google Play
if: steps.released.outputs.publish == 'true'
env:
PLAY_APK_SERVICE_ACCOUNT_JSON: ${{ secrets.PLAY_APK_SERVICE_ACCOUNT_JSON }}
APK: trek-${{ steps.version.outputs.version }}.apk
run: |
printf '%s' "$PLAY_APK_SERVICE_ACCOUNT_JSON" > "$RUNNER_TEMP/play-apk.json"
node scripts/ci/android-apk-release.mjs download "$RUNNER_TEMP/play-apk.json" com.liketrek.trek \
"${{ steps.version.outputs.build }}" "$RUNNER_TEMP/$APK"
rm -f "$RUNNER_TEMP/play-apk.json"
cd "$RUNNER_TEMP" && sha256sum "$APK" > "$APK.sha256"
- uses: actions/create-github-app-token@v3
if: steps.released.outputs.publish == 'true'
id: apk-token
with:
app-id: ${{ secrets.RELEASE_APP_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
owner: liketrek
repositories: trek-android
# One release per app version: a newer build of the same version replaces
# its APK, so the release always holds what Google Play holds for it.
- name: Publish to liketrek/trek-android
if: steps.released.outputs.publish == 'true'
env:
GH_TOKEN: ${{ steps.apk-token.outputs.token }}
VERSION: ${{ steps.version.outputs.version }}
BUILD: ${{ steps.version.outputs.build }}
run: |
apk="$RUNNER_TEMP/trek-$VERSION.apk"
notes="TREK $VERSION for Android (build $BUILD): the build Google Play distributes, with the same signature. Connect it to your own TREK server; push and TREK Cloud need Google Play services. Changes: https://github.com/liketrek/TREK/releases"
if gh release view "v$VERSION" -R liketrek/trek-android > /dev/null 2>&1; then
gh release upload "v$VERSION" -R liketrek/trek-android --clobber "$apk" "$apk.sha256"
gh release edit "v$VERSION" -R liketrek/trek-android --notes "$notes"
else
gh release create "v$VERSION" -R liketrek/trek-android --title "TREK $VERSION" --notes "$notes" "$apk" "$apk.sha256"
fi
- name: Remove the upload key
if: always()
run: rm -f "$RUNNER_TEMP/upload.jks"
run: rm -f "$RUNNER_TEMP/upload.jks" "$RUNNER_TEMP/play-apk.json"
ios:
if: github.repository == 'liketrek/TREK'
+1 -1
View File
@@ -79,7 +79,7 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/scout-action@e7e2a72bf1485d10a58f30696b6c513b261ce4fa # v1.29.0
- uses: docker/scout-action@b265cd48f8a1451d2680815b3e8dc4ed65ee16e7 # v1.30.0
with:
command: cves
image: trek:scan
+33 -11
View File
@@ -35,7 +35,7 @@ permissions:
# Server tests i/10 one slice of the server suite, with coverage
# Server coverage merges the slices, checks the per-domain
# thresholds, uploads lcov
# Server Postgres 14 i/3, Server Postgres 18 i/3
# Server Postgres 14 i/3, Server Postgres 19 i/3
# per supported major, in three slices: the probe
# (the repository SQL against Postgres, first slice
# only), then a slice of the lane (every suite that
@@ -55,7 +55,7 @@ permissions:
# Client e2e i/2 one slice of the browser flows in Chromium and
# WebKit, in the Playwright container
# Docker and Helm builds the image and boots it until ready, on
# SQLite and on Postgres 18; lints and renders the
# SQLite and on Postgres 19; lints and renders the
# Helm chart and checks the compose files
# Sonar SonarCloud analysis, not required
# ci-ok the one required check (below)
@@ -600,7 +600,7 @@ jobs:
uses: actions/upload-artifact@v6
with:
name: server-blob-${{ matrix.shard }}
path: server/.vitest-reports/
path: server/.vitest/blob/
include-hidden-files: true
if-no-files-found: error
retention-days: 1
@@ -621,7 +621,7 @@ jobs:
uses: actions/download-artifact@v7
with:
pattern: server-blob-*
path: server/.vitest-reports/
path: server/.vitest/blob/
merge-multiple: true
- name: Merge the slices and check the thresholds
@@ -639,7 +639,7 @@ jobs:
retention-days: 1
# TREK on Postgres, once per supported major: the oldest (14) and the newest
# (18). Both steps run against the same service, the probe on an empty
# (19). Both steps run against the same service, the probe on an empty
# database of its own, the lane on databases it creates and drops.
#
# The probe (server/scripts/pg-probe.ts): against an empty Postgres it
@@ -696,7 +696,7 @@ jobs:
strategy:
fail-fast: false
matrix:
postgres: [14, 18]
postgres: [14, 19]
shard: [1, 2, 3]
services:
postgres:
@@ -757,6 +757,15 @@ jobs:
if-no-files-found: ignore
retention-days: 14
# The image ships the 19 client tools, which write settings a 14 server
# does not know; the backup round trip runs with the same tools here.
- name: Install the PostgreSQL 19 client tools
run: |
set -euo pipefail
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y >/dev/null
sudo apt-get install -y --no-install-recommends postgresql-client-19 >/dev/null
/usr/lib/postgresql/19/bin/pg_restore --version
- name: Run the Postgres lane
if: ${{ !cancelled() }}
env:
@@ -844,7 +853,11 @@ jobs:
scope: client
build-shared: 'true'
# The whole client program, the canonical locale's full key set included,
# also outgrew Node's default ~4 GB heap.
- name: Typecheck
env:
NODE_OPTIONS: --max-old-space-size=8192
run: cd client && npm run typecheck
- name: Strict type check
@@ -1015,7 +1028,7 @@ jobs:
uses: actions/upload-artifact@v6
with:
name: client-blob-${{ matrix.shard }}
path: client/.vitest-reports/
path: client/.vitest/blob/
include-hidden-files: true
if-no-files-found: error
retention-days: 1
@@ -1036,7 +1049,7 @@ jobs:
uses: actions/download-artifact@v7
with:
pattern: client-blob-*
path: client/.vitest-reports/
path: client/.vitest/blob/
merge-multiple: true
- name: Merge the slices and check the thresholds
@@ -1074,7 +1087,7 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 15
container:
image: mcr.microsoft.com/playwright:v1.65.0-noble@sha256:9beb546099e11f52d62e505537914870e01a67e0e6b00ae41da4775324e73dbe
image: mcr.microsoft.com/playwright:v1.65.1-noble@sha256:1507cbfc550a63a6b7396791ca4f00df17beb56342d2447b3f106c306f525579
options: --ipc=host
strategy:
fail-fast: false
@@ -1187,6 +1200,7 @@ jobs:
--set 'extraVolumeMounts[0].mountPath=/usr/local/share/kitinerary/extractors' \
--set 'extraVolumeMounts[0].readOnly=true' \
--set probes.liveness=null \
--set database=null \
> "$out/variants.yaml"
helm template trek charts/trek \
--set httpRoute.enabled=true \
@@ -1210,6 +1224,14 @@ jobs:
--set service.port=8080 \
--set-json 'httpRoute={"enabled":true,"parentRefs":[{"name":"gateway","namespace":"gateway-system","sectionName":"https"}],"hostnames":["trek.example.com"],"paths":["/","/api"],"annotations":{"example.com/note":"custom route"},"timeouts":{"request":"0s","backendRequest":"0s"}}' \
> "$out/http-route-variants.yaml"
helm template trek charts/trek \
--set-json 'extraObjects=[{"apiVersion":"batch/v1","kind":"CronJob","metadata":{"name":"{{ include \"trek.fullname\" . }}-backup-copy"},"spec":{"schedule":"0 3 * * *","jobTemplate":{"spec":{"template":{"spec":{"restartPolicy":"OnFailure","containers":[{"name":"copy","image":"busybox:1.36","command":["ls","/data/backups"],"volumeMounts":[{"name":"data","mountPath":"/data","readOnly":true}]}],"volumes":[{"name":"data","persistentVolumeClaim":{"claimName":"{{ include \"trek.fullname\" . }}-data","readOnly":true}}]}}}}}},"apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: {{ .Release.Name }}-notes\ndata:\n release: {{ .Release.Name | quote }}\n"]' \
> "$out/extra-objects.yaml"
# kubeconform accepts a name that still reads {{ ... }}, so check that both forms went through tpl.
if grep -n '{{' "$out/extra-objects.yaml"; then
echo "::error::extraObjects left a template unrendered"
exit 1
fi
- name: Check the manifests against the Kubernetes schemas
# The pinned Gateway API schema adds HTTPRoute validation without skipping unknown resources.
@@ -1325,7 +1347,7 @@ jobs:
set -euo pipefail
docker network create trek-ci-pg
docker run -d --name trek-ci-db --network trek-ci-pg \
-e POSTGRES_PASSWORD=ci -e POSTGRES_DB=trek postgres:18
-e POSTGRES_PASSWORD=ci -e POSTGRES_DB=trek postgres:19
for _ in $(seq 1 30); do
docker exec trek-ci-db pg_isready -U postgres -d trek >/dev/null 2>&1 && break
sleep 2
@@ -1446,7 +1468,7 @@ jobs:
path: plugin-sdk/coverage/
- name: Scan
uses: SonarSource/sonarqube-scan-action@59202af334b4ba7b5db01b701b8e79f8b3bef0f4 # v8.5.0
uses: SonarSource/sonarqube-scan-action@70bad232163b09d998ea0707ee80c0ec80798c16 # v8.5.1
env:
# SonarQube Cloud is the scan action's default host, so no
# SONAR_HOST_URL — the token is a sonarcloud.io token for the
+5 -1
View File
@@ -55,7 +55,8 @@ coverage
coverage-*/
*.lcov
.nyc_output
# Blob reports of a sharded vitest run (test.yml)
# Blob reports of a sharded vitest run (test.yml) and the other files vitest writes
.vitest
.vitest-reports
# Cache
@@ -73,3 +74,6 @@ minio-licence.key
.run
.full-review
# Built by server/scripts/build-atlas-mesh.mjs (npm run dev/build, Docker build)
server/assets/atlas-mesh/
+1 -1
View File
@@ -137,7 +137,7 @@ These principles come out of a full-repo audit and shape all new code:
## Quality gates in CI
`.github/workflows/test.yml` runs, per package: typecheck (server also `typecheck:tests`, client also the strict-mode ratchet `lint:strict`), lint (client and server through `lint:warnings`, which also holds the warning count per rule), `lint:pages`, `lint:rtl`, `lint:size` (client and server), the server's `lint:strict`, `lint:boundaries`, `lint:tx`, `lint:dialect`, `lint:engine-dispatch`, `lint:test-sql`, `lint:test-mocks`, `lint:test-new-service`, `lint:query-api`, `lint:mcp-zod`, `lint:service-http` and `lint:response-contracts`, the client's and server's `lint:format`, `lint:layers`, `lint:offline`, `lint:dup`, `lint:pairs`, `lint:skips`, `lint:i18n-keys` and `theme:lint`, shared's `contracts:open`, the repo-wide `lint:knip` (in `server-lint`), `check:plugin-facts`, `i18n:parity:strict` (with the untranslated-strings ratchet), the S3 contract suite, TREK on Postgres (`server-postgres`, once per supported major, 14 and 18, each in three slices: first the Postgres probe (in the first slice), every dialect helper on SQLite and Postgres and the statements every repository method reaches with sample arguments, its SQL errors per method and the methods it cannot measure held to a baseline that only shrinks and fails while it is still unmeasured; then the Postgres lane, every suite that boots the app on the real database module, found by `server/tests/postgres/lane.ts` rather than listed, plus PARITY-PG and the write lock; see `server/CLAUDE.md`), the browser end-to-end flows (Chromium and WebKit, in the Playwright container, in two slices), a client build with `check:gl-split`, coverage for all four packages, then a SonarCloud scan. It also builds the Docker image and boots it until `/api/health/ready` answers, on SQLite and on Postgres 18, and lints and renders the Helm chart against the Kubernetes schemas and runs `docker compose config` on every compose file (both in `docker`, each part when its area changed). `lint-prettier.yml` additionally runs `lint` + `lint:format` on `shared/`, both check-only. `plugin-sdk` has no lint script and is outside the eslint gates. **Not in CI**: the screenshot and help-media Playwright projects; run them locally. There are no git hooks; nothing runs before a commit except you. Other workflows build Docker images, scan them, and publish `trek-plugin-sdk` on `plugin-sdk-v*` tags.
`.github/workflows/test.yml` runs, per package: typecheck (server also `typecheck:tests`, client also the strict-mode ratchet `lint:strict`), lint (client and server through `lint:warnings`, which also holds the warning count per rule), `lint:pages`, `lint:rtl`, `lint:size` (client and server), the server's `lint:strict`, `lint:boundaries`, `lint:tx`, `lint:dialect`, `lint:engine-dispatch`, `lint:test-sql`, `lint:test-mocks`, `lint:test-new-service`, `lint:query-api`, `lint:mcp-zod`, `lint:service-http` and `lint:response-contracts`, the client's and server's `lint:format`, `lint:layers`, `lint:offline`, `lint:dup`, `lint:pairs`, `lint:skips`, `lint:i18n-keys` and `theme:lint`, shared's `contracts:open`, the repo-wide `lint:knip` (in `server-lint`), `check:plugin-facts`, `i18n:parity:strict` (with the untranslated-strings ratchet), the S3 contract suite, TREK on Postgres (`server-postgres`, once per supported major, 14 and 19, each in three slices: first the Postgres probe (in the first slice), every dialect helper on SQLite and Postgres and the statements every repository method reaches with sample arguments, its SQL errors per method and the methods it cannot measure held to a baseline that only shrinks and fails while it is still unmeasured; then the Postgres lane, every suite that boots the app on the real database module, found by `server/tests/postgres/lane.ts` rather than listed, plus PARITY-PG and the write lock; see `server/CLAUDE.md`), the browser end-to-end flows (Chromium and WebKit, in the Playwright container, in two slices), a client build with `check:gl-split`, coverage for all four packages, then a SonarCloud scan. It also builds the Docker image and boots it until `/api/health/ready` answers, on SQLite and on Postgres 19, and lints and renders the Helm chart against the Kubernetes schemas and runs `docker compose config` on every compose file (both in `docker`, each part when its area changed). `lint-prettier.yml` additionally runs `lint` + `lint:format` on `shared/`, both check-only. `plugin-sdk` has no lint script and is outside the eslint gates. **Not in CI**: the screenshot and help-media Playwright projects; run them locally. There are no git hooks; nothing runs before a commit except you. Other workflows build Docker images, scan them, and publish `trek-plugin-sdk` on `plugin-sdk-v*` tags.
- **Job names read "<Area> <what>[ <variant>][ i/n]"** (`Server tests 3/10`, `Server Postgres 14 2/3`, `Docker and Helm`): the area first, one of Changes, Shared, Server, Client, Docker or Sonar, then lower case, with no colon, no parentheses and no middle dot, and a slice only at the end, so the checks list sorts by area. The workflow is named `CI`, so a check reads `CI / Server tests 3/10`. Job ids are the names in kebab-case (`server-tests`), the jobs stand in `test.yml` in area order, and the list at the top of `test.yml` says what each job holds. A new job follows the scheme and joins that list; `scripts/ci/workflow-jobs.test.mjs` fails on a name outside it. `ci-ok`, `lint` and `check-target` keep their names: the ruleset requires them by name.
- **What the folded jobs hold.** `Shared tests` is the plugin SDK's typecheck and coverage, run before the root install so the SDK resolves only its own dependencies, then i18n parity and shared's coverage. `Client types` is the typecheck and the strict ratchet; `Client checks` the source ratchets, then the production build with `check:gl-split`. `Docker and Helm` builds and boots the image when the image area changed and checks the chart and compose files when the deploy area changed. Inside a folded job each group of steps runs after a failure in another, so one red check shows every gate that failed; the step names say which.
+27 -16
View File
@@ -41,9 +41,10 @@ COPY server/package.json ./server/
RUN npm ci --workspace=server --ignore-scripts
COPY --from=shared-builder /app/shared/dist ./shared/dist
COPY server/ ./server/
# tsc needs more than the 2 GB heap Node picks on a host with about 12 GB of RAM;
# on a bigger build machine the default is larger, so only small hosts failed.
RUN NODE_OPTIONS=--max-old-space-size=4096 npm run build --workspace=server
# The globe Atlas geometry is built from the committed boundary files (no network,
# deterministic) here rather than committed; it lands in server/assets with the rest.
RUN node server/scripts/build-atlas-mesh.mjs
RUN npm run build --workspace=server
# ── Stage 4: production runtime ──────────────────────────────────────────────
FROM node:24-trixie-slim
@@ -73,34 +74,44 @@ COPY server/package.json ./server/
# The upgrade takes the Debian security fixes the base image was built before
# (zlib, 11/2026, failed the image scan until node:24-trixie-slim caught up).
#
# postgresql-client-18 brings pg_dump, pg_restore and psql to
# /usr/lib/postgresql/18/bin, which back up and restore an install on Postgres
# postgresql-client-19 brings pg_dump, pg_restore and psql to
# /usr/lib/postgresql/19/bin, which back up and restore an install on Postgres
# (TREK_DB_URL). A client handles every server up to its own major and refuses
# a newer one, so the image carries the newest major TREK supports (14 to 18).
# a newer one, so the image carries the newest major TREK supports (14 to 19).
# Debian 13 ships 17 only, so it comes from the PostgreSQL project's apt
# repository (PGDG): the `18` component lists that major's packages and no
# other, and the repository's signing key (fingerprint B97B 0AFC AA1A 47F0 44F2
# 44A0 7FCC 7D46 ACCC 4CF8) is kept beside the entrypoint instead of fetched at
# build time. Raise both together when TREK supports a newer major.
# repository (PGDG): its `main` component carries every major the project
# supports, and the package name pins the one installed. The per-major
# components can trail a new release, so the image does not rely on them. The
# repository's signing key (fingerprint B97B 0AFC AA1A 47F0 44F2 44A0 7FCC 7D46
# ACCC 4CF8) is kept beside the entrypoint instead of fetched at build time.
# Raise the package together with SUPPORTED_SERVER_MAJORS in
# server/src/db/engine/postgres/server-checks.ts.
# Earlier images carried the version 18 tools, and installs that set
# TREK_DB_PG_BIN_DIR=/usr/lib/postgresql/18/bin (the old .env.example value)
# would lose backups and the pre-migrate snapshot after updating, so that path
# stays as a link to the 19 tools, which handle every supported server.
COPY server/scripts/pgdg-apt-key.asc /etc/apt/keyrings/pgdg.asc
RUN echo 'deb [signed-by=/etc/apt/keyrings/pgdg.asc] http://apt.postgresql.org/pub/repos/apt trixie-pgdg main 18' \
RUN echo 'deb [signed-by=/etc/apt/keyrings/pgdg.asc] http://apt.postgresql.org/pub/repos/apt trixie-pgdg main' \
> /etc/apt/sources.list.d/pgdg.list && \
apt-get update && \
apt-get upgrade -y --no-install-recommends && \
apt-get install -y --no-install-recommends tzdata dumb-init wget ca-certificates \
libkitinerary-bin libsqlite3-0 postgresql-client-18 && \
libkitinerary-bin libsqlite3-0 postgresql-client-19 && \
mkdir -p /usr/lib/postgresql/18 && ln -s /usr/lib/postgresql/19/bin /usr/lib/postgresql/18/bin && \
npm ci --workspace=server --omit=dev --ignore-scripts && \
{ ln -sf "$(find /usr/lib -name kitinerary-extractor -type f | head -1)" /usr/local/bin/kitinerary-extractor || true; } && \
rm -rf /var/lib/apt/lists/* /usr/local/lib/node_modules/npm /usr/local/bin/npm /usr/local/bin/npx && \
chown -R node:node /app
# gosu rebuilt with a current Go toolchain (stage 0) — the entrypoint script uses
# it to drop to node.
# gosu rebuilt with a current Go toolchain (stage 0). The entrypoint drops to node
# with setpriv since #3135; gosu stays in the image for anyone who calls it by hand.
COPY --from=gosu-build /out/gosu /usr/local/bin/gosu
ENV XDG_CACHE_HOME=/tmp/kf6-cache
# Prevent Qt from probing for a display in headless containers.
ENV QT_QPA_PLATFORM=offscreen
# A UTF-8 locale, so Qt does not warn about the C locale on every extractor run.
ENV LANG=C.UTF-8
# Fixed path for both amd64 (static binary) and arm64 (symlink to apt binary).
# Override with KITINERARY_EXTRACTOR_PATH if you install it elsewhere.
ENV KITINERARY_EXTRACTOR_PATH=/usr/local/bin/kitinerary-extractor
@@ -173,8 +184,8 @@ HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
# carrying quotes does not survive that round-trip (the container then dies with
# a shell syntax error before Node starts). A CMD of one bare token does.
COPY server/scripts/entrypoint.sh /usr/local/bin/trek-entrypoint
# Root-owned on purpose — this is what calls gosu, so it runs before the drop to
# node. chmod is explicit because a checkout on Windows carries no exec bit.
# Root-owned on purpose: it runs as root and drops to node itself, with setpriv.
# chmod is explicit because a checkout on Windows carries no exec bit.
RUN chmod 0755 /usr/local/bin/trek-entrypoint
ENTRYPOINT ["dumb-init", "--"]
+18 -61
View File
@@ -12,18 +12,20 @@ TREK has grown from a travel planner into a whole ecosystem for trips: plan toge
<br />
<a href="https://apps.apple.com/app/id6831237775"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/app/app-store-dark.svg" /><source media="(prefers-color-scheme: light)" srcset="docs/app/app-store-light.svg" /><img src="docs/app/app-store-light.svg" alt="Download TREK on the App Store, with a QR code" width="320" /></picture></a>
&nbsp;
<a href="https://play.google.com/store/apps/details?id=com.liketrek.trek"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/app/google-play-dark.svg" /><source media="(prefers-color-scheme: light)" srcset="docs/app/google-play-light.svg" /><img src="docs/app/google-play-light.svg" alt="Get TREK on Google Play, with a QR code" width="320" /></picture></a>
<br />
<a href="https://demo.liketrek.com"><img alt="Demo" src="https://img.shields.io/badge/Demo-try-111827?style=for-the-badge" /></a>
&nbsp;
<a href="https://hub.docker.com/r/mauriceboe/trek"><img alt="Docker" src="https://img.shields.io/badge/Docker-ready-2496ED?style=for-the-badge" /></a>
&nbsp;
<a href="https://sonarcloud.io/project/overview?id=liketrek_TREK"><img alt="Sonar Quality Gate" src="https://img.shields.io/sonar/quality_gate/liketrek_TREK?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge" /></a>
&nbsp;
<img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/liketrek/TREK/test.yml?branch=main&style=for-the-badge">
&nbsp;
<a href="https://discord.gg/NhZBDSd4qW"><img alt="Discord" src="https://img.shields.io/badge/Discord-join-5865F2?style=for-the-badge" /></a>
&nbsp;
<a href="https://kanban.pakulat.org/shared/I4wxF6inOOMB0C6hH6kQm3efyNxFjwyI"><img alt="Roadmap" src="https://img.shields.io/badge/Roadmap-view-0EA5E9?style=for-the-badge" /></a>
&nbsp;
<a href="https://www.patreon.com/cw/mauriceboe"><img alt="Patreon" src="https://img.shields.io/badge/Patreon-monthly-141518?style=for-the-badge" /></a>
&nbsp;
<a href="https://ko-fi.com/mauriceboe"><img alt="Ko-fi" src="https://img.shields.io/badge/Ko--fi-support-FF5E5B?style=for-the-badge" /></a>
&nbsp;
<a href="https://www.buymeacoffee.com/mauriceboe"><img alt="BMAC" src="https://img.shields.io/badge/BMAC-support-FFDD00?style=for-the-badge" /></a>
@@ -36,7 +38,6 @@ TREK has grown from a travel planner into a whole ecosystem for trips: plan toge
&nbsp;
<a href="https://github.com/liketrek/TREK"><img alt="Stars" src="https://img.shields.io/github/stars/liketrek/trek?style=for-the-badge&label=Stars&color=6B7280" /></a>
<sub>PUBLIC SERVICES PROUDLY SPONSORED BY</sub><br /><a href="https://cloud.dataforest.net/en?mtm_campaign=trek"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/sponsors/dataforest-light.svg" /><source media="(prefers-color-scheme: light)" srcset="docs/sponsors/dataforest-dark.svg" /><img src="docs/sponsors/dataforest-dark.svg" alt="dataforest cloud" height="30" /></picture></a>
</div>
---
@@ -51,14 +52,8 @@ TREK has grown from a travel planner into a whole ecosystem for trips: plan toge
## What you get
<picture>
<source media="(max-width: 700px)" srcset="docs/tiles/grid-mobile.svg" />
<source media="(prefers-color-scheme: dark)" srcset="docs/tiles/grid-desktop-dark.svg" />
<img src="docs/tiles/grid-desktop.svg" alt="Plan, track, share" width="100%" />
</picture>
<details>
<summary><b>See all features</b></summary>
<summary><h3>See all features</h3></summary>
<br />
@@ -161,7 +156,7 @@ Most of what follows is an addon an admin switches on or off. Lists, Costs, Docu
- **Your own model**: an API key for Anthropic, OpenAI, Gemini or OpenRouter, a ChatGPT plan, or any OpenAI-compatible endpoint, set for the instance or per user
- **You stay in charge**: reads run at once, every change waits as a card to apply or discard and can be undone for 15 minutes. Nothing leaves before you agree to the provider, and a file's text only with your consent
- **Attachments**: drop a booking confirmation, a GPX file or a photo into the chat, and the assistant offers what to do with it
- **MCP server** (off by default): OAuth 2.1 with mandatory PKCE and dynamic client registration, 410 tools, 30 resources and 4 prompts, 35 scopes in 17 groups ticked on the consent screen, and every call in the audit log
- **MCP server** (off by default): OAuth 2.1 with mandatory PKCE and dynamic client registration, 453 tools, 30 resources and 4 prompts, 35 scopes in 17 groups ticked on the consent screen, and every call in the audit log
- **Addon-aware**: twelve addon gates decide which tools a session sees, and flipping one re-registers live sessions
</td>
@@ -218,34 +213,12 @@ Most of what follows is an addon an admin switches on or off. Lists, Costs, Docu
<br />
## Powered by [dataforest cloud](https://cloud.dataforest.net/en?mtm_campaign=trek)
<div align="center">
<br />
<sub>POWERED BY</sub><br />
<a href="https://cloud.dataforest.net/en?mtm_campaign=trek"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/sponsors/dataforest-light.svg" /><source media="(prefers-color-scheme: light)" srcset="docs/sponsors/dataforest-dark.svg" /><img src="docs/sponsors/dataforest-dark.svg" alt="dataforest cloud" height="40" /></picture></a>
<a href="https://cloud.dataforest.net/en?mtm_campaign=trek">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/sponsors/dataforest-light.svg" />
<source media="(prefers-color-scheme: light)" srcset="docs/sponsors/dataforest-dark.svg" />
<img src="docs/sponsors/dataforest-dark.svg" alt="dataforest cloud" height="60" />
</picture>
</a>
<br />
<br />
**Every TREK installation in the world searches through servers that [dataforest cloud](https://cloud.dataforest.net/en?mtm_campaign=trek) sponsors.**
The place index with over 88 million places, the address search in every TREK language and the planet-wide routing all run on [dataforest cloud](https://cloud.dataforest.net/en?mtm_campaign=trek) in Frankfurt, Germany, free of charge for everyone who self-hosts TREK. Without this sponsorship, these services would not exist in this form.
Thank you, [dataforest](https://cloud.dataforest.net/en?mtm_campaign=trek), for backing open source this generously. 💚
<br />
<a href="https://cloud.dataforest.net/en?mtm_campaign=trek"><img alt="Visit dataforest cloud" src="https://img.shields.io/badge/Visit-dataforest_cloud-02C382?style=for-the-badge" /></a>
Looking for a server for your own TREK? [dataforest cloud](https://cloud.dataforest.net/en?mtm_campaign=trek) is where TREK's own services live.
The place index with 88 million places, the address search and the planet-wide routing run on <a href="https://cloud.dataforest.net/en?mtm_campaign=trek">dataforest cloud</a> in Frankfurt, free for every self-hosted TREK. Thank you! 💚
</div>
@@ -253,13 +226,7 @@ Looking for a server for your own TREK? [dataforest cloud](https://cloud.datafor
## AI usage
We use LLM-assisted coding tools across parts of this codebase. Nothing ships that a
maintainer has not read and understood: every change goes through a pull request, is
reviewed and tested, and has a human who can answer for it. "The AI wrote that" is not
an answer any of us would accept from ourselves.
See [**How we use AI in TREK**](https://github.com/liketrek/TREK/discussions/1851) for
the details.
We use LLM-assisted coding tools, and nothing ships that a maintainer has not read, reviewed, tested and can answer for. More in [How we use AI in TREK](https://github.com/liketrek/TREK/discussions/1851).
<br />
@@ -283,7 +250,7 @@ Open `http://localhost:3000`, or `http://<server-ip>:3000` from another machine.
<div align="center">
<a href="#docker-compose-production">Docker Compose</a>&nbsp;&nbsp;·&nbsp;&nbsp;<a href="#helm-kubernetes">Helm / Kubernetes</a>&nbsp;&nbsp;·&nbsp;&nbsp;<a href="#install-as-app-pwa">Install as PWA</a>&nbsp;&nbsp;·&nbsp;&nbsp;<a href="#reverse-proxy">Reverse Proxy</a>
<a href="#docker-compose-production">Docker Compose</a>&nbsp;&nbsp;·&nbsp;&nbsp;<a href="#helm-kubernetes">Helm / Kubernetes</a>&nbsp;&nbsp;·&nbsp;&nbsp;<a href="#reverse-proxy">Reverse Proxy</a>
</div>
@@ -321,7 +288,7 @@ docker compose up -d
See [Install with Docker Compose](https://github.com/liketrek/TREK/wiki/Install-Docker-Compose)
for the full walkthrough.
TREK stores its data in SQLite by default. Set `TREK_DB_URL` to run it on a PostgreSQL 14 to 18 database instead. The
TREK stores its data in SQLite by default. Set `TREK_DB_URL` to run it on a PostgreSQL 14 to 19 database instead. The
[`docker-compose.postgres.yml`](docker-compose.postgres.yml) example starts one beside TREK, and the
[Postgres guide](https://github.com/liketrek/TREK/wiki/Database-Postgres) covers the requirements, the backups and
how to move an existing SQLite install to Postgres with the command TREK ships for it.
@@ -340,18 +307,6 @@ See [`charts/README.md`](https://github.com/liketrek/TREK/blob/main/charts/READM
<br />
<h2 id="install-as-app-pwa">Install as App (PWA)</h2>
TREK works as a Progressive Web App, and the TREK Travel Planner app for iPhone, iPad and Android connects to the same server ([Native Apps](https://github.com/liketrek/TREK/wiki/Native-Apps)). To install the web app instead:
1. Open TREK in the browser (HTTPS required)
2. **iOS**: Share ▸ *Add to Home Screen*
3. **Android**: Menu ▸ *Install app* (or *Add to Home Screen*)
TREK then launches fullscreen with its own icon, just like a native app.
<br />
## Updating
See [Updating](https://github.com/liketrek/TREK/wiki/Updating) — Docker Compose,
@@ -440,6 +395,8 @@ Caddy handles TLS and WebSockets automatically.
Every variable, its default and what it does: see
[Environment Variables](https://github.com/liketrek/TREK/wiki/Environment-Variables).
<br />
## Data sources
The Atlas map's country and sub-national (province/county) boundaries come from
+1
View File
@@ -60,3 +60,4 @@ See `values.yaml` for more options.
- Set `env.OIDC_DISCOVERY_URL` to override the auto-constructed OIDC discovery endpoint. Required for providers (e.g. Authentik) that expose it at a non-standard path.
- `podSecurityContext` defaults to `fsGroup: 1000` with `fsGroupChangePolicy: OnRootMismatch`, and `securityContext` (the container's) is empty. The container then starts as root, hands `/app/data` and `/app/uploads` to `node` (uid 1000) if the directory or anything directly inside it is not owned by `node` yet, and drops to `node`. Deeper files are not checked. Only the owning user is changed (plus a `root` group), so a different `fsGroup` stays in place. A volume that refuses `chown` (NFS with `root_squash`) logs a warning instead; set `runAsUser: 1000` then. To run as `node` from the start, for example under the `restricted` Pod Security Standard, set `podSecurityContext.runAsUser: 1000` and `runAsGroup: 1000`; the image then skips that step and the privilege drop. See the example in `values.yaml`.
- Use `extraVolumes` and `extraVolumeMounts` to add your own volumes to the pod. To give the booking import more KItinerary extractors, mount a ConfigMap at `/usr/local/share/kitinerary/extractors`, with one `.json` and one `.js` key for each extractor; see the example in `values.yaml`.
- Use `extraObjects` to render further Kubernetes objects next to the chart's own, for example a backup `CronJob`. Each item is a map or a string of YAML, and `{{ }}` in it is evaluated, so `{{ .Release.Name }}` works. A backup job should copy TREK's own backups from `backups/` on the data volume and mount it read only, since that volume also holds the encryption key. The archives carry `.encryption_key` too unless `ENCRYPTION_KEY` is set, so protect the copy's destination like the data volume.
+5 -2
View File
@@ -1,5 +1,8 @@
apiVersion: v2
name: trek
version: 5.1.4
version: 5.2.2
description: Minimal Helm chart for TREK app
appVersion: "5.1.4"
home: https://github.com/liketrek/TREK
sources:
- https://github.com/liketrek/TREK
appVersion: "5.2.2"
+3
View File
@@ -136,6 +136,9 @@ data:
{{- if .Values.env.AMAP_API_BASE }}
AMAP_API_BASE: {{ .Values.env.AMAP_API_BASE | quote }}
{{- end }}
{{- if .Values.env.MAP_EXTRA_CONNECT_HOSTS }}
MAP_EXTRA_CONNECT_HOSTS: {{ .Values.env.MAP_EXTRA_CONNECT_HOSTS | quote }}
{{- end }}
{{- if .Values.env.VAPID_PUBLIC_KEY }}
VAPID_PUBLIC_KEY: {{ .Values.env.VAPID_PUBLIC_KEY | quote }}
{{- end }}
+5 -4
View File
@@ -1,4 +1,5 @@
{{- if and .Values.database.url (not .Values.database.existingSecret) .Values.existingSecret }}
{{- $db := default dict .Values.database }}
{{- if and $db.url (not $db.existingSecret) .Values.existingSecret }}
{{- fail "database.url is written into the chart's own Secret, which existingSecret replaces. Put TREK_DB_URL in your Secret and set database.existingSecret instead." }}
{{- end }}
apiVersion: apps/v1
@@ -66,13 +67,13 @@ spec:
name: {{ default (printf "%s-secret" (include "trek.fullname" .)) .Values.existingSecret }}
key: {{ .Values.existingSecretKey | default "ENCRYPTION_KEY" }}
optional: true
{{- if or .Values.database.url .Values.database.existingSecret }}
{{- if or $db.url $db.existingSecret }}
# Required when set: a missing key stops the pod rather than starting it on SQLite.
- name: TREK_DB_URL
valueFrom:
secretKeyRef:
name: {{ default (printf "%s-secret" (include "trek.fullname" .)) .Values.database.existingSecret }}
key: {{ if .Values.database.existingSecret }}{{ .Values.database.existingSecretKey | default "TREK_DB_URL" }}{{ else }}TREK_DB_URL{{ end }}
name: {{ default (printf "%s-secret" (include "trek.fullname" .)) $db.existingSecret }}
key: {{ if $db.existingSecret }}{{ $db.existingSecretKey | default "TREK_DB_URL" }}{{ else }}TREK_DB_URL{{ end }}
{{- end }}
- name: ADMIN_EMAIL
valueFrom:
+8
View File
@@ -0,0 +1,8 @@
{{- range .Values.extraObjects }}
---
{{- if kindIs "string" . }}
{{ tpl . $ }}
{{- else }}
{{ tpl (toYaml .) $ }}
{{- end }}
{{- end }}
+5 -4
View File
@@ -1,3 +1,4 @@
{{- $db := default dict .Values.database }}
{{- if and (not .Values.existingSecret) (not .Values.generateEncryptionKey) }}
apiVersion: v1
kind: Secret
@@ -8,8 +9,8 @@ metadata:
type: Opaque
data:
{{ .Values.existingSecretKey | default "ENCRYPTION_KEY" }}: {{ .Values.secretEnv.ENCRYPTION_KEY | b64enc | quote }}
{{- if .Values.database.url }}
TREK_DB_URL: {{ .Values.database.url | b64enc | quote }}
{{- if $db.url }}
TREK_DB_URL: {{ $db.url | b64enc | quote }}
{{- end }}
{{- if .Values.secretEnv.ADMIN_EMAIL }}
ADMIN_EMAIL: {{ .Values.secretEnv.ADMIN_EMAIL | b64enc | quote }}
@@ -68,8 +69,8 @@ stringData:
{{- else }}
{{ .Values.existingSecretKey | default "ENCRYPTION_KEY" }}: {{ randAlphaNum 32 | quote }}
{{- end }}
{{- if .Values.database.url }}
TREK_DB_URL: {{ .Values.database.url | quote }}
{{- if $db.url }}
TREK_DB_URL: {{ $db.url | quote }}
{{- end }}
{{- if .Values.secretEnv.ADMIN_EMAIL }}
ADMIN_EMAIL: {{ .Values.secretEnv.ADMIN_EMAIL | quote }}
+29 -1
View File
@@ -170,6 +170,11 @@ env:
# Send the Amap (高德地图) calls through an egress proxy, a cache or a gateway that speaks the same API instead of
# restapi.amap.com directly. The key itself is a credential and goes under secretEnv.AMAP_API_KEY, or into
# Admin > Settings > API Keys. Defaults to https://restapi.amap.com.
# MAP_EXTRA_CONNECT_HOSTS: ""
# Hosts of your own map tiles or vector styles that the GL maps may load, comma-separated, e.g.
# "tiles.example.com,*.maps.example.org:8443": a host name, optionally with a port or as a wildcard over
# its subdomains; https is implied. They are added to the Content-Security-Policy and told to the app.
# An entry that is not a plain host name aborts startup.
# VAPID_PUBLIC_KEY: ""
# Web Push key pair, public half (base64url, 65 bytes). Leave both halves empty and TREK generates a pair on
# first start and keeps it in the database, so it travels with backups. To use your own pair, set this and
@@ -190,7 +195,7 @@ env:
# starting it on SQLite. The role in the URL owns TREK's database and must not be a superuser
# (nor a member of one, nor hold a right that reaches the server's files or programs): a
# restore runs the backup's SQL as that role and refuses one that could reach the database host. The wiki page shows the
# SQL that creates such a role. PostgreSQL 14 to 18 is supported.
# SQL that creates such a role. PostgreSQL 14 to 19 is supported.
# url: "postgres://trek:<password>@postgres.example.internal:5432/trek?sslmode=require"
database:
url: ""
@@ -338,6 +343,29 @@ extraVolumes: []
# readOnly: true
extraVolumeMounts: []
# Further Kubernetes objects the chart renders next to its own, for example a Job, a
# CronJob or a ConfigMap. Each item is rendered as written, either as a map or as a
# string of YAML, and {{ }} in it is evaluated, so {{ include "trek.fullname" . }} or
# {{ .Release.Name }} work, in both forms. Write literal braces as {{ "{{" }}.
# A backup job must only read the data volume: it also holds the encryption key and the
# server's secrets, and a second writer corrupts travel.db. Rather than copying the live
# travel.db, copy TREK's own backups (Admin, Backup, automatic backups) from backups/ in
# that volume. Those archives carry .encryption_key too (unless ENCRYPTION_KEY is set),
# so protect the job's destination like the data volume itself.
# extraObjects:
# - apiVersion: v1
# kind: ConfigMap
# metadata:
# name: '{{ include "trek.fullname" . }}-extra'
# data:
# note: hello
# - |
# apiVersion: v1
# kind: ConfigMap
# metadata:
# name: {{ .Release.Name }}-notes
extraObjects: []
resources:
requests:
cpu: 100m
+1 -1
View File
@@ -68,7 +68,7 @@ The offline core is flagship work surrounded by a periphery that ignores it. New
## Big-picture pieces
- **Maps** (`src/components/Map/`): two interchangeable renderers — Leaflet and Mapbox/MapLibre GL — chosen at runtime by `MapViewAuto.tsx`. Keep both in sync when changing map features, and keep `mapbox-gl` and `maplibre-gl` in separate chunks (`check:gl-split`). The raster prefetcher fetches tiles `no-cors` so custom tile providers without CORS headers keep working; the vector prefetcher deliberately uses `cors` because it has to read the responses — don't "align" one with the other.
- **Maps** (`src/components/Map/`): two interchangeable renderers — Leaflet and Mapbox/MapLibre GL — chosen at runtime by `MapViewAuto.tsx`. Keep both in sync when changing map features, and keep `mapbox-gl` and `maplibre-gl` in separate chunks (`check:gl-split`). The raster prefetcher fetches tiles `no-cors` so custom tile providers without CORS headers keep working, except a template MapLibre draws (`trek:template`), whose tiles a GL map reads with CORS and the service worker keeps apart in `map-tiles-gl` (`src/sync/glTileCache.ts`); the vector prefetcher deliberately uses `cors` because it has to read the responses — don't "align" one with the other.
- **i18n** (`src/i18n/TranslationContext.tsx`): `en` is bundled; every other locale is a dynamic `import('@trek/shared/i18n/<locale>')` so Vite emits one chunk per locale. Strings live in `shared/`, never here. `t()` returns an unknown key unchanged, so `lint:i18n-keys` (`scripts/i18n-keys.mjs`) resolves every literal key in `t()`, `tHtml()`, `tr()`, `<TransHtml html>`, `translateApiError` and `*Key` props against `shared/src/i18n/en`; a template whose interpolations only choose between string literals is expanded and each branch checked as a key; any other template key is read with each interpolation as one key segment and passes by itself only when it reaches between 1 and `MAX_IMPLICIT_MATCHES` (30) en keys; a wider one, or one with no fixed dotted prefix, needs a `DYNAMIC_ALLOWED` entry keyed by file and template that says what bounds the value, and an entry the check no longer needs fails. Pass counts as numbers, and let a plural group pick the wording instead of switching keys on the count.
- **Mobile shell** (`src/mobile/`): below the phone breakpoint (`useIsPhone`) `App.tsx` wraps routes in `MobileShell` and the `M*` screens under `mobile/screens/` take over. A UI change to a domain with an `M*` twin usually needs both, and the logic change goes into the shared hook (see "Desktop and phone views" below).
- **Plugins UI** (`src/components/Plugins/`): third-party surfaces render only inside the sandboxed `PluginFrame` iframe (postMessage bridge, live theme-token sync). Host-rendered contribution points (widgets, schedule rows, map layers, planner columns/actions) render server-normalized primitives only — plugin markup never runs inline. Authoring is covered by the `trek-plugin-dev` skill.
@@ -1,6 +1,9 @@
package com.liketrek.trek;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.util.TypedValue;
@@ -11,11 +14,13 @@ import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.WebViewListener;
import com.liketrek.trek.screen.TrekKeyCommands;
import com.liketrek.trek.tiles.TrekTileStore;
import com.liketrek.trek.widget.TrekWidgetUpdater;
@@ -26,6 +31,9 @@ public class MainActivity extends BridgeActivity {
/** The share sheet (share/ShareActivity.kt) left an item for the import. */
public static final String ACTION_SHARE_HANDOFF = "com.liketrek.trek.SHARE_HANDOFF";
/** The page colour of the address screen (native-shell/shell.css --page). */
private static final int SHELL_PAGE = 0xFFFFFAF5;
@Override
protected void onCreate(Bundle savedInstanceState) {
registerPlugin(TrekShellPlugin.class);
@@ -57,6 +65,33 @@ public class MainActivity extends BridgeActivity {
// and Chrome honours that, but the WebView draws the stretch on its root
// scroller natively. It scales the whole view, top bar and bottom dock included.
bridge.getWebView().setOverScrollMode(View.OVER_SCROLL_NEVER);
// The address screen, and the step from it to the server just picked:
// the warm ground of the first screens behind everything, so the
// restart and the page's first frames do not flash white. The window's
// colour is also what an older WebView shows under the status bar,
// where it lays the page out between the bars (native/appBoot.ts).
if (!onServer || restarting) {
Drawable windowBackground = getWindow().getDecorView().getBackground();
// A new drawable: setBackgroundColor would recolour the theme's own one,
// and the restore below would hand the window the warm ground back.
getWindow().getDecorView().setBackground(new ColorDrawable(SHELL_PAGE));
bridge.getWebView().setBackgroundColor(SHELL_PAGE);
// Once the server's page is up, the window is the one a normal launch
// has, so the status bar of an older WebView follows the system again.
if (onServer) {
bridge.addWebViewListener(new WebViewListener() {
private boolean restored;
@Override
public void onPageLoaded(WebView webView) {
if (restored) return;
restored = true;
getWindow().getDecorView().setBackground(windowBackground);
webView.setBackgroundColor(Color.WHITE);
}
});
}
}
// Set before any WebView callback can run: they are posted to this thread.
if (onServer) {
bridge.setWebViewClient(
@@ -0,0 +1,60 @@
package com.liketrek.trek;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/**
* The log line for a page of the server that came back with an error status.
* "HTTP 503" on the address screen cannot tell the server, a proxy in front of
* it and something on the phone apart, so the line names the page and the
* headers that say who answered (#3014).
*/
final class PageErrorLog {
/** The headers that name whoever answered a page, in the order they are logged. */
private static final String[] SENDER_HEADERS = { "Server", "Via", "CF-Ray", "Content-Type" };
private PageErrorLog() {}
/**
* For example "Page answered HTTP 503 Service Unavailable for
* https://trek.example.com/login (server: cloudflare, cf-ray: 8f1a2b3c4d5e6f70-FRA)".
* The address goes without its query and fragment, where a sign-in page
* carries a challenge or a code. A header the answer did not have is left
* out, and an answer with none of them says so: no server sends a page
* without at least its type, so that points at something on the phone.
*/
static String describe(String url, int status, String reason, Map<String, String> headers) {
StringBuilder line = new StringBuilder("Page answered HTTP ").append(status);
if (reason != null && !reason.trim().isEmpty()) line.append(' ').append(reason.trim());
line.append(" for ").append(withoutQuery(url));
List<String> senders = new ArrayList<>();
for (String name : SENDER_HEADERS) {
String value = header(headers, name);
if (value != null && !value.trim().isEmpty()) senders.add(name.toLowerCase(Locale.ROOT) + ": " + value.trim());
}
line.append(senders.isEmpty() ? " (no server headers)" : " (" + String.join(", ", senders) + ")");
return line.toString();
}
/** A header by name, whatever case the answer wrote it in. */
private static String header(Map<String, String> headers, String name) {
if (headers == null) return null;
for (Map.Entry<String, String> entry : headers.entrySet()) {
if (name.equalsIgnoreCase(entry.getKey())) return entry.getValue();
}
return null;
}
private static String withoutQuery(String url) {
if (url == null) return "";
int end = url.length();
int query = url.indexOf('?');
if (query >= 0) end = query;
int fragment = url.indexOf('#');
if (fragment >= 0 && fragment < end) end = fragment;
return url.substring(0, end);
}
}
@@ -556,7 +556,7 @@ public class TrekShellPlugin extends Plugin {
if (path == null || path.isEmpty()) continue;
String clean = path.startsWith("/") ? path.substring(1) : path;
keep.add(clean);
if (TrekOfflineShell.hasFile(context, clean)) continue;
if (clean.contains("/") && TrekOfflineShell.hasFile(context, clean)) continue;
byte[] data = download(server, clean, null);
if (data == null || !TrekOfflineShell.saveFile(context, clean, data)) complete = false;
}
@@ -572,7 +572,10 @@ public class TrekShellPlugin extends Plugin {
}).start();
}
/** A file of the server's UI, or null: only a 200 counts, and the page only as HTML. */
/**
* A file of the server's UI, or null: only a 200 from the server itself
* counts, the page only as HTML and a file only as something else.
*/
private static byte[] download(String server, String path, String wantType) {
java.net.HttpURLConnection connection = null;
try {
@@ -584,8 +587,11 @@ public class TrekShellPlugin extends Plugin {
connection.setInstanceFollowRedirects(true);
if (wantType != null) connection.setRequestProperty("Accept", wantType);
if (connection.getResponseCode() != 200) return null;
java.net.URL landed = connection.getURL();
if (!landed.getProtocol().equals(base.getProtocol()) || !landed.getHost().equalsIgnoreCase(base.getHost()) || portOf(landed) != portOf(base)) return null;
String type = connection.getContentType();
if (wantType != null && (type == null || !type.startsWith(wantType))) return null;
if (wantType == null && type != null && type.startsWith("text/html") && !path.endsWith(".html")) return null;
try (java.io.InputStream in = connection.getInputStream()) {
java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
byte[] buffer = new byte[16384];
@@ -599,6 +605,10 @@ public class TrekShellPlugin extends Plugin {
}
}
private static int portOf(java.net.URL url) {
return url.getPort() == -1 ? url.getDefaultPort() : url.getPort();
}
/**
* The address screen found the server out of reach: with a copy of its UI
* the app restarts on that instead (TrekOfflineShell), the same way it
@@ -202,14 +202,23 @@ class TrekWebViewClient extends BridgeWebViewClient {
* none, as Cloudflare does with a 403, sends the app to the address screen,
* which says so and offers to add one. Any other 4xx page (a proxy's block
* page, a certificate it refused) stays up with the bar and its way out, so
* the app is never stuck on a page without TREK's UI.
* the app is never stuck on a page without TREK's UI. Each one is logged
* with its address and whoever answered it (PageErrorLog).
*/
@Override
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
int status = errorResponse.getStatusCode();
if (!request.isForMainFrame()) {
super.onReceivedHttpError(view, request, errorResponse);
} else if (status >= 500 || (status >= 400 && wantedCertificate(request.getUrl()))) {
return;
}
Log.w("TrekShell", PageErrorLog.describe(
request.getUrl().toString(),
status,
errorResponse.getReasonPhrase(),
errorResponse.getResponseHeaders()
));
if (status >= 500 || (status >= 400 && wantedCertificate(request.getUrl()))) {
TrekServerStore.setFailure(view.getContext(), "HTTP " + status);
onUnreachable.run();
} else if (status >= 400) {
@@ -44,7 +44,7 @@ data class WidgetSnapshot(
if (days.isEmpty()) return this
val key = date.toString()
return copy(
today = days.firstOrNull { it.date == key },
today = if (today?.date == key) today else days.firstOrNull { it.date == key },
bookings = bookings.filter { (it.date ?: key) >= key },
)
}
@@ -0,0 +1,51 @@
package com.liketrek.trek
import org.junit.Assert.assertEquals
import org.junit.Test
/** The log line for a page that came back with an error status (#3014). */
class PageErrorLogTest {
@Test
fun namesThePageItsStatusAndWhoAnswered() {
val line = PageErrorLog.describe(
"https://trek.example.com/login?redirect=%2F#top",
503,
"Service Unavailable",
mapOf(
"server" to "cloudflare",
"CF-RAY" to "8f1a2b3c4d5e6f70-FRA",
"content-type" to "text/html; charset=UTF-8",
"Set-Cookie" to "session=secret",
),
)
// Any case of a header name is read, only the naming headers are logged,
// and the query with its sign-in state is left off.
assertEquals(
"Page answered HTTP 503 Service Unavailable for https://trek.example.com/login " +
"(server: cloudflare, cf-ray: 8f1a2b3c4d5e6f70-FRA, content-type: text/html; charset=UTF-8)",
line,
)
}
@Test
fun anAnswerWithoutHeadersSaysSo() {
assertEquals(
"Page answered HTTP 503 for https://trek.example.com/ (no server headers)",
PageErrorLog.describe("https://trek.example.com/", 503, null, emptyMap()),
)
assertEquals(
"Page answered HTTP 502 Bad Gateway for (no server headers)",
PageErrorLog.describe(null, 502, "Bad Gateway", null),
)
}
@Test
fun aFragmentBeforeAQuestionMarkEndsTheAddressThere() {
assertEquals(
"Page answered HTTP 500 for https://trek.example.com/trips/4 (via: 1.1 proxy)",
PageErrorLog.describe("https://trek.example.com/trips/4#a?b", 500, " ", mapOf("Via" to "1.1 proxy")),
)
}
}
@@ -123,6 +123,21 @@ class WidgetSnapshotTest {
assertNull(snapshot.on(LocalDate.of(2026, 11, 9)).today)
}
@Test
fun keepsEveryStopOfTheDayItWasWrittenOn() {
val json = """{"trip":{"title":"T","start":"2026-11-06","end":"2026-11-07","path":"/trips/1"},
"today":{"date":"2026-11-06","dayLabel":"Day 1 of 2","stops":[
{"time":"09:00","name":"Museum","minutes":540},{"time":"21:00","name":"Concert","minutes":1260}]},
"days":[
{"date":"2026-11-06","dayLabel":"Day 1 of 2","stops":[{"time":"09:00","name":"Museum","minutes":540}]},
{"date":"2026-11-07","dayLabel":"Day 2 of 2","stops":[{"time":"10:00","name":"Harbour","minutes":600}]}
],
"labels":{}}"""
val snapshot = WidgetSnapshot.parse(json)!!
assertEquals(listOf("Museum", "Concert"), snapshot.on(LocalDate.of(2026, 11, 6)).today!!.stops.map { it.name })
assertEquals("Day 2 of 2", snapshot.on(LocalDate.of(2026, 11, 7)).today!!.dayLabel)
}
@Test
fun aSnapshotWithoutDaysReadsAsWritten() {
val snapshot = WidgetSnapshot.parse(WidgetSamples.json(running = true, now = today))!!
+10 -6
View File
@@ -2,7 +2,8 @@ import { expect, test, type Locator } from '@playwright/test';
// #2981: labels, category and status took the whole row, so a place with two or
// three long labels showed one letter of its name or none, and the status pill
// ran out of the card. Measured in a real browser because the layout is the bug.
// ran out of the card. The labels are tags now, shown as dots behind the name.
// Measured in a real browser because the layout is the bug.
const PLACES = [
{ name: 'Oceanario de Lisboa', labels: ['Core shortlist', 'Heritage specialist', 'Pair with another stop'] },
{ name: 'Cove of Ursa', labels: ['Heritage specialist', 'Pair with another stop'] },
@@ -83,11 +84,14 @@ for (const viewport of [
// The whole name fits: it is not cut to an ellipsis.
expect(await name.evaluate((el) => el.scrollWidth <= el.clientWidth + 1)).toBe(true);
await expectInside(row);
// Every label is either on the row or counted by its "+N" chip.
const shown = await row.locator('.col-lrow-label:not(.is-over)').count();
// Read without waiting: a row whose labels all fit has no "+N".
const [more] = await row.locator('.col-lrow-more').allTextContents();
expect(shown + (more ? Number(more.replace('+', '')) : 0)).toBe(place.labels.length);
// The labels are the place's tags: dots behind the name, every name in their label.
const dots = row.locator('.li .t [role="img"]:not(.col-lrow-caticon)');
if (place.labels.length === 0) {
await expect(dots).toHaveCount(0);
} else {
const named = ((await dots.getAttribute('aria-label')) ?? '').split(', ');
expect([...named].sort()).toEqual([...place.labels].sort());
}
}
// The map's label strip stays inside the map: whole, or folded into its button.
const topbar = page.locator('.col-map-topbar');
+9
View File
@@ -117,6 +117,15 @@ so look at three or four pictures from a subset run before starting it.
each run rebuilds it under the servers of the others. Give each run its own
`TREK_PLUGINS_DIR` and `TREK_PLUGINS_DATA_DIR` as well (the seed installs a
plugin), and its own Vite `cacheDir` when it starts a Vite of its own.
- More than three or four runs at once: build the client once (`npm run build`)
and set `E2E_WEB_PREVIEW=1` as well, so each run serves `dist/` with
`vite preview` instead of a dev server of its own. A dozen dev servers compiling
the app at the same time take the whole machine, and the login of the setup
step times out after 45 s. The pictures do not change: the guides drive the
same app.
- A mocked outside service (a photo library, an AI provider) is answered with
`page.context().route`, not `page.route`: once the service worker of the built
app controls the page, its requests no longer pass a page route.
- A plugin installed by a run lives in `server/data/plugins/`; the dev server
imports it on its next restart. Guides that install one uninstall it in `cleanup`.
- The trip's last day is the run day by construction (`e2e/dates.ts`: every
+290 -78
View File
@@ -2,8 +2,9 @@ import { test, expect, type Page, type Locator } from '@playwright/test'
import { clearNotices } from '../screenshots/shot'
import { captureGuide, captureHero, dismissReleaseNotice, beat, typeInto, settle, VIEWPORT, type GuideScript } from './guide'
import { ensureAdminFixtures, pluginPackage } from './fixtures'
import { deleteUser, resetDefaults } from './fixtures-admin'
import { clearOidc, configureOidc, deleteUser, putAppSettings, resetDefaults } from './fixtures-admin'
import { toggleAddon } from './external'
import { mockInstanceConnection, AI_KEY } from './fixtures-assistant'
import { adminContext, adminTabContexts, adminGuides } from '../../src/help/contexts/admin'
import type { HelpGuide } from '../../src/help/types'
@@ -16,14 +17,15 @@ import type { HelpGuide } from '../../src/help/types'
const TAB_OF: Record<string, string> = {
'admin-users': 'Users',
'admin-defaults': 'User Defaults',
'admin-defaults': 'Defaults',
'admin-config': 'Personalization',
'admin-settings': 'Settings',
// One help screen for the two tabs the old Settings tab became; the hero shows Security.
'admin-settings': 'Security',
'admin-addons': 'Addons',
'admin-plugins': 'Plugins',
'admin-storage': 'Storage',
'admin-notifications': 'Notifications',
'admin-mcp-tokens': 'MCP Access',
'admin-mcp-tokens': 'MCP',
'admin-github': 'GitHub',
'admin-backup': 'Backup',
'admin-audit': 'Audit',
@@ -35,24 +37,30 @@ const guide = (id: string): HelpGuide => {
return g
}
const sidebar = (page: Page) => page.locator('nav').filter({ has: page.getByRole('button', { name: 'User Defaults' }) }).first()
const sidebar = (page: Page) => page.locator('nav').filter({ has: page.getByRole('button', { name: 'Personalization' }) }).first()
/** The nearest card around an element: the admin cards are rounded-xl or rounded-2xl boxes, or a <section>. */
const cardOf = (el: Locator) => el.locator('xpath=ancestor::*[contains(@class,"rounded-xl") or contains(@class,"rounded-2xl") or self::section][1]')
/** An admin card by the text of its h2. */
const section = (page: Page, title: string | RegExp) => cardOf(page.locator('h2').filter({ hasText: title }).first())
/** A provider block under Settings, a <section> headed by an h3. */
const block = (page: Page, title: string) => page.locator('h3').filter({ hasText: new RegExp(`^${title}$`) }).first().locator('xpath=ancestor::section[1]')
/** A block inside a card (a provider, a nested section), a <section> headed by an h3. */
const block = (page: Page, title: string) => page.locator('h3').filter({ hasText: new RegExp(`^${title.replace(/[()]/g, '\\$&')}$`) }).first().locator('xpath=ancestor::section[1]')
/** One settings row (label, hint, control) by its label. */
const row = (scope: Locator, label: string) =>
scope.locator('label').filter({ hasText: new RegExp(`^${label}$`) }).first()
.locator('xpath=ancestor::div[contains(@class,"px-4") and contains(@class,"py-3")][1]')
const modal = (page: Page) => page.locator('.trek-modal-backdrop').last()
const dialogPanel = (page: Page) => modal(page).locator('> [role="presentation"], > div').first()
/** A row of the user table by its username. */
const userRow = (page: Page, username: string) => page.locator('table tbody tr').filter({ hasText: username }).first()
/** A labelled field of the Map card on User Defaults: its label and everything under it. */
/** A labelled field of the Map card on Defaults: its label and everything under it. */
const mapField = (page: Page, label: string) => section(page, /^Map$/).locator('label').filter({ hasText: label }).first().locator('xpath=..')
/** The Map engine row's label, which also holds its reset link once the engine is set. */
const engineLabel = (page: Page) => section(page, /^Map$/).locator('label').filter({ hasText: 'Map engine' }).first()
/** The TREK Places API card at the top of API Keys, found by its pill. */
const trekApiCard = (page: Page) => page.getByText('Recommended default', { exact: true }).first().locator('xpath=ancestor::div[contains(@class,"rounded-[14px]")][1]')
/** An addon tile by the addon's name. */
/** The TREK API block at the top of Place search and routing, found by its pill. */
const trekApiCard = (page: Page) => page.getByText('Recommended default', { exact: true }).first().locator('xpath=ancestor::section[1]')
/** An addon row by the addon's name. */
const tile = (page: Page, name: string) => page.locator('h4').filter({ hasText: new RegExp(`^${name}$`) }).first().locator('xpath=ancestor::article[1]')
const authCard = (page: Page) => section(page, 'Authentication Methods')
async function openAdmin(page: Page, tab: string): Promise<void> {
await page.goto('/admin')
@@ -68,8 +76,29 @@ async function openAdmin(page: Page, tab: string): Promise<void> {
await settle(page)
}
const opener = (contextId: string) => (page: Page) => openAdmin(page, TAB_OF[contextId])
/**
* The release list comes from GitHub through the server, which gives up after
* eight seconds; a slow answer leaves "Failed to load releases" in the picture,
* so the tab is opened again until the list is there.
*/
async function openGithub(page: Page): Promise<void> {
for (let attempt = 0; attempt < 4; attempt++) {
await openAdmin(page, 'GitHub')
const details = section(page, 'Release History').getByRole('button', { name: 'Show details' }).first()
const failed = page.getByText('Failed to load releases', { exact: true })
await expect(details.or(failed).first()).toBeVisible({ timeout: 30_000 })
if (await details.isVisible()) return settle(page)
}
throw new Error('GitHub did not answer with the release list')
}
const opener = (contextId: string) => (page: Page) => contextId === 'admin-github' ? openGithub(page) : openAdmin(page, TAB_OF[contextId])
const services = (page: Page) => openAdmin(page, 'Services')
const only = (target: (p: Page) => Locator) => ({ target })
/** The AI tile's settings dialog, named by its title. */
const aiDialog = (page: Page) => page.getByRole('dialog').filter({ hasText: 'Set up AI' }).last()
/** The admin's AI settings as the run found them, put back after the AI guide. */
let aiSettingsBefore: unknown = null
const SCRIPTS: Record<string, GuideScript> = {
// ── Users ────────────────────────────────────────────────────────────────
@@ -92,7 +121,7 @@ const SCRIPTS: Record<string, GuideScript> = {
await typeInto(p, modal(p).getByPlaceholder('Password'), 'Lena12345!')
await beat(p, 300)
},
target: p => modal(p).locator('> [role="presentation"], > div').first(),
target: p => dialogPanel(p),
},
{
target: p => modal(p).getByRole('button', { name: 'Create User' }),
@@ -120,7 +149,7 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
{
target: p => modal(p).locator('> [role="presentation"], > div').first(),
target: p => dialogPanel(p),
act: async p => {
await modal(p).getByRole('button', { name: 'Cancel' }).click()
await expect(modal(p)).toHaveCount(0)
@@ -146,7 +175,7 @@ const SCRIPTS: Record<string, GuideScript> = {
await modal(p).getByRole('button', { name: '14d', exact: true }).click()
await beat(p, 300)
},
target: p => modal(p).locator('> [role="presentation"], > div').first(),
target: p => dialogPanel(p),
act: async p => {
await modal(p).getByRole('button', { name: 'Create & Copy' }).click()
await expect(modal(p)).toHaveCount(0)
@@ -169,14 +198,14 @@ const SCRIPTS: Record<string, GuideScript> = {
steps: [
{
prepare: async p => {
const row = section(p, 'Permission Settings').getByText('Delete trips', { exact: true }).locator('xpath=../..')
const permRow = row(section(p, 'Permission Settings'), 'Delete trips')
// The select's trigger is the row's only button; its options are buttons too.
await row.locator('button').first().click()
await permRow.locator('button').first().click()
await p.getByRole('button', { name: 'Admin only', exact: true }).last().click()
await expect(row.getByText('customized')).toBeVisible({ timeout: 10_000 })
await expect(permRow.getByText('customized')).toBeVisible({ timeout: 10_000 })
await settle(p)
},
target: p => section(p, 'Permission Settings').getByText('Delete trips', { exact: true }).locator('xpath=../..'),
target: p => row(section(p, 'Permission Settings'), 'Delete trips'),
},
{
target: p => section(p, 'Permission Settings').getByRole('button', { name: 'Save', exact: true }),
@@ -189,7 +218,7 @@ const SCRIPTS: Record<string, GuideScript> = {
],
},
// ── User Defaults ────────────────────────────────────────────────────────
// ── Defaults ─────────────────────────────────────────────────────────────
'default-user-settings': {
guide: guide('default-user-settings'),
start: opener('admin-defaults'),
@@ -203,7 +232,9 @@ const SCRIPTS: Record<string, GuideScript> = {
await expect(section(p, 'Default User Settings').locator('button').filter({ hasText: /^reset$/ })).toBeVisible({ timeout: 10_000 })
await settle(p)
},
target: p => section(p, 'Default User Settings').locator('label').filter({ hasText: 'Color Mode' }).locator('xpath=..'),
// The whole row: its name with the reset link, and the choice on the right.
target: p => section(p, 'Default User Settings').locator('label').filter({ hasText: 'Color Mode' }).first()
.locator('xpath=ancestor::div[contains(@class,"px-4") and contains(@class,"py-3")][1]'),
act: async p => {
await section(p, 'Default User Settings').locator('button').filter({ hasText: /^reset$/ }).first().click()
await expect(section(p, 'Default User Settings').locator('button').filter({ hasText: /^reset$/ })).toHaveCount(0, { timeout: 10_000 })
@@ -249,6 +280,7 @@ const SCRIPTS: Record<string, GuideScript> = {
// Typed, never committed: the field saves on blur only when the value changed,
// and emptying it first leaves the saved value (none) as it was.
steps: [
only(p => section(p, /^Routing$/)),
{
prepare: async p => {
await typeInto(p, p.getByLabel('Own routing engine', { exact: true }), 'https://osrm.example.org')
@@ -319,7 +351,7 @@ const SCRIPTS: Record<string, GuideScript> = {
await settle(p)
},
// The new category opens in a dialog, its name in the dialog's head.
target: p => modal(p).locator('> [role="presentation"], > div').first(),
target: p => dialogPanel(p),
act: async p => {
await modal(p).getByRole('button', { name: 'Cancel' }).click()
await expect(p.getByPlaceholder('Category name')).toHaveCount(0)
@@ -358,7 +390,7 @@ const SCRIPTS: Record<string, GuideScript> = {
await expect(modal(p).getByRole('textbox', { name: 'Holiday name' }).first()).toHaveValue('Autumn break', { timeout: 10_000 })
await settle(p)
},
target: p => modal(p).locator('> [role="presentation"], > div').first(),
target: p => dialogPanel(p),
act: async p => {
await modal(p).getByRole('button', { name: 'Cancel' }).click()
await expect(modal(p)).toHaveCount(0)
@@ -367,23 +399,29 @@ const SCRIPTS: Record<string, GuideScript> = {
],
},
// ── Settings ─────────────────────────────────────────────────────────────
// ── Security ─────────────────────────────────────────────────────────────
'auth-methods': {
guide: guide('auth-methods'),
start: opener('admin-settings'),
// The SSO rows exist only once OIDC is configured, so the guide sets an
// issuer and a client id up front and takes them away again afterwards.
start: async p => {
await configureOidc(p.request)
await openAdmin(p, 'Security')
await expect(row(authCard(p), 'SSO Login')).toBeVisible({ timeout: 10_000 })
},
steps: [
only(p => section(p, 'Authentication Methods').getByText('Password Login', { exact: true }).locator('xpath=../..')),
// The SSO rows exist only once OIDC is configured; the run shows where that happens.
only(p => section(p, 'Single Sign-On (OIDC)')),
only(p => section(p, 'Require 2FA')),
only(p => row(authCard(p), 'Password Login')),
only(p => row(authCard(p), 'SSO Auto-Provisioning')),
only(p => row(authCard(p), 'Require 2FA')),
],
cleanup: p => clearOidc(p.request),
},
'admin-passkeys': {
guide: guide('admin-passkeys'),
start: opener('admin-settings'),
steps: [
// Not flipped: the switch saves at once, and the seed keeps passkeys off.
only(p => section(p, 'Passkey login').getByRole('button', { name: 'Enable passkey login' }).locator('xpath=ancestor::div[contains(@class,"divide-y")][1]')),
only(p => row(authCard(p), 'Enable passkey login')),
only(p => section(p, 'Passkey login')),
],
},
@@ -391,41 +429,36 @@ const SCRIPTS: Record<string, GuideScript> = {
guide: guide('oidc'),
start: opener('admin-settings'),
steps: [
only(p => section(p, 'Single Sign-On (OIDC)')),
only(p => section(p, 'Authentication Methods')),
],
},
'instance-keys': {
guide: guide('instance-keys'),
start: opener('admin-settings'),
steps: [
only(p => trekApiCard(p)),
{
prepare: async p => {
const details = p.locator('details').filter({ hasText: 'What the key may be used for' })
if (!(await details.evaluate(el => (el as HTMLDetailsElement).open))) await details.locator('summary').click()
await settle(p)
const card = section(p, 'Single Sign-On (OIDC)')
await typeInto(p, card.locator('#oidc-display-name'), 'Authentik')
await typeInto(p, card.locator('#oidc-issuer'), 'https://auth.example.org/application/o/trek/')
await typeInto(p, card.locator('#oidc-client-id'), 'trek')
await typeInto(p, card.locator('#oidc-client-secret'), 'a-long-client-secret')
await beat(p, 300)
},
target: p => section(p, 'Single Sign-On (OIDC)'),
hover: async p => { await section(p, 'Single Sign-On (OIDC)').getByRole('button', { name: 'Save', exact: true }).hover() },
act: async p => {
await section(p, 'Single Sign-On (OIDC)').getByRole('button', { name: 'Save', exact: true }).click()
await expect.poll(async () => {
const res = await p.request.get('/api/admin/oidc')
return ((await res.json()) as { client_id?: string }).client_id
}, { timeout: 10_000 }).toBe('trek')
},
// The whole Google block: key, Test and the fold opened under it.
target: p => block(p, 'Google Maps API Key'),
},
only(p => block(p, 'Unsplash API Key')),
],
},
'places-transit': {
guide: guide('places-transit'),
start: opener('admin-settings'),
steps: [
only(p => block(p, 'Transit Provider')),
only(p => block(p, 'Place search provider')),
],
},
'file-types': {
guide: guide('file-types'),
start: opener('admin-settings'),
steps: [
only(p => section(p, 'Allowed File Types')),
{
// The card and the sign-in rows read the configuration when the page loads.
prepare: async p => {
await openAdmin(p, 'Security')
await expect(row(authCard(p), 'SSO Login')).toBeVisible({ timeout: 10_000 })
},
target: p => row(authCard(p), 'SSO Login'),
},
only(p => row(authCard(p), 'Go straight to SSO')),
],
cleanup: p => clearOidc(p.request),
},
'rotate-jwt-secret': {
guide: guide('rotate-jwt-secret'),
@@ -440,7 +473,7 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
{
target: p => modal(p).locator('> [role="presentation"], > div').first(),
target: p => dialogPanel(p),
// Never confirmed: rotating would sign the run itself out.
hover: async p => { await modal(p).getByRole('button', { name: 'Rotate & Log out' }).hover() },
act: async p => {
@@ -451,6 +484,33 @@ const SCRIPTS: Record<string, GuideScript> = {
],
},
// ── Services ─────────────────────────────────────────────────────────────
'instance-keys': {
guide: guide('instance-keys'),
start: services,
steps: [
only(p => trekApiCard(p)),
// The whole Google block: key, Test and what the key may be used for under it.
only(p => block(p, 'Google Maps API Key')),
only(p => block(p, 'Unsplash API Key')),
],
},
'places-transit': {
guide: guide('places-transit'),
start: services,
steps: [
only(p => block(p, 'Transit Provider')),
only(p => block(p, 'Place search provider')),
],
},
'file-types': {
guide: guide('file-types'),
start: services,
steps: [
only(p => section(p, 'Allowed File Types')),
],
},
// ── Addons ───────────────────────────────────────────────────────────────
'toggle-addon': {
guide: guide('toggle-addon'),
@@ -475,11 +535,12 @@ const SCRIPTS: Record<string, GuideScript> = {
guide: guide('document-providers'),
start: opener('admin-addons'),
steps: [
// The tile with its shelf: Documents is on in the seed, so the five rows are drawn.
// The row with its options: Documents is on in the seed, so the five stores are drawn.
only(p => tile(p, 'Documents')),
{
// The row's switch is a ToggleSwitch whose aria-label is the row's title.
target: p => tile(p, 'Documents').getByRole('button', { name: 'Nextcloud', exact: true }),
// The whole row, so its name is in the frame; the switch's aria-label is the row's title.
target: p => tile(p, 'Documents').getByRole('button', { name: 'Nextcloud', exact: true }).locator('xpath=ancestor::li[1]'),
hover: async p => { await tile(p, 'Documents').getByRole('button', { name: 'Nextcloud', exact: true }).hover() },
act: async p => {
const toggle = tile(p, 'Documents').getByRole('button', { name: 'Nextcloud', exact: true })
await toggle.click()
@@ -491,6 +552,157 @@ const SCRIPTS: Record<string, GuideScript> = {
// Back to the seed, where every store is off; the files run switches this one on for itself.
cleanup: p => toggleAddon(p.request, 'nextcloud', false),
},
'mail-import-setup': {
guide: guide('mail-import-setup'),
start: opener('admin-addons'),
steps: [
{
target: p => tile(p, 'Booking mail import'),
act: async p => {
const toggle = tile(p, 'Booking mail import').getByRole('button', { name: 'Import booking mails' })
await toggle.click()
await expect(toggle).toHaveAttribute('aria-pressed', 'true', { timeout: 10_000 })
await expect(p.getByRole('button', { name: 'Set up mail import' })).toBeVisible({ timeout: 10_000 })
await settle(p)
},
},
{
target: p => p.getByRole('button', { name: 'Set up mail import' }),
act: async p => {
await p.getByRole('button', { name: 'Set up mail import' }).click()
await expect(modal(p)).toBeVisible()
await settle(p)
},
},
{
// IMAP draws every field the step names; nothing is saved, so no mailbox is asked.
prepare: async p => {
await modal(p).getByRole('button', { name: 'Upload only' }).click()
await p.getByRole('button', { name: 'IMAP mailbox', exact: true }).last().click()
await expect(modal(p).locator('#mail-imap-host')).toBeVisible()
await typeInto(p, modal(p).locator('#mail-template'), 'trek+{token}@example.org')
await typeInto(p, modal(p).locator('#mail-imap-host'), 'imap.example.org')
await typeInto(p, modal(p).locator('#mail-imap-user'), 'trek@example.org')
await typeInto(p, modal(p).locator('#mail-imap-pass'), 'mailbox-password')
await beat(p, 300)
},
target: p => dialogPanel(p),
},
{
target: p => modal(p).getByRole('button', { name: 'Test connection' }).locator('xpath=..'),
hover: async p => { await modal(p).getByRole('button', { name: 'Save', exact: true }).hover() },
act: async p => {
await modal(p).getByRole('button', { name: 'Close', exact: true }).last().click()
// The setup asks before it drops what was typed.
await p.getByRole('button', { name: 'Discard', exact: true }).click()
await expect(modal(p)).toHaveCount(0)
},
},
],
cleanup: p => putAppSettings(p.request, { mail_ingest_enabled: false }),
},
'ai-setup': {
guide: guide('ai-setup'),
// The key is never tested against a provider: fixtures-assistant.ts answers for the connection.
start: async p => {
const res = await p.request.get('/api/admin/ai/settings')
aiSettingsBefore = res.ok() ? await res.json() : null
await toggleAddon(p.request, 'ai_assistant', false)
await mockInstanceConnection(p)
await openAdmin(p, TAB_OF['admin-addons'])
},
steps: [
{
target: p => tile(p, 'AI'),
act: async p => {
const toggle = tile(p, 'AI').getByRole('button', { name: 'AI Assistant', exact: true })
await toggle.click()
await expect(toggle).toHaveAttribute('aria-pressed', 'true', { timeout: 10_000 })
await expect(tile(p, 'AI').getByRole('button', { name: 'Set up AI' })).toBeVisible({ timeout: 10_000 })
await settle(p)
},
},
{
target: p => tile(p, 'AI').getByRole('button', { name: 'Set up AI' }),
act: async p => {
await tile(p, 'AI').getByRole('button', { name: 'Set up AI' }).click()
await expect(aiDialog(p).getByRole('radiogroup', { name: 'Who pays' })).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
{
target: p => aiDialog(p).getByRole('radiogroup', { name: 'Who pays' }).locator('xpath=..'),
hover: async p => { await aiDialog(p).getByRole('radio', { name: 'I pay, own allowed' }).hover() },
act: async p => {
await aiDialog(p).getByRole('radio', { name: 'I pay, own allowed' }).click()
await expect(aiDialog(p).getByRole('radio', { name: 'I pay, own allowed' })).toHaveAttribute('aria-checked', 'true')
await settle(p)
},
},
{
prepare: async p => {
await aiDialog(p).getByRole('button', { name: /^Paste an API key/ }).click()
await typeInto(p, aiDialog(p).getByPlaceholder('Paste your key here'), AI_KEY)
await expect(aiDialog(p).getByText('Detected: Anthropic')).toBeVisible()
await settle(p)
},
target: p => aiDialog(p).getByText('Connection for everyone', { exact: true }).locator('xpath=..'),
hover: async p => { await aiDialog(p).getByRole('button', { name: 'Connect', exact: true }).hover() },
act: async p => {
await aiDialog(p).getByRole('button', { name: 'Connect', exact: true }).click()
await expect(aiDialog(p).getByRole('button', { name: 'Remove connection' })).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
{
target: p => aiDialog(p).getByRole('button', { name: 'Remove connection' }).locator('xpath=ancestor::div[contains(@class,"p-3")][1]'),
act: async p => {
await aiDialog(p).getByRole('button', { name: 'AI Assistant', exact: true }).click()
await expect(aiDialog(p).getByText('Keep chats', { exact: true })).toBeVisible({ timeout: 10_000 })
await settle(p)
},
},
only(p => aiDialog(p).getByText('Keep chats', { exact: true }).locator('xpath=ancestor::div[contains(@class,"gap-4")][1]')),
],
cleanup: async p => {
if (aiSettingsBefore) await p.request.put('/api/admin/ai/settings', { data: aiSettingsBefore })
await toggleAddon(p.request, 'ai_assistant', false)
},
},
'paddle-water-data': {
guide: guide('paddle-water-data'),
start: opener('admin-addons'),
steps: [
{
target: p => p.getByRole('button', { name: /^Paddle water data/ }),
act: async p => {
await p.getByRole('button', { name: /^Paddle water data/ }).click()
await expect(modal(p)).toBeVisible()
await expect(modal(p).getByTestId('paddle-auto-load')).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
only(p => modal(p).getByTestId('paddle-auto-load')),
{
// A search shows the hits with their Add; Geofabrik's list comes through the server.
prepare: async p => {
const field = modal(p).getByPlaceholder('Search Geofabrik, for example Oberpfalz')
await typeInto(p, field, 'Oberpfalz')
const hit = modal(p).getByRole('button', { name: 'Add', exact: true }).first()
const failed = modal(p).getByRole('alert')
await expect(hit.or(failed).first()).toBeVisible({ timeout: 30_000 })
// Without Geofabrik the field stays empty rather than showing an error.
if (!(await hit.isVisible())) await field.fill('')
await settle(p)
},
target: p => modal(p).getByPlaceholder('Search Geofabrik, for example Oberpfalz').locator('xpath=ancestor::div[contains(@class,"gap-2")][1]'),
act: async p => {
await modal(p).getByRole('button', { name: 'Close', exact: true }).last().click()
await expect(modal(p)).toHaveCount(0)
},
},
],
},
// ── Plugins ──────────────────────────────────────────────────────────────
'install-plugin': {
@@ -518,9 +730,9 @@ const SCRIPTS: Record<string, GuideScript> = {
{
target: p => p.getByTestId('plugin-row-menu-btn-trip-doctor').locator('xpath=ancestor::div[contains(@class,"group") and contains(@class,"px-3.5")][1]'),
act: async p => {
const row = p.getByTestId('plugin-row-menu-btn-trip-doctor').locator('xpath=ancestor::div[contains(@class,"group") and contains(@class,"px-3.5")][1]')
await row.getByRole('button', { name: 'Enable plugin' }).click()
await expect(row.getByText('Active', { exact: true })).toBeVisible({ timeout: 30_000 })
const pluginRow = p.getByTestId('plugin-row-menu-btn-trip-doctor').locator('xpath=ancestor::div[contains(@class,"group") and contains(@class,"px-3.5")][1]')
await pluginRow.getByRole('button', { name: 'Enable plugin' }).click()
await expect(pluginRow.getByText('Active', { exact: true })).toBeVisible({ timeout: 30_000 })
await settle(p)
},
},
@@ -555,7 +767,7 @@ const SCRIPTS: Record<string, GuideScript> = {
await settle(p)
},
// The new backend opens in a dialog.
target: p => modal(p).locator('> [role="presentation"], > div').first(),
target: p => dialogPanel(p),
act: async p => {
await modal(p).getByRole('button', { name: 'Cancel' }).click()
await expect(modal(p).getByText('Add backend', { exact: true })).toHaveCount(0)
@@ -573,19 +785,19 @@ const SCRIPTS: Record<string, GuideScript> = {
guide: guide('channels-instance'),
start: opener('admin-notifications'),
steps: [
only(p => section(p, 'Email (SMTP)')),
only(p => section(p, /^Ntfy$/)),
only(p => section(p, 'Trip Reminders')),
only(p => block(p, 'Email (SMTP)')),
only(p => section(p, /^Channels$/).locator('div.divide-y').first()),
only(p => row(section(p, /^Channels$/), 'Trip Reminders')),
],
},
'admin-channels': {
guide: guide('admin-channels'),
start: opener('admin-notifications'),
steps: [
only(p => section(p, 'Admin Ntfy')),
only(p => section(p, 'Admin Ntfy').getByRole('button', { name: 'Send test ntfy' })),
// The admin matrix: the card whose title is the tab's own name.
only(p => section(p, /^Notifications$/)),
only(p => section(p, 'Admin alerts')),
only(p => block(p, 'Admin Ntfy').getByRole('button', { name: 'Send test ntfy' })),
// The admin matrix at the foot of the same card.
only(p => section(p, 'Admin alerts').locator('div.overflow-x-auto').first()),
],
},
'notification-defaults': {
@@ -598,7 +810,7 @@ const SCRIPTS: Record<string, GuideScript> = {
],
},
// ── MCP Access ───────────────────────────────────────────────────────────
// ── MCP ──────────────────────────────────────────────────────────────────
'mcp-tokens-admin': {
guide: guide('mcp-tokens-admin'),
start: opener('admin-mcp-tokens'),
@@ -660,11 +872,11 @@ const SCRIPTS: Record<string, GuideScript> = {
target: p => section(p, 'Auto-Backup').getByRole('button', { name: /^Enable auto-backup/ }).locator('xpath=ancestor::label[1]'),
act: async p => {
await section(p, 'Auto-Backup').getByRole('button', { name: /^Enable auto-backup/ }).click()
await expect(section(p, 'Auto-Backup').getByText('Interval', { exact: true })).toBeVisible({ timeout: 10_000 })
await expect(section(p, 'Auto-Backup').getByText('Interval', { exact: true }).first()).toBeVisible({ timeout: 10_000 })
await settle(p)
},
},
only(p => section(p, 'Auto-Backup').getByText('Delete old backups after', { exact: true }).locator('xpath=..')),
only(p => row(section(p, 'Auto-Backup'), 'Delete old backups after')),
],
cleanup: async p => {
await section(p, 'Auto-Backup').getByRole('button', { name: /^Enable auto-backup/ }).click()
+26 -6
View File
@@ -236,6 +236,13 @@ async function excludedTours(page: Page): Promise<Set<number>> {
/** What was left out before the tour guide ran, so `cleanup` counts exactly its own change again. */
let excludedBefore = new Set<number>()
/** Why the Dawarich connection could not be made in `beforeAll`, if it could not. */
let dawarichMissing: Error | null = null
async function openAtlasWithDawarich(page: Page): Promise<void> {
if (dawarichMissing) throw dawarichMissing
await openAtlas(page)
}
const SCRIPTS: Record<string, GuideScript> = {
'mark-country': {
guide: guide('mark-country'),
@@ -364,6 +371,9 @@ const SCRIPTS: Record<string, GuideScript> = {
await expect(detailCard(p, 'Portugal')).toBeVisible()
},
target: p => detailCard(p, 'Portugal'),
// On the name with its Planned label: the centre of the card is the
// Places badge, whose tooltip covered the trip chip under it.
hover: p => panel(p).locator('p.text-sm.font-bold').filter({ hasText: 'Portugal' }).hover(),
},
],
},
@@ -607,7 +617,9 @@ const SCRIPTS: Record<string, GuideScript> = {
// The side column: the Planned and Recorded badges, what does not
// count yet, and the i whose tooltip states the rule.
target: p => showToursButton(p).locator('xpath=..'),
hover: p => tourPane(p).getByRole('button', { name: 'My tour activities', exact: true }).hover(),
// On Still ahead, whose tooltip is one short line. The i's tooltip is the
// whole rule in one wide line, and it covered the badges the step names.
hover: p => tourPane(p).getByText('Still ahead', { exact: true }).hover(),
},
{
target: showToursButton,
@@ -619,7 +631,9 @@ const SCRIPTS: Record<string, GuideScript> = {
},
{
target: p => firstTourRow(p),
hover: p => firstTourRow(p).locator('[data-testid^="tour-activity-toggle-"]').hover(),
// On the tour's name, which has no tooltip: the button's own tooltip ran
// past the frame's edge and over the row below.
hover: p => firstTourRow(p).locator('span.font-semibold').first().hover(),
act: async p => {
// Found again by its own id afterwards: the list may sort a left-out tour elsewhere.
const id = await firstTourRow(p).getAttribute('data-testid')
@@ -644,7 +658,7 @@ const SCRIPTS: Record<string, GuideScript> = {
'dawarich-countries': {
guide: guide('dawarich-countries'),
start: async p => {
await openAtlas(p)
await openAtlasWithDawarich(p)
visitedBefore = await visitedCodes(p)
},
steps: [
@@ -708,7 +722,7 @@ const SCRIPTS: Record<string, GuideScript> = {
'dawarich-wishes': {
guide: guide('dawarich-wishes'),
start: openAtlas,
start: openAtlasWithDawarich,
steps: [
{
target: p => tile(p, 'Wishlist'),
@@ -773,8 +787,14 @@ test.beforeAll(async ({ request }) => {
const { ensureToursFixtures } = await import('./tour-fixtures')
await ensureToursFixtures(request)
// After the Atlas fixtures: the connection adds two wishes with coordinates
// (Fushimi Inari Taisha, Wadi Rum) to the list the fixtures create.
await ensureDawarichConnection(request)
// (Fushimi Inari Taisha, Wadi Rum) to the list the fixtures create. Without
// media.env it cannot be made; the two Dawarich guides then fail at their
// start with the reason, and every other guide of the file still runs.
try {
await ensureDawarichConnection(request)
} catch (err) {
dawarichMissing = err instanceof Error ? err : new Error(String(err))
}
})
test.afterAll(async ({ request }) => {
+29
View File
@@ -862,6 +862,35 @@ const SCRIPTS: Record<string, GuideScript> = {
],
},
'collection-map-lock': {
guide: guide('collection-map-lock'),
start: p => openList(p, KYOTO),
steps: [
{
target: p => mapShell(p).getByTestId('map-lock-pill'),
act: async p => {
await mapShell(p).getByTestId('map-lock-pill').click()
await expect(mapShell(p).getByRole('button', { name: 'Let the map follow the selection' })).toBeVisible()
await blurFocus(p)
await settle(p)
},
},
{
target: p => placeRows(p).nth(1),
act: async p => {
await placeRows(p).nth(1).click()
await expect(detail(p)).toBeVisible()
// Locked, the map keeps the frame of the whole list, so every pin stays in view.
await pageReady(p)
},
},
],
cleanup: async p => {
const unlock = mapShell(p).getByRole('button', { name: 'Let the map follow the selection' })
if (await unlock.count()) await unlock.click()
},
},
'tour-collection-add-to-trip': {
guide: guide('tour-collection-add-to-trip'),
start: async p => {
+23 -2
View File
@@ -468,6 +468,24 @@ const SCRIPTS: Record<string, GuideScript> = {
],
},
'travel-stats': {
guide: guide('travel-stats'),
start: async p => {
await openDashboard(p)
// The flags load from flagcdn; wait for them so the card is not half drawn.
await expect(p.locator('.atlas-card.passport .passport-flags img').first()).toBeVisible({ timeout: 15_000 })
await settle(p)
},
steps: [
{
target: p => p.locator('.atlas-card.passport'),
},
{
target: p => p.locator('section.atlas'),
},
],
},
widgets: {
guide: guide('widgets'),
start: openDashboard,
@@ -497,8 +515,11 @@ const SCRIPTS: Record<string, GuideScript> = {
await p.getByText('Dashboard widgets', { exact: true }).first().scrollIntoViewIfNeeded()
await beat(p, 400)
},
// The Section card itself: the nearest rounded container around its heading.
target: p => p.getByText('Dashboard widgets', { exact: true }).first().locator('xpath=ancestor::section[1]'),
// The Desktop block of the card (its groups and the Right sidebar switch). The
// whole card with its Mobile half is taller than the frame, and the settings
// pane scrolls on its own, so its top ended up under the navigation bar.
target: p => p.getByText('Dashboard widgets', { exact: true }).first().locator('xpath=ancestor::section[1]')
.getByText('Desktop', { exact: true }).locator('xpath=ancestor::section[1]'),
},
{
target: p => p.getByRole('link', { name: 'My Trips' }),
+31
View File
@@ -27,3 +27,34 @@ export async function resetDefaults(api: APIRequestContext, keys: string[]): Pro
if (!res.ok()) throw new Error(`could not reset the default "${key}": ${res.status()} ${await res.text()}`);
}
}
/** Writes instance settings the way the admin page does (PUT /api/auth/app-settings). */
export async function putAppSettings(api: APIRequestContext, patch: Record<string, string | boolean>): Promise<void> {
const res = await api.put('/api/auth/app-settings', { data: patch });
if (!res.ok()) throw new Error(`could not save the app settings: ${res.status()} ${await res.text()}`);
}
const OIDC_EMPTY = { issuer: '', client_id: '', client_secret: '', display_name: '', discovery_url: '' };
/**
* An issuer and a client id, which is all TREK needs to call OIDC configured and
* draw the SSO rows. Nothing is fetched from the issuer on save.
*/
export async function configureOidc(api: APIRequestContext): Promise<void> {
const res = await api.put('/api/admin/oidc', {
data: {
...OIDC_EMPTY,
issuer: 'https://auth.example.org/application/o/trek/',
client_id: 'trek',
client_secret: 'a-long-client-secret',
display_name: 'Authentik',
},
});
if (!res.ok()) throw new Error(`could not configure OIDC: ${res.status()} ${await res.text()}`);
}
/** Back to the seed, where no identity provider is set. Password login is on there, so the server allows it. */
export async function clearOidc(api: APIRequestContext): Promise<void> {
const res = await api.put('/api/admin/oidc', { data: OIDC_EMPTY });
if (!res.ok()) throw new Error(`could not clear OIDC: ${res.status()} ${await res.text()}`);
}
+410
View File
@@ -0,0 +1,410 @@
import type { APIRequestContext, Page, Route } from '@playwright/test';
import { toggleAddon } from './external';
import { seededTrip } from './fixtures';
import { PICTURE_DAY } from './guide';
/**
* What the AI guides need: an AI provider that answers. The run has none and
* must not depend on one, so the browser's side of the conversation is
* answered here instead, with `page.context().route` (a route on the page
* alone misses what the PWA's service worker fetches, see the Immich mock in
* `journey.guide.ts`):
*
* - `/api/ai/status`: whether the assistant runs and on whose connection,
* - `/api/ai/connection` and `/api/ai/models`: a person's own key, taken as good,
* - `/api/admin/ai/connection` and `/api/admin/ai/models`: the admin's,
* - `/api/trips/:id/assistant/...`: the chat, its decisions and sharing.
*
* What the provider would write is fixed below, short and in the shape the
* server streams it (`uiStreamChunkSchema`). What a decision changes in the
* trip is done for real through the REST API, so the plan behind the window
* shows the new place the way it would after a real Apply, and the answer
* shared to the trip chat is a real chat message. Cleanup takes both away.
*
* Only the addons are switched for real (the AI tile and the Integrations card
* show by them); the admin's AI settings are the server's own.
*/
const PROVIDER = { kind: 'anthropic', host: 'api.anthropic.com' } as const;
const MODEL = 'claude-sonnet-4-5';
export const AI_KEY = 'sk-ant-api03-hm7Rk2vLq9Tz4Wc8Yp1Nd6Fs3Bx5Gj0Ue-x7Qa';
const HINT = '…x7Qa';
const MODELS = {
models: [
{ id: MODEL, label: 'Claude Sonnet 4.5', supportsTools: true, recommended: true },
{ id: 'claude-haiku-4-5', label: 'Claude Haiku 4.5', supportsTools: true },
{ id: 'claude-opus-4-1', label: 'Claude Opus 4.1', supportsTools: true },
],
};
const RETENTION = { mode: 'days', days: 90 } as const;
/** The assistant on the admin's connection, as everyone on the instance sees it. */
function instanceStatus() {
return {
available: true,
policy: 'instance_or_user',
canConnectOwn: true,
effective: { source: 'instance', kind: PROVIDER.kind, model: MODEL, host: PROVIDER.host, paidBy: 'instance' },
own: null,
instance: { kind: PROVIDER.kind, model: MODEL, host: PROVIDER.host },
quota: { used: 3, limit: 50 },
privacyAcked: true,
retention: RETENTION,
openrouterOAuth: false,
};
}
/** Everyone brings their own: nothing yet, or the key the guide connected. */
function ownStatus(connected: boolean) {
const own = { scope: 'user', kind: PROVIDER.kind, model: MODEL, hint: HINT, status: 'ok', host: PROVIDER.host };
return {
available: connected,
policy: 'user',
canConnectOwn: true,
effective: connected
? { source: 'user', kind: PROVIDER.kind, model: MODEL, host: PROVIDER.host, paidBy: 'user' }
: null,
own: connected ? own : null,
instance: null,
quota: null,
privacyAcked: connected,
retention: RETENTION,
openrouterOAuth: false,
};
}
/** A server-sent event stream as the server writes it: one `data:` per chunk, closed by [DONE]. */
function sse(chunks: unknown[]): string {
return [...chunks.map((c) => `data: ${JSON.stringify(c)}\n\n`), 'data: [DONE]\n\n'].join('');
}
const fulfillStream = (route: Route, chunks: unknown[]) =>
route.fulfill({
status: 200,
contentType: 'text/event-stream',
headers: { 'cache-control': 'no-cache' },
body: sse(chunks),
});
const pathOf = (route: Route) => new URL(route.request().url()).pathname;
// ── Settings: a person's own key ─────────────────────────────────────────────
/** Settings, Integrations: the AI card with nothing connected, and a key that connects. */
export async function mockOwnConnection(page: Page): Promise<void> {
await toggleAddon(page.request, 'ai_assistant', true);
let connected = false;
await page.context().route(/\/api\/ai\/(status|connection|models|privacy-ack)(\/.*)?(\?.*)?$/, async (route) => {
const path = pathOf(route);
const method = route.request().method();
if (path.endsWith('/ai/status')) return route.fulfill({ json: ownStatus(connected) });
if (path.endsWith('/ai/models')) return route.fulfill({ json: MODELS });
if (path.endsWith('/ai/privacy-ack')) return route.fulfill({ json: { success: true } });
if (path.endsWith('/ai/connection') && method === 'PUT') {
connected = true;
return route.fulfill({ json: ownStatus(true).own });
}
if (path.endsWith('/ai/connection') && method === 'DELETE') {
connected = false;
return route.fulfill({ json: { success: true } });
}
return route.fallback();
});
}
export async function resetOwnConnection(api: APIRequestContext): Promise<void> {
await toggleAddon(api, 'ai_assistant', false);
}
// ── Admin: the connection for everyone ──────────────────────────────────────
/** Admin, Addons: the AI dialog with no connection for everyone yet, and a key that connects. */
export async function mockInstanceConnection(page: Page): Promise<void> {
let connected = false;
const view = () => ({
connection: connected
? {
scope: 'instance',
kind: PROVIDER.kind,
model: MODEL,
hint: HINT,
status: 'ok',
host: PROVIDER.host,
baseUrl: null,
}
: null,
prefill: null,
});
await page.context().route(/\/api\/admin\/ai\/(connection|models)(\/.*)?(\?.*)?$/, async (route) => {
const path = pathOf(route);
const method = route.request().method();
if (path.endsWith('/admin/ai/models')) return route.fulfill({ json: MODELS });
if (method === 'PUT') connected = true;
if (method === 'DELETE') {
connected = false;
return route.fulfill({ json: { success: true } });
}
return route.fulfill({ json: view() });
});
}
// ── Trip: the chat ───────────────────────────────────────────────────────────
/** What the guide asks, and the place the answer suggests for day 1. */
export const QUESTION = 'Where should we have dinner near Senso-ji on day 1?';
export const SUGGESTED = {
name: 'Asakusa Imahan',
address: '3-1-12 Nishiasakusa, Taito City, Tokyo',
lat: 35.7127,
lng: 139.7905,
notes: 'Sukiyaki dinner, around 19:00. Book a table a day ahead.',
// Its own front on Kokusai-dori (Wikimedia Commons, CC0); the lookup by position found a car park nearby.
image:
'https://thumb.wikimedia.org/wikipedia/commons/thumb/8/86/Asakusa_Imahan_Kokusai-dori_main_branch.jpg/960px-Asakusa_Imahan_Kokusai-dori_main_branch.jpg',
};
const THREAD = { id: 901, title: 'Dinner near Senso-ji' };
const MESSAGE_ID = 'msg-9002';
const QUESTION_ID = 'msg-9001';
const CALL_ID = 'call-help-imahan-0001';
const ANSWER =
'**Asakusa Imahan** is a good fit: a sukiyaki restaurant known for its wagyu, a short walk from Senso-ji. ' +
'Your day ends at teamLab Planets at 16:00, so a table at 19:00 leaves time to get back to Asakusa.\n\n' +
'It fills up in the evening, so book a day ahead. Shall I put it on day 1?';
const FOLLOW_UPS = [
'What else is near Senso-ji?',
'Is day 1 too packed now?',
'Where can we have breakfast in Asakusa?',
];
/** What the mock made for real, so cleanup can take it away again. */
export interface AssistantRun {
placeIds: number[];
chatMessageIds: number[];
}
const listIn = <T>(body: unknown, key: string): T[] =>
Array.isArray(body) ? (body as T[]) : (((body as Record<string, unknown>)?.[key] as T[] | undefined) ?? []);
/** A day as the change card names it: its date the way the server writes it in English. */
function dayLabel(date: string | null | undefined, number: number): string {
if (!date) return `Day ${number}`;
return new Intl.DateTimeFormat('en', { weekday: 'short', day: 'numeric', month: 'short', timeZone: 'UTC' }).format(
new Date(`${date.slice(0, 10)}T00:00:00Z`)
);
}
/**
* The trip's assistant: switched on, answering on the admin's connection, with
* one turn that suggests dinner on day 1 and holds it as a change to apply.
*/
export async function mockTripAssistant(page: Page): Promise<AssistantRun> {
const run: AssistantRun = { placeIds: [], chatMessageIds: [] };
const api = page.request;
const { tripId, dayIds } = seededTrip();
await toggleAddon(api, 'ai_assistant', true);
const days = listIn<{ id: number; date?: string | null }>(
await (await api.get(`/api/trips/${tripId}/days`)).json(),
'days'
);
const dayId = dayIds[0];
const day = days.find((d) => d.id === dayId);
const categories = listIn<{ id: number; name: string }>(
await (await api.get('/api/categories')).json(),
'categories'
);
const category = categories.find((c) => /restaurant|food/i.test(c.name)) ?? null;
const args = {
dayId,
name: SUGGESTED.name,
address: SUGGESTED.address,
lat: SUGGESTED.lat,
lng: SUGGESTED.lng,
...(category ? { category_id: category.id } : {}),
place_notes: SUGGESTED.notes,
};
const rows = [
{ op: 'add', labelKey: 'day', before: null, after: dayLabel(day?.date, 1) },
{ op: 'add', labelKey: 'address', before: null, after: SUGGESTED.address },
...(category ? [{ op: 'add', labelKey: 'category', before: null, after: category.name }] : []),
{ op: 'add', labelKey: 'notes', before: null, after: SUGGESTED.notes },
];
const preview = {
toolCallId: CALL_ID,
verbKey: 'addPlaceToDay',
subject: SUGGESTED.name,
rows,
dayId,
placeIds: [],
undoable: true,
effect: {
kind: 'add',
dayId,
fromDayId: null,
placeId: null,
assignmentId: null,
place: { name: SUGGESTED.name, lat: SUGGESTED.lat, lng: SUGGESTED.lng, categoryId: category?.id ?? null },
},
};
const createdAt = PICTURE_DAY.toISOString();
const question = {
id: QUESTION_ID,
role: 'user',
status: 'complete',
createdAt,
parts: [{ type: 'text', text: QUESTION }],
};
const answer: { id: string; role: string; status: string; createdAt: string; parts: Record<string, unknown>[] } = {
id: MESSAGE_ID,
role: 'assistant',
status: 'awaiting_approval',
createdAt,
parts: [
{ type: 'text', text: ANSWER },
{ type: 'tool-call', toolCallId: CALL_ID, toolName: 'create_and_assign_place', args, approval: { id: CALL_ID } },
{ type: 'data-trek-change', data: preview },
{ type: 'data-trek-follow-ups', data: { questions: FOLLOW_UPS } },
],
};
let asked = false;
const turn = [
{ type: 'start', messageId: MESSAGE_ID },
{ type: 'data-trek-thread', data: { threadId: THREAD.id, title: THREAD.title } },
{ type: 'start-step' },
{ type: 'text-start', id: 'text-1' },
{ type: 'text-delta', id: 'text-1', delta: ANSWER },
{ type: 'text-end', id: 'text-1' },
{ type: 'tool-input-start', toolCallId: CALL_ID, toolName: 'create_and_assign_place' },
{ type: 'tool-input-available', toolCallId: CALL_ID, toolName: 'create_and_assign_place', input: args },
{ type: 'data-trek-change', data: preview },
{ type: 'tool-approval-request', approvalId: CALL_ID, toolCallId: CALL_ID },
{ type: 'finish-step' },
{ type: 'data-trek-follow-ups', data: { questions: FOLLOW_UPS } },
{ type: 'data-trek-quota', data: { used: 4, limit: 50 } },
{ type: 'finish', finishReason: 'tool-calls' },
];
/** Apply: the place made and planned for real, then the receipt the server would stream. */
async function apply(): Promise<unknown[]> {
const placeRes = await api.post(`/api/trips/${tripId}/places`, {
data: {
name: SUGGESTED.name,
address: SUGGESTED.address,
lat: SUGGESTED.lat,
lng: SUGGESTED.lng,
notes: SUGGESTED.notes,
image_url: SUGGESTED.image,
...(category ? { category_id: category.id } : {}),
},
});
if (!placeRes.ok())
throw new Error(`could not create ${SUGGESTED.name}: ${placeRes.status()} ${await placeRes.text()}`);
const placeBody = (await placeRes.json()) as { place?: { id: number }; id?: number };
const placeId = placeBody.place?.id ?? placeBody.id;
if (typeof placeId !== 'number') throw new Error('the new place came back without an id');
run.placeIds.push(placeId);
const assigned = await api.post(`/api/trips/${tripId}/days/${dayId}/assignments`, { data: { place_id: placeId } });
if (!assigned.ok())
throw new Error(`could not plan ${SUGGESTED.name}: ${assigned.status()} ${await assigned.text()}`);
const applied = {
toolCallId: CALL_ID,
entity: 'place',
ids: [placeId],
dayId,
undoUntil: new Date(PICTURE_DAY.getTime() + 2 * 3600_000).toISOString(),
};
answer.status = 'complete';
answer.parts = answer.parts.map((p) =>
p.type === 'tool-call'
? { ...p, result: { place: { id: placeId } }, isError: false, approval: { id: CALL_ID, approved: true } }
: p
);
answer.parts.push({ type: 'data-trek-applied', data: applied });
return [
{ type: 'start', messageId: MESSAGE_ID },
{ type: 'tool-output-available', toolCallId: CALL_ID, output: { place: { id: placeId } } },
{ type: 'data-trek-applied', data: applied },
{ type: 'finish', finishReason: 'stop' },
];
}
await page
.context()
.route(/\/api\/ai\/(status|privacy-ack)(\?.*)?$/, (route) =>
pathOf(route).endsWith('/status')
? route.fulfill({ json: instanceStatus() })
: route.fulfill({ json: { success: true } })
);
await page.context().route(new RegExp(`/api/trips/${tripId}/assistant/`), async (route) => {
const path = pathOf(route).replace(`/api/trips/${tripId}/assistant`, '');
const method = route.request().method();
if (path === '/threads' && method === 'GET') {
return route.fulfill({
json: { threads: asked ? [{ id: THREAD.id, title: THREAD.title, lastMessageAt: createdAt }] : [] },
});
}
if (path === `/threads/${THREAD.id}` && method === 'GET') {
return route.fulfill({
json: {
thread: { id: THREAD.id, title: THREAD.title, lastMessageAt: createdAt },
messages: [question, answer],
},
});
}
if (path === '/chat' && method === 'POST') {
asked = true;
return fulfillStream(route, turn);
}
if (path === `/threads/${THREAD.id}/decisions` && method === 'POST') {
const body = route.request().postDataJSON() as { decisions?: { toolCallId: string; approved: boolean }[] };
const approved = body.decisions?.find((d) => d.toolCallId === CALL_ID)?.approved;
if (!approved) {
answer.status = 'complete';
return fulfillStream(route, [
{ type: 'start', messageId: MESSAGE_ID },
{ type: 'tool-output-denied', toolCallId: CALL_ID },
{ type: 'finish', finishReason: 'stop' },
]);
}
return fulfillStream(route, await apply());
}
if (path.startsWith(`/threads/${THREAD.id}/messages/`) && path.endsWith('/share') && method === 'POST') {
// A real message in the trip chat, so the chat shows what was shared.
const { text } = route.request().postDataJSON() as { text: string };
const posted = await api.post(`/api/trips/${tripId}/collab/messages`, { data: { text } });
const json = (await posted.json()) as { message?: { id: number } };
if (json.message?.id) run.chatMessageIds.push(json.message.id);
return route.fulfill({ status: posted.status(), json });
}
if (path === '/stop') return route.fulfill({ json: { success: true } });
if (path.startsWith('/tool-calls/') && path.endsWith('/undo')) {
for (const id of run.placeIds.splice(0)) await api.delete(`/api/trips/${tripId}/places/${id}`);
return route.fulfill({ json: { undone: true } });
}
return route.fulfill({ status: 404, json: { error: 'not mocked' } });
});
return run;
}
/** Take away what the chat made, and switch the assistant off again. */
export async function resetTripAssistant(api: APIRequestContext, run: AssistantRun | null): Promise<void> {
const { tripId } = seededTrip();
for (const id of run?.chatMessageIds ?? []) await api.delete(`/api/trips/${tripId}/collab/messages/${id}`);
// By name as well: a run that stopped between the create and the receipt left one the list does not know.
const places = listIn<{ id: number; name: string }>(
await (await api.get(`/api/trips/${tripId}/places`)).json(),
'places'
);
for (const place of places.filter((p) => p.name === SUGGESTED.name)) {
await api.delete(`/api/trips/${tripId}/places/${place.id}`);
}
await toggleAddon(api, 'ai_assistant', false);
}
+111
View File
@@ -1,4 +1,6 @@
import type { APIRequestContext } from '@playwright/test';
import { createHmac } from 'node:crypto';
import { day, mailHeaderDate } from '../dates';
import { seededTrip } from './fixtures';
import { asMember, PARTNER } from './fixtures-vacay';
@@ -156,3 +158,112 @@ export async function removeNotificationFixtures(api: APIRequestContext): Promis
if (ours) await api.delete(`${INBOX}/${n.id}`);
}
}
// ── Booking mails ─────────────────────────────────────────────────────────────
/** The notice a mail whose booking waits for the reader leaves under the bell. */
export const MAIL_PENDING_TITLE = 'Forwarded bookings to review';
const MAIL_PENDING_KEY = 'notif.mail_booking_pending.title';
/** The media run's own webhook key; a mail service signs with the admin's. */
const WEBHOOK_SECRET = 'help-media-webhook-secret-for-the-notifications';
/** The forwarded mail, as Pending bookings lists it. */
export const MAIL_SUBJECT = 'Your ryokan in Hakone';
async function putAppSettings(api: APIRequestContext, data: Record<string, string | boolean>): Promise<void> {
await ok(await api.put('/api/auth/app-settings', { data }), 'could not save the mail import settings');
}
/**
* The mail import on, the way an admin switches it on, with the signed webhook
* as its transport so the fixture can deliver a mail itself, and the admin's
* own Read with AI off: no model answers in the media run and no extractor is
* needed, so the mail waits in Pending bookings and TREK sends the "Forwarded
* bookings to review" notice, which is what the guide shows. Then a plain text
* confirmation goes to the Japan trip's address, and the fixture waits for
* the notice.
*/
export async function ensureMailPendingNotice(api: APIRequestContext): Promise<void> {
await putAppSettings(api, {
mail_ingest_enabled: true,
mail_ingest_transport: 'webhook',
mail_ingest_address_template: 'trips+{token}@example.com',
mail_ingest_webhook_secret: WEBHOOK_SECRET,
});
await ok(
await api.patch('/api/mail-ingest/settings', { data: { ai_enabled: false } }),
'could not turn Read with AI off'
);
const { tripId } = seededTrip();
let found = (await (await api.get(`/api/trips/${tripId}/mail-ingest/address`)).json()) as {
address: { address: string } | null;
};
if (!found.address) {
await ok(
await api.post(`/api/trips/${tripId}/mail-ingest/address`, { data: {} }),
'could not create the trip address'
);
found = (await (await api.get(`/api/trips/${tripId}/mail-ingest/address`)).json()) as typeof found;
}
const to = found.address?.address;
if (!to) throw new Error('the trip has no mail address');
const raw = Buffer.from(
[
'From: Hakone Ginyu <stay@ginyu.example>',
`To: ${to}`,
`Subject: ${MAIL_SUBJECT}`,
`Date: ${mailHeaderDate(-28, '09:12', '+0900')}`,
'Message-ID: <gny-40218@ginyu.example>',
'MIME-Version: 1.0',
'Content-Type: text/plain; charset=utf-8',
'',
'Dear guest,',
'',
'thank you for choosing Hakone Ginyu. Your room with a private open-air bath is reserved.',
'',
`Check-in: ${day(-6)}, from 15:00`,
`Check-out: ${day(-5)}, until 11:00`,
'Guests: 2',
'Confirmation number: GNY-40218',
'',
'Hakone Ginyu, 100-1 Miyanoshita, Hakone, Kanagawa',
'',
].join('\r\n')
);
const timestamp = String(Math.floor(Date.now() / 1000));
const signature = createHmac('sha256', WEBHOOK_SECRET).update(`${timestamp}\n${to}\n`).update(raw).digest('hex');
await ok(
await api.post('/api/mail-ingest/inbound', {
headers: {
'Content-Type': 'message/rfc822',
'X-Trek-Timestamp': timestamp,
'X-Trek-Recipient': to,
'X-Trek-Signature': `sha256=${signature}`,
},
data: raw,
}),
'the webhook refused the mail'
);
for (let i = 0; i < 90; i++) {
if ((await inbox(api)).some((n) => n.title_key === MAIL_PENDING_KEY && !n.is_read)) return;
await new Promise((res) => setTimeout(res, 1000));
}
throw new Error('no "Forwarded bookings to review" notification arrived');
}
/** Back to the seed: the waiting entry, the trip address, the notice and the import itself go. */
export async function removeMailPendingNotice(api: APIRequestContext): Promise<void> {
const open = await api.get('/api/mail-ingest/inbox?status=open');
if (open.ok()) {
const { entries = [] } = (await open.json()) as { entries?: { id: number }[] };
for (const entry of entries) await api.post(`/api/mail-ingest/candidates/${entry.id}/discard`, { data: {} });
}
const { tripId } = seededTrip();
await api.delete(`/api/trips/${tripId}/mail-ingest/address`);
await api.patch('/api/mail-ingest/settings', { data: { ai_enabled: true } });
for (const n of await inbox(api)) if (n.title_key === MAIL_PENDING_KEY) await api.delete(`${INBOX}/${n.id}`);
await putAppSettings(api, {
mail_ingest_enabled: false,
mail_ingest_transport: 'off',
mail_ingest_webhook_secret: '',
});
}
+89 -3
View File
@@ -1,4 +1,6 @@
import type { APIRequestContext } from '@playwright/test';
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
import path from 'node:path';
import { ensureDawarichConnection, toggleAddon } from './external';
/**
@@ -52,9 +54,9 @@ export async function resetDawarichStays(api: APIRequestContext, tripId: number)
}
/**
* Tours is on for every install, and with it on the places column has no
* Import file. The file guide pictures the column of an install that switched
* it off, and switches it back on afterwards.
* Tours is on for every install. No guide of the places column switches it off
* any more; the run still switches it on after the file, in case an older
* attempt left it off.
*/
export const setTours = (api: APIRequestContext, enabled: boolean): Promise<void> => toggleAddon(api, 'tours', enabled);
@@ -73,3 +75,87 @@ export async function undoDawarichStays(api: APIRequestContext, tripId: number):
}
await resetDawarichStays(api, tripId);
}
/** The pins of the file import: three Kyoto sights the seed does not have, as Google My Maps exports them. */
export const KML_PINS: [string, number, number][] = [
['Kiyomizu-dera', 34.9949, 135.785],
['Yasaka Shrine', 35.0037, 135.7785],
['Gion Shirakawa', 35.0059, 135.7748],
];
/** A KML layer of pins only, no line: the file the places column imports as places. Drawn once, on first use. */
export function pinsKmlFixture(): string {
const dir = path.join(process.cwd(), 'e2e', '.tmp');
mkdirSync(dir, { recursive: true });
const file = path.join(dir, 'kyoto-sights.kml');
if (existsSync(file)) return file;
const marks = KML_PINS.map(
([name, lat, lng]) =>
` <Placemark><name>${name}</name><Point><coordinates>${lng},${lat},0</coordinates></Point></Placemark>`
).join('\n');
writeFileSync(
file,
`<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Kyoto sights</name>
${marks}
</Document>
</kml>
`
);
return file;
}
interface TripTag {
id: number;
name: string;
}
/** The tags the tag guide starts with, and the one it adds itself. */
export const GUIDE_TAGS = [
{ name: 'Must see', color: '#f97316' },
{ name: 'Rainy day', color: '#6366f1' },
{ name: 'Night view', color: '#ec4899' },
];
export const NEW_TAG = 'Photo spot';
async function tripTags(api: APIRequestContext, tripId: number): Promise<TripTag[]> {
const res = await api.get(`/api/trips/${tripId}/tags`);
if (!res.ok()) throw new Error(`could not list the trip's tags: ${res.status()} ${await res.text()}`);
return ((await res.json()) as { tags: TripTag[] }).tags;
}
/** Deletes the guide's tags, which takes them off every place too. */
export async function removeGuideTags(api: APIRequestContext, tripId: number): Promise<void> {
const names = new Set([...GUIDE_TAGS.map((tag) => tag.name), NEW_TAG].map((name) => name.toLowerCase()));
for (const tag of await tripTags(api, tripId)) {
if (!names.has(tag.name.toLowerCase())) continue;
const res = await api.delete(`/api/trips/${tripId}/tags/${tag.id}`);
if (!res.ok() && res.status() !== 404) throw new Error(`could not delete the tag ${tag.name}: ${res.status()}`);
}
}
/**
* The trip's tags for the tag guide, fresh: Must see, Rainy day and Night view,
* with Must see already on two places, so the filter at the end has more than
* the one place the guide tags itself.
*/
export async function ensureGuideTags(api: APIRequestContext, tripId: number, tagged: string[]): Promise<void> {
await removeGuideTags(api, tripId);
const ids: Record<string, number> = {};
for (const tag of GUIDE_TAGS) {
const res = await api.post(`/api/trips/${tripId}/tags`, { data: tag });
if (!res.ok()) throw new Error(`could not add the tag ${tag.name}: ${res.status()} ${await res.text()}`);
ids[tag.name] = ((await res.json()) as { tag: TripTag }).tag.id;
}
const list = await api.get(`/api/trips/${tripId}/places`);
const body = (await list.json()) as { places?: { id: number; name: string }[] } | { id: number; name: string }[];
const places = Array.isArray(body) ? body : (body.places ?? []);
for (const name of tagged) {
const place = places.find((x) => x.name === name);
if (!place) throw new Error(`no seeded place "${name}" to tag`);
const res = await api.put(`/api/trips/${tripId}/places/${place.id}`, { data: { tags: [ids['Must see']] } });
if (!res.ok()) throw new Error(`could not tag ${name}: ${res.status()} ${await res.text()}`);
}
}
+36 -1
View File
@@ -1,6 +1,7 @@
import type { APIRequestContext, Page } from '@playwright/test';
import { readFileSync } from 'node:fs';
import { at, day } from '../dates';
import { seededTrip } from './fixtures';
import { coverFixture, seededTrip } from './fixtures';
import { PICTURE_DAY } from './guide';
/**
@@ -43,6 +44,8 @@ export const FUEL_STOP = {
address: 'Ebina, Kanagawa',
description: 'Fuel and food on the Tomei Expressway, halfway to Hakone.',
stop_type: 'fuel',
// What a fuel stop starts with; a new place would otherwise stand an hour at the pump.
duration_minutes: 10,
};
/**
@@ -82,6 +85,38 @@ export async function removeFuelStop(api: APIRequestContext): Promise<void> {
if (id !== null) await api.delete(`/api/trips/${tripId}/places/${id}`);
}
// ── A stop on the way with a picture, for the stop photo guide ───────────────
/**
* Owakudani, the volcanic valley above Hakone on day 4, as a Sights stop on the
* way with a picture of its own. The cover drawing is a mountain ridge at
* sunset, which is what the valley looks like towards Fuji in the evening.
*/
export const PHOTO_STOP = 'Owakudani';
/** The picture uploaded as the place's own image, and the valley made a Sights stop. */
export async function ensurePhotoStop(api: APIRequestContext): Promise<void> {
const { tripId } = seededTrip();
const id = await placeIdOf(api, PHOTO_STOP);
if (id === null) throw new Error(`the seeded place "${PHOTO_STOP}" is missing`);
const image = await api.post(`/api/trips/${tripId}/places/${id}/image`, {
multipart: {
image: { name: 'owakudani-evening.jpg', mimeType: 'image/jpeg', buffer: readFileSync(await coverFixture()) },
},
});
if (!image.ok()) throw new Error(`could not give "${PHOTO_STOP}" a picture: ${image.status()} ${await image.text()}`);
const put = await api.put(`/api/trips/${tripId}/places/${id}`, { data: { stop_type: 'sights' } });
if (!put.ok())
throw new Error(`could not make "${PHOTO_STOP}" a stop on the way: ${put.status()} ${await put.text()}`);
}
/** The valley a destination without a picture again; the update reclaims the uploaded file. */
export async function removePhotoStop(api: APIRequestContext): Promise<void> {
const { tripId } = seededTrip();
const id = await placeIdOf(api, PHOTO_STOP);
if (id !== null) await api.put(`/api/trips/${tripId}/places/${id}`, { data: { stop_type: null, image_url: null } });
}
// ── A ferry on day 3, for the bookings guide ─────────────────────────────────
/** The boat across Lake Ashi, between the two Hakone stops of day 3. */
+18
View File
@@ -115,11 +115,29 @@ export async function waitForFlyover(page: Page): Promise<void> {
await expect(playButton(page).or(pauseButton(page))).toBeVisible({ timeout: 120_000 });
}
/**
* Search again while the card says a kind could not be searched. The public
* Overpass servers answer 429 and 504 under load, and a picture of that banner
* teaches nothing; a calm try or two usually gets through.
*/
export async function searchAgainWhileUnavailable(page: Page): Promise<void> {
const banner = page.getByText(/^Could not be searched right now/).first();
// Two tries, 20 s apart: more does not fit the test's time, and a longer outage needs a later run.
for (let attempt = 0; attempt < 2; attempt++) {
if (!(await banner.isVisible())) return;
await page.waitForTimeout(20_000);
await alongSearch(page).click();
await expect(alongSearch(page)).toHaveText(/Search again/, { timeout: 90_000 });
await page.waitForTimeout(1_000);
}
}
/** Ask "Along the tour" with what it starts with (the first three kinds, 500 m) and wait for the list. */
export async function searchAlong(page: Page): Promise<void> {
await alongCard(page).scrollIntoViewIfNeeded();
await alongSearch(page).click();
await expect(alongSearch(page)).toHaveText(/Search again/, { timeout: 90_000 });
await searchAgainWhileUnavailable(page);
await expect(alongList(page), 'the search along the tour found nothing (Overpass or the places index)').toBeVisible();
}
+22 -12
View File
@@ -35,8 +35,9 @@ export const PLANNER_TOURS = {
export const SPARE_DESCRIPTION = 'From the hut across the Cisles meadows and down to the Col Raiser gondola.';
/** What the description reads after the "someone else saved it" write of the conflict guide. */
export const REMOTE_DESCRIPTION = 'Mira: we take the gondola down, the last stretch is closed this week.';
/** The query the drawing guide types into the map search; the hut is where its points lie. */
export const SEARCH_QUERY = 'Rifugio Firenze';
/** The query the drawing guide types into the map search; the hut is where its points lie. OSM names it
* "Ncisles - Regensburger - Firenze", and "Rifugio Firenze" alone finds other huts of the valley first. */
export const SEARCH_QUERY = 'Regensburger Firenze';
async function body<T>(
res: { ok(): boolean; status(): number; text(): Promise<string>; json(): Promise<unknown> },
@@ -440,24 +441,33 @@ export async function centreOf(locator: Locator): Promise<{ x: number; y: number
return { x: box.x + box.width / 2, y: box.y + box.height / 2 };
}
/**
* RouteHitBand's path: transparent and 20 px wide. Its 'cursor-copy' class is
* not on the rendered path, so the band is found by its stroke instead.
*/
const ROUTE_BAND = '.leaflet-overlay-pane path[stroke="transparent"][stroke-width="20"]';
/**
* A spot on the drawn route, `share` of the way along its widest hit band:
* the invisible band Leaflet lays along the line to take the click that adds
* a shaping point.
*/
export async function spotOnRoute(page: Page, share = 0.3): Promise<{ x: number; y: number }> {
const at = await page.evaluate((k) => {
const bands = Array.from(document.querySelectorAll('.leaflet-overlay-pane path.cursor-copy')) as SVGPathElement[];
const band = bands.sort((a, b) => b.getTotalLength() - a.getTotalLength())[0];
const ctm = band?.getScreenCTM();
if (!band || !ctm) return null;
const p = band.getPointAtLength(band.getTotalLength() * k);
const s = new DOMPoint(p.x, p.y).matrixTransform(ctm);
return { x: s.x, y: s.y };
}, share);
const at = await page.evaluate(
({ k, sel }) => {
const bands = Array.from(document.querySelectorAll(sel)) as SVGPathElement[];
const band = bands.sort((a, b) => b.getTotalLength() - a.getTotalLength())[0];
const ctm = band?.getScreenCTM();
if (!band || !ctm) return null;
const p = band.getPointAtLength(band.getTotalLength() * k);
const s = new DOMPoint(p.x, p.y).matrixTransform(ctm);
return { x: s.x, y: s.y };
},
{ k: share, sel: ROUTE_BAND }
);
if (!at) throw new Error('no drawn route to click on');
return at;
}
/** The drawn route's click band, for the ring: the widest one. */
export const routeBand = (page: Page) => page.locator('.leaflet-overlay-pane path.cursor-copy').first();
export const routeBand = (page: Page) => page.locator(ROUTE_BAND).first();
+202 -5
View File
@@ -2,8 +2,9 @@ import { test, expect, type APIResponse, type Locator, type Page } from '@playwr
import { readFileSync } from 'node:fs'
import { clearNotices } from '../screenshots/shot'
import { captureGuide, captureHero, dismissReleaseNotice, beat, typeInto, settle, VIEWPORT, type GuideScript } from './guide'
import { ensureExtraTrips, ensureJourneyFixtures, filesImageFixture, SECOND_JOURNEY, SPARE_TRIP } from './fixtures'
import { coverFixture, ensureExtraTrips, ensureJourneyFixtures, filesImageFixture, SECOND_JOURNEY, SPARE_TRIP } from './fixtures'
import { connectJournalDawarich, releaseJournalDawarich, STAY_DAY, writtenEntryIds } from './fixtures-journey'
import { day } from '../dates'
import { journeyGuides, journeyContext, journalGuides, journalContext, studioGuides, studioContext } from '../../src/help/contexts/journey'
import type { HelpGuide } from '../../src/help/types'
@@ -355,6 +356,78 @@ async function setJourney(page: Page, data: Record<string, boolean>): Promise<vo
await answer(await page.request.patch(`/api/journeys/${journeyId}`, { data }), `update the journey with ${JSON.stringify(data)}`)
}
// ── A photo library (Immich) ──────────────────────────────────────────────────
/**
* The album guide needs a connected Immich holding an album that is bigger than
* the trip. No library runs beside the media run, so the page's own calls to
* one are answered here: the addon list names Immich as on, its status says
* connected, and the album holds the trip's last week plus a summer and a
* spring before it. The thumbnails are the drawn fixtures, taken in turn, since
* no photograph may live in this repository. The routes sit on the context,
* not the page: once the app's service worker has taken the page over, its
* requests no longer pass a page route. The context is the guide's own, so
* nothing is left behind for the next guide.
*/
const ALBUM = { id: 'help-album', albumName: 'Shared with Mia', assetCount: 16 }
const ALBUM_RANGE = { from: -7, to: 0 }
const ALBUM_SHOTS: { offset: number; city: string }[] = [
{ offset: 0, city: 'Kyoto' }, { offset: 0, city: 'Kyoto' },
{ offset: -1, city: 'Kyoto' }, { offset: -2, city: 'Hakone' },
{ offset: -4, city: 'Tokyo' }, { offset: -4, city: 'Tokyo' },
{ offset: -6, city: 'Tokyo' }, { offset: -7, city: 'Tokyo' },
{ offset: -96, city: 'Lisbon' }, { offset: -96, city: 'Lisbon' }, { offset: -97, city: 'Sintra' },
{ offset: -98, city: 'Lisbon' }, { offset: -150, city: 'Hamburg' }, { offset: -150, city: 'Hamburg' },
{ offset: -151, city: 'Hamburg' }, { offset: -152, city: 'Lübeck' },
]
const albumAssets = () => ALBUM_SHOTS.map((shot, i) => {
const taken = `${day(shot.offset)}T${String(9 + (i % 8)).padStart(2, '0')}:20:00`
return { id: `help-asset-${i}`, takenAt: `${taken}.000Z`, localTakenAt: taken, city: shot.city, mediaType: 'image' }
})
async function fakePhotoLibrary(page: Page): Promise<void> {
const files = [
await coverFixture(), await filesImageFixture('arashiyama'), await filesImageFixture('hakone-ryokan'),
await filesImageFixture('nishiki-market'), await filesImageFixture('jr-pass-map'),
].map(f => readFileSync(f))
const assets = albumAssets()
await page.context().route(/\/api\/addons(\?.*)?$/, async route => {
const res = await route.fetch()
const body = (await res.json()) as { addons?: { id: string }[] }
const addons = (body.addons ?? []).filter(a => a.id !== 'immich')
await route.fulfill({ response: res, json: { ...body, addons: [...addons, { id: 'immich', name: 'Immich', type: 'photo_provider', enabled: true }] } })
})
await page.context().route(/\/api\/integrations\/memories\/immich\//, async route => {
const path = new URL(route.request().url()).pathname
if (path.endsWith('/status')) return route.fulfill({ json: { connected: true } })
if (path.endsWith('/albums')) return route.fulfill({ json: { albums: [ALBUM, { id: 'help-album-2', albumName: 'Camera roll', assetCount: 1284 }] } })
if (path.includes('/albums/')) return route.fulfill({ json: { assets } })
if (path.endsWith('/search')) {
const trip = assets.filter(a => a.localTakenAt.slice(0, 10) >= day(ALBUM_RANGE.from))
return route.fulfill({ json: { assets: trip, hasMore: false } })
}
const asset = /help-asset-(\d+)/.exec(path)
if (asset) return route.fulfill({ contentType: 'image/jpeg', body: files[Number(asset[1]) % files.length] })
return route.fulfill({ status: 404, json: { error: 'not found' } })
})
}
const pickerDialog = (page: Page) => page.getByRole('dialog', { name: 'Immich' })
const albumRange = (page: Page) => pickerDialog(page).getByRole('group', { name: 'Taken between' })
/** Open one of the range's two calendars and pick a day, going back month by month from the picture day's. */
async function pickAlbumDay(page: Page, which: 0 | 1, iso: string): Promise<void> {
await albumRange(page).getByRole('button').nth(which).click()
const today = day(0)
const months = (Number(today.slice(0, 4)) - Number(iso.slice(0, 4))) * 12 + Number(today.slice(5, 7)) - Number(iso.slice(5, 7))
const back = page.getByRole('button', { name: 'Previous month' })
await expect(back).toBeVisible()
for (let i = 0; i < months; i++) await back.click()
// The calendar floats over the page in a portal: its day cells are the last buttons of that number.
await page.getByRole('button', { name: String(Number(iso.slice(8, 10))), exact: true }).last().click()
await expect(back).toHaveCount(0)
}
// ── The map and a recorded day ────────────────────────────────────────────────
/** The frosted switches at the top of the map: Plan, Recorded, Entries, Photos and the key. */
@@ -468,6 +541,7 @@ async function markTextTarget(page: Page): Promise<void> {
const words = page.locator('.st-sheet').getByText(/\p{L}{3,}/u).first()
await expect(words).toBeVisible()
await words.evaluate(el => {
for (const old of Array.from(document.querySelectorAll('[data-help-text]'))) old.removeAttribute('data-help-text')
const r = el.getBoundingClientRect()
const hit = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2)
hit?.setAttribute('data-help-text', '')
@@ -501,8 +575,9 @@ async function openStudio(page: Page): Promise<void> {
await expect(page.locator('.st-bar')).toBeVisible({ timeout: 30_000 })
await expect(rail(page)).toBeVisible({ timeout: 30_000 })
await studioSection(page, 'Pages')
// An untouched book is cover, first page, one empty spread, last page and back: five thumbnails.
if ((await thumbs(page).count()) < 7) await relayoutBook(page)
// The book is laid out anew for every guide: the guides before this one leave
// photos, words, stickers and backgrounds on its pages.
await relayoutBook(page)
await settle(page)
await page.waitForTimeout(800)
}
@@ -884,6 +959,55 @@ const SCRIPTS: Record<string, GuideScript> = {
],
},
// Immich is answered by fakePhotoLibrary: an album of sixteen photos, half of
// them from the trip's last week, the rest from two earlier trips.
'album-date-range': {
guide: guide('album-date-range'),
start: async p => {
await fakePhotoLibrary(p)
await openJournal(p)
await p.getByRole('button', { name: 'Gallery' }).first().click()
await expect(p.getByRole('button', { name: 'Immich', exact: true })).toBeVisible({ timeout: 20_000 })
await settle(p)
},
steps: [
{
target: p => p.getByRole('button', { name: 'Immich', exact: true }),
act: async p => {
await p.getByRole('button', { name: 'Immich', exact: true }).click()
await expect(pickerDialog(p)).toBeVisible()
await settle(p)
},
},
{
prepare: async p => {
await pickerDialog(p).getByRole('button', { name: 'Albums', exact: true }).click()
await expect(pickerDialog(p).getByRole('button', { name: /^Shared with Mia/ })).toBeVisible()
await settle(p)
},
target: p => pickerDialog(p).getByRole('button', { name: /^Shared with Mia/ }),
act: async p => {
await pickerDialog(p).getByRole('button', { name: /^Shared with Mia/ }).click()
await expect(albumRange(p)).toBeVisible()
await expect(pickerDialog(p).getByRole('button', { name: /^Select all \(16\)/ })).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
{
target: albumRange,
act: async p => {
await pickAlbumDay(p, 0, day(ALBUM_RANGE.from))
await pickAlbumDay(p, 1, day(ALBUM_RANGE.to))
const all = pickerDialog(p).getByRole('button', { name: /^Select all \(8\)/ })
await expect(all).toBeVisible()
await all.click()
await expect(pickerDialog(p).getByRole('button', { name: /^Add \(8\)/ })).toBeEnabled()
await settle(p)
},
},
],
},
'journey-map-layers': {
guide: guide('journey-map-layers'),
start: openJournal,
@@ -927,6 +1051,31 @@ const SCRIPTS: Record<string, GuideScript> = {
],
},
'journey-satellite': {
guide: guide('journey-satellite'),
start: openJournal,
steps: [
{
target: p => mapPanel(p).getByRole('button', { name: 'Switch to satellite view' }),
act: async p => {
await mapPanel(p).getByRole('button', { name: 'Switch to satellite view' }).click()
await expect(mapPanel(p).getByRole('button', { name: 'Switch to map view' })).toBeVisible()
await p.waitForTimeout(1500) // the imagery
await settle(p)
},
},
{
target: p => mapPanel(p).getByRole('button', { name: 'Switch to map view' }),
act: async p => {
await mapPanel(p).getByRole('button', { name: 'Switch to map view' }).click()
await expect(mapPanel(p).getByRole('button', { name: 'Switch to satellite view' })).toBeVisible()
await p.waitForTimeout(1000) // the map tiles
await settle(p)
},
},
],
},
// ── A recorded day (Dawarich) ───────────────────────────────────────────
'journey-keep-route': {
guide: guide('journey-keep-route'),
@@ -1517,8 +1666,21 @@ const SCRIPTS: Record<string, GuideScript> = {
await settle(p)
},
target: p => sidePanel(p).locator('.st-theme-apply'),
act: async p => {
await sidePanel(p).getByRole('button', { name: 'Apply to the book' }).click()
await settle(p)
await p.waitForTimeout(800)
},
},
],
// Applying the theme is one undo step; the next guides find the book in its own theme again.
cleanup: async p => {
await p.getByRole('button', { name: 'Undo', exact: true }).first().click()
// The book saves a moment after the change; leaving earlier would keep the theme.
await p.waitForTimeout(3_000)
await expect(p.getByText('Saved', { exact: true }).first()).toBeVisible({ timeout: 15_000 })
await expect(p.locator('.st-bar').getByText('Saving', { exact: true })).toHaveCount(0, { timeout: 15_000 })
},
},
'studio-stickers': {
@@ -1536,6 +1698,14 @@ const SCRIPTS: Record<string, GuideScript> = {
},
{
target: p => sidePanel(p).locator('.st-shape-grid').first(),
// The step says to click one, and the result shows it on the spread, selected.
act: async p => {
const before = await sheetElements(p).count()
await sidePanel(p).locator('.st-sticker-btn').first().click()
await expect.poll(async () => sheetElements(p).count()).toBeGreaterThan(before)
await settle(p)
await p.waitForTimeout(600)
},
},
],
},
@@ -1545,6 +1715,15 @@ const SCRIPTS: Record<string, GuideScript> = {
start: openStudio,
steps: [
{
// A new, empty spread: every page Auto layout made already holds words or figures,
// and the element would land on top of them. It opens selected, ready to take it.
prepare: async p => {
await studioSection(p, 'Pages')
const before = await thumbs(p).count()
await sidePanel(p).getByRole('button', { name: 'Add spread' }).click()
await expect(thumbs(p)).toHaveCount(before + 1)
await settle(p)
},
target: p => railButton(p, 'Travel'),
act: async p => {
await studioSection(p, 'Travel')
@@ -1557,6 +1736,13 @@ const SCRIPTS: Record<string, GuideScript> = {
},
{
target: p => sidePanel(p).locator('.st-travel-card').first(),
act: async p => {
const before = await sheetElements(p).count()
await sidePanel(p).locator('.st-travel-card').first().click()
await expect.poll(async () => sheetElements(p).count()).toBeGreaterThan(before)
await settle(p)
await p.waitForTimeout(600)
},
},
],
},
@@ -1566,10 +1752,21 @@ const SCRIPTS: Record<string, GuideScript> = {
start: openStudio,
steps: [
{
// The first words on a spread can belong to a figure, so the spreads are
// tried in turn until a click selects text and the inspector offers Effects.
prepare: async p => {
await studioSection(p, 'Pages')
await thumbs(p).nth(2).locator('.st-thumb').click()
await settle(p)
const count = await thumbs(p).count()
for (let i = 2; i < count; i++) {
await thumbs(p).nth(i).locator('.st-thumb').click()
await settle(p)
if (!(await markTextTarget(p).then(() => true, () => false))) continue
await textTarget(p).click()
const isText = await inspector(p).getByRole('button', { name: 'Effects' }).waitFor({ timeout: 3_000 }).then(() => true, () => false)
await p.keyboard.press('Escape')
await settle(p)
if (isText) break
}
await markTextTarget(p)
},
target: p => textTarget(p),
+52 -8
View File
@@ -4,8 +4,12 @@ import type { HelpGuide } from '../../src/help/types';
import { clearNotices } from '../screenshots/shot';
import {
BOOKING_TITLE,
ensureMailPendingNotice,
ensureNotificationFixtures,
MAIL_PENDING_TITLE,
MAIL_SUBJECT,
markUnread,
removeMailPendingNotice,
removeNotificationFixtures,
SHARE_TITLE,
unreadIds,
@@ -37,12 +41,18 @@ const guide = (id: string): HelpGuide => {
*/
const bell = (page: Page): Locator => page.getByTitle('Notifications', { exact: true }).first();
/** The panel the bell opens, found through its footer button. */
const panel = (page: Page): Locator => page.getByRole('button', { name: 'Show all notifications' }).locator('xpath=..');
const panel = (page: Page): Locator =>
page
.locator('div.shadow-xl')
.filter({ has: page.getByRole('button', { name: 'Show all notifications' }) })
.first();
/** The column of the /notifications page: header, filter pills and the list. */
const pageColumn = (page: Page): Locator => page.locator('.max-w-2xl').first();
/** One notification (InAppNotificationItem's root) by its title, in the panel or the page. */
const item = (scope: Locator, title: string): Locator =>
scope.locator('div.relative.px-4.py-3').filter({ hasText: title }).first();
const ITEM = 'div.group.relative';
const item = (scope: Locator, title: string): Locator => scope.locator(ITEM).filter({ hasText: title }).first();
/** Pending bookings, the inbox of forwarded mails the Review button opens. */
const mailInbox = (page: Page): Locator => page.getByRole('dialog', { name: 'Pending bookings' });
/** The user menu button at the top right: avatar, name and chevron. */
const userMenu = (page: Page): Locator =>
page
@@ -89,9 +99,10 @@ const SCRIPTS: Record<string, GuideScript> = {
{ target: bell, act: openBell },
{
target: panel,
// Over the newest one, so its unread tint is not covered by the pointer.
// On the panel's head: a pointed-at row trades its time and dot for its tools,
// and the text is about the time and the dot.
hover: async (p) => {
await item(panel(p), SHARE_TITLE).hover();
await panel(p).locator('span.bg-accent-subtle').first().hover();
},
},
{
@@ -171,9 +182,7 @@ const SCRIPTS: Record<string, GuideScript> = {
target: (p) => item(pageColumn(p), BOOKING_TITLE).getByTitle('Delete', { exact: true }),
act: async (p) => {
await item(pageColumn(p), BOOKING_TITLE).getByTitle('Delete', { exact: true }).click();
await expect(pageColumn(p).locator('div.relative.px-4.py-3').filter({ hasText: BOOKING_TITLE })).toHaveCount(
0
);
await expect(pageColumn(p).locator(ITEM).filter({ hasText: BOOKING_TITLE })).toHaveCount(0);
await settle(p);
},
},
@@ -185,6 +194,41 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
'booking-mail-notifications': {
guide: guide('booking-mail-notifications'),
start: async (p) => {
await ensureMailPendingNotice(p.request);
await openDashboard(p);
},
steps: [
{
target: bell,
act: async (p) => {
await bell(p).click();
await expect(item(panel(p), MAIL_PENDING_TITLE)).toBeVisible();
await settle(p);
},
},
{
target: (p) => item(panel(p), MAIL_PENDING_TITLE),
// On the button the text names, so the row's tools stay out of the way.
hover: async (p) => {
await item(panel(p), MAIL_PENDING_TITLE).getByRole('button', { name: 'Review' }).hover();
},
act: async (p) => {
await item(panel(p), MAIL_PENDING_TITLE).getByRole('button', { name: 'Review' }).click();
await expect(mailInbox(p)).toBeVisible({ timeout: 15_000 });
await expect(mailInbox(p).getByText(MAIL_SUBJECT).first()).toBeVisible({ timeout: 15_000 });
await settle(p);
},
},
{ target: mailInbox },
],
cleanup: async (p) => {
await removeMailPendingNotice(p.request);
},
},
'notification-settings': {
guide: guide('notification-settings'),
start: openNotifications,
+104 -5
View File
@@ -7,6 +7,7 @@ import {
mediaEnv, wandererUrl, wandererToken, allowWanderer, ensureWandererConnection, disconnectWanderer,
ensureActivePlugin, removeSideloadedPlugin, parkOfflineChanges, clearParkedChanges,
} from './fixtures-settings'
import { mockOwnConnection, resetOwnConnection, AI_KEY } from './fixtures-assistant'
import { settingsContext, settingsTabContexts, settingsGuides } from '../../src/help/contexts/settings'
import type { HelpGuide } from '../../src/help/types'
@@ -18,7 +19,7 @@ import type { HelpGuide } from '../../src/help/types'
* with, because settings is the last file of the run.
*
* The cards come from `components/Settings/settingsKit.tsx`: a <section> with an
* <h2> in its head band, rows inside (`SettingRow`, a div with `px-3.5`), boxes
* <h2> in its head band, rows inside (`SettingRow`, a div with `px-4 py-3`), boxes
* of rows (`SettingRows`, a div with `divide-y`). A stacked row puts its wide
* control in a sibling below the label, so a row is found from its label by its
* own div, never by the label's parent.
@@ -57,7 +58,7 @@ const label = (page: Page, sectionTitle: string | RegExp, text: string) =>
const field = (page: Page, sectionTitle: string | RegExp, text: string) => label(page, sectionTitle, text).locator('xpath=..')
/** A whole row (label, control and whatever the row holds below them) by its label. */
const row = (page: Page, sectionTitle: string | RegExp, text: string) =>
label(page, sectionTitle, text).locator('xpath=ancestor::div[contains(@class,"px-3.5")][1]')
label(page, sectionTitle, text).locator('xpath=ancestor::div[contains(@class,"px-4") and contains(@class,"py-3")][1]')
/** The box of rows a row sits in. */
const rows = (page: Page, sectionTitle: string | RegExp, text: string) =>
label(page, sectionTitle, text).locator('xpath=ancestor::div[contains(@class,"divide-y")][1]')
@@ -102,6 +103,24 @@ function totp(secretBase32: string): string {
const only = (target: (p: Page) => Locator) => ({ target })
/**
* The booking mail import, switched on the way an admin does it (the same
* settings the Bookings guides use), so the Booking mails card shows the
* person's own address. Off again in cleanup.
*/
async function mailImport(page: Page, on: boolean): Promise<void> {
const data = on
? {
mail_ingest_enabled: true,
mail_ingest_transport: 'webhook',
mail_ingest_address_template: 'trips+{token}@example.com',
mail_ingest_webhook_secret: 'help-media-webhook-secret-for-the-pictures',
}
: { mail_ingest_enabled: false, mail_ingest_transport: 'off', mail_ingest_webhook_secret: '' }
const res = await page.request.put('/api/auth/app-settings', { data })
if (!res.ok()) throw new Error(`could not switch the mail import: ${res.status()} ${await res.text()}`)
}
/**
* Save, wait for the card to say Connected, then Test connection and wait for
* its answer: the order the connect guides tell the reader.
@@ -121,11 +140,11 @@ const SCRIPTS: Record<string, GuideScript> = {
start: opener('settings-display'),
steps: [
{
target: p => field(p, 'Startup', 'Start page').locator('xpath=..'),
target: p => row(p, 'Startup', 'Start page'),
// The start tab only exists once the app opens on the active trip.
act: async p => { await section(p, 'Startup').getByRole('button', { name: 'Active trip' }).click(); await settle(p) },
},
only(p => field(p, 'Startup', 'Start tab').locator('xpath=..')),
only(p => row(p, 'Startup', 'Start tab')),
],
cleanup: async p => { await section(p, 'Startup').getByRole('button', { name: 'Dashboard', exact: true }).click(); await settle(p) },
},
@@ -207,6 +226,31 @@ const SCRIPTS: Record<string, GuideScript> = {
],
cleanup: async p => { await p.reload(); await settle(p) },
},
'map-hide-pois': {
guide: guide('map-hide-pois'),
start: opener('settings-map'),
steps: [
{
// Mapbox GL with its default style, Mapbox Standard; nothing is saved, the reload in cleanup drops it.
prepare: async p => {
const card = section(p, /^Map$/)
await card.getByRole('button', { name: /Mapbox GL/ }).click()
await settle(p)
// Mapbox GL starts on its default style, Mapbox Standard, the style the step names.
await expect(card.getByRole('button', { name: /^Mapbox Standard/ })).toBeVisible()
},
target: p => section(p, /^Map$/).getByText('Map Style', { exact: true }).first().locator('xpath=..'),
},
{
target: p => row(p, /^Map$/, 'Hide Points of Interest'),
act: async p => {
await row(p, /^Map$/, 'Hide Points of Interest').locator('button[aria-pressed]').click()
await settle(p)
},
},
],
cleanup: async p => { await p.reload(); await settle(p) },
},
// ── Notifications ────────────────────────────────────────────────────────
'notification-channels': {
@@ -229,6 +273,23 @@ const SCRIPTS: Record<string, GuideScript> = {
},
// ── Integrations ─────────────────────────────────────────────────────────
'booking-mail-address': {
guide: guide('booking-mail-address'),
start: async p => {
await mailImport(p, true)
await openSettings(p, 'Integrations')
await expect(section(p, 'Booking mails').locator('code')).toBeVisible({ timeout: 20_000 })
await settle(p)
},
steps: [
// The address with its copy and New address buttons.
only(p => section(p, 'Booking mails').locator('code').locator('xpath=..')),
only(p => section(p, 'Booking mails').getByText('Forward automatically', { exact: true }).locator('xpath=..')),
only(p => rows(p, 'Booking mails', 'Import booking mails')),
only(p => section(p, 'Booking mails').getByRole('button', { name: /Pending bookings/ }).locator('xpath=..')),
],
cleanup: async p => { await mailImport(p, false); await p.reload(); await settle(p) },
},
'photo-providers': {
guide: guide('photo-providers'),
start: opener('settings-integrations'),
@@ -344,6 +405,43 @@ const SCRIPTS: Record<string, GuideScript> = {
],
cleanup: p => disconnectWanderer(p.request),
},
'connect-ai': {
guide: guide('connect-ai'),
// The key is never tested against a provider: fixtures-assistant.ts answers for the connection.
start: async p => {
await mockOwnConnection(p)
await openSettings(p, TAB_OF['settings-integrations'])
await expect(p.getByRole('group', { name: 'What would you like to chat with?' })).toBeVisible({ timeout: 20_000 })
await settle(p)
},
steps: [
{
target: p => p.getByRole('group', { name: 'What would you like to chat with?' }),
hover: async p => { await p.getByRole('button', { name: /^Paste an API key/ }).hover() },
act: async p => {
await p.getByRole('button', { name: /^Paste an API key/ }).click()
await expect(p.getByPlaceholder('Paste your key here')).toBeVisible()
await settle(p)
},
},
{
prepare: async p => {
await typeInto(p, p.getByPlaceholder('Paste your key here'), AI_KEY)
await expect(p.getByText('Detected: Anthropic')).toBeVisible()
await settle(p)
},
target: p => p.getByPlaceholder('Paste your key here').locator('xpath=ancestor::div[contains(@class,"gap-3")][1]'),
hover: async p => { await p.getByRole('button', { name: 'Connect', exact: true }).hover() },
act: async p => {
await p.getByRole('button', { name: 'Connect', exact: true }).click()
await expect(p.getByRole('button', { name: 'Open assistant' })).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
only(p => p.getByRole('button', { name: 'Open assistant' }).locator('xpath=ancestor::div[contains(@class,"divide-y")][1]')),
],
cleanup: p => resetOwnConnection(p.request),
},
'api-keys': {
guide: guide('api-keys'),
start: opener('settings-integrations'),
@@ -408,7 +506,8 @@ const SCRIPTS: Record<string, GuideScript> = {
guide: guide('plugin-settings'),
start: opener('settings-plugins'),
steps: [
only(p => section(p, 'Plugin settings')),
// The first plugin's own card, which follows the Plugin settings heading card.
only(p => section(p, 'Plugin settings').locator('xpath=following::section[1]')),
only(p => section(p, 'Plugin activity')),
],
},
+210 -12
View File
@@ -1,9 +1,10 @@
import { createHmac } from 'node:crypto'
import { test, expect, type Locator, type Page } from '@playwright/test'
import { captureGuide, captureHero, beat, typeInto, settle, VIEWPORT, type GuideScript } from './guide'
import { day } from '../dates'
import { day, mailHeaderDate } from '../dates'
import { seededTrip, ensureBookingsFixtures, bookingPdfFixture, bookingEmlFixture, BOOKING_EML, HOTEL_TO_BOOK, UNATTACHED_FILE } from './fixtures'
import { openTrip, modal, portalDialog, importSteps, importTask, dismissImportTask, deleteTripFiles } from './trip-shared'
import { requireExtractor, allowEmlUploads } from './external'
import { openTrip, modal, portalDialog, importDialog, importSteps, importTask, dismissImportTask, deleteTripFiles } from './trip-shared'
import { requireExtractor, allowEmlUploads, toggleAddon } from './external'
import { tripBookingsContext, tripBookingsGuides } from '../../src/help/contexts/tripBookings'
import type { HelpGuide } from '../../src/help/types'
@@ -220,6 +221,116 @@ const closeModal = async (page: Page): Promise<void> => {
}
}
// ── Booking mails ─────────────────────────────────────────────────────────────
/** The trip's own address, under the drop box of the import dialog. */
const forwardCard = (page: Page) => importDialog(page).getByText('Or forward by mail', { exact: true }).locator('xpath=..')
/** The user menu button at the top right: avatar, name and chevron. */
const userMenu = (page: Page) => page.getByRole('button').filter({ has: page.locator('span.max-w-40') }).first()
/** Pending bookings in the user menu, with the count of waiting mails after its label. */
const inboxEntryPoint = (page: Page) => page.getByRole('button', { name: /^Pending bookings/ })
const mailInbox = (page: Page) => page.getByRole('dialog', { name: 'Pending bookings' })
const inboxEntry = (page: Page) => mailInbox(page).getByRole('listitem').filter({ hasText: MAIL_SUBJECT }).first()
const MAIL_SUBJECT = 'Your table at Kikunoi'
/** What the guide saves: the title corrected in the form, the code TREK read from the mail. */
const MAIL_BOOKING = { title: 'Dinner at Kikunoi', code: 'KKN-77310' }
/** The media run's own webhook key; a mail service signs with the admin's. */
const WEBHOOK_SECRET = 'help-media-webhook-secret-for-the-pictures'
/**
* The mail import, switched on the way an admin does it, with the signed
* webhook as its transport so the guide can deliver a mail itself. The import
* dialog only opens where the server can read confirmations, so AI Parsing is
* on as well, while the person's own Read with AI is off: no model answers in
* the media run, and without it the mail waits in the inbox, which is the
* part of the flow the guide shows. Off again in cleanup, entries and the
* trip address with it.
*/
async function mailImportOn(page: Page, on: boolean): Promise<void> {
const api = page.request
const { tripId } = seededTrip()
if (on) {
await putAppSettings(page, {
mail_ingest_enabled: true,
mail_ingest_transport: 'webhook',
mail_ingest_address_template: 'trips+{token}@example.com',
mail_ingest_webhook_secret: WEBHOOK_SECRET,
})
await toggleAddon(api, 'llm_parsing', true)
await api.patch('/api/mail-ingest/settings', { data: { ai_enabled: false } })
return
}
const inbox = await api.get('/api/mail-ingest/inbox?status=open')
if (inbox.ok()) {
const { entries = [] } = (await inbox.json()) as { entries?: { id: number }[] }
for (const entry of entries) await api.post(`/api/mail-ingest/candidates/${entry.id}/discard`, { data: {} })
}
await api.delete(`/api/trips/${tripId}/mail-ingest/address`)
await api.patch('/api/mail-ingest/settings', { data: { ai_enabled: true } })
await toggleAddon(api, 'llm_parsing', false)
await putAppSettings(page, { mail_ingest_enabled: false, mail_ingest_transport: 'off', mail_ingest_webhook_secret: '' })
}
async function putAppSettings(page: Page, data: Record<string, string | boolean>): Promise<void> {
const res = await page.request.put('/api/auth/app-settings', { data })
if (!res.ok()) throw new Error(`could not save the mail import settings: ${res.status()} ${await res.text()}`)
}
/**
* Forward the restaurant's confirmation to the trip's address, the way a mail
* service hands a mail to TREK: raw, signed with the webhook key over the
* time, the recipient and every byte. Then wait until it was read and waits
* in the inbox. A plain text mail on purpose: nothing machine-readable in it,
* so the booking form starts from what the mail says in words.
*/
async function forwardMail(page: Page): Promise<void> {
const { tripId } = seededTrip()
const found = await page.request.get(`/api/trips/${tripId}/mail-ingest/address`)
const { address } = (await found.json()) as { address: { address: string } | null }
if (!address) throw new Error('the trip has no mail address after Create an address for this trip')
const raw = Buffer.from(
[
'From: Kikunoi Honten <reservations@kikunoi.example>',
`To: ${address.address}`,
`Subject: ${MAIL_SUBJECT}`,
`Date: ${mailHeaderDate(-30, '10:24', '+0900')}`,
'Message-ID: <kkn-77310@kikunoi.example>',
'MIME-Version: 1.0',
'Content-Type: text/plain; charset=utf-8',
'',
'Dear Ms Lindberg,',
'',
'thank you for your reservation at Kikunoi Honten. We look forward to welcoming you.',
'',
`Date: ${day(-3)}, 19:00`,
'Guests: 2',
`Reservation number: ${MAIL_BOOKING.code}`,
'',
'Kikunoi Honten, 459 Shimokawara-cho, Higashiyama-ku, Kyoto',
'',
].join('\r\n'),
)
const timestamp = String(Math.floor(Date.now() / 1000))
const signature = createHmac('sha256', WEBHOOK_SECRET).update(`${timestamp}\n${address.address}\n`).update(raw).digest('hex')
const res = await page.request.post('/api/mail-ingest/inbound', {
headers: {
'Content-Type': 'message/rfc822',
'X-Trek-Timestamp': timestamp,
'X-Trek-Recipient': address.address,
'X-Trek-Signature': `sha256=${signature}`,
},
data: raw,
})
if (!res.ok()) throw new Error(`the webhook refused the mail: ${res.status()} ${await res.text()}`)
await expect
.poll(async () => {
const count = await page.request.get('/api/mail-ingest/inbox/count')
return count.ok() ? ((await count.json()) as { pending?: number }).pending ?? 0 : 0
}, { timeout: 90_000, intervals: [1000] })
.toBeGreaterThan(0)
}
const only = (target: (p: Page) => Locator) => ({ target })
const SCRIPTS: Record<string, GuideScript> = {
@@ -290,7 +401,7 @@ const SCRIPTS: Record<string, GuideScript> = {
target: p => viewItem(p, 'Type'),
act: async p => {
await viewItem(p, 'Type').click()
await expect(sectionHead(p, 'Tour')).toBeVisible()
await expect(sectionHead(p, 'Guided tour')).toBeVisible()
await settle(p)
},
},
@@ -309,10 +420,12 @@ const SCRIPTS: Record<string, GuideScript> = {
await closeViewOptions(p)
await settle(p)
},
target: p => sectionHead(p, 'Tour'),
// The label: the heading itself spans the whole width, and a frame
// centred on it would cut the label off at the left.
target: p => sectionHead(p, 'Guided tour').getByText('Guided tour', { exact: true }),
act: async p => {
await sectionHead(p, 'Tour').click()
await expect(sectionHead(p, 'Tour')).toHaveAttribute('aria-expanded', 'false')
await sectionHead(p, 'Guided tour').click()
await expect(sectionHead(p, 'Guided tour')).toHaveAttribute('aria-expanded', 'false')
await expect(bookingCard(p, 'Kyoto Cycling Tour')).toHaveCount(0)
await settle(p)
},
@@ -489,9 +602,9 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
{
target: p => detail(p, VIEWED.title).getByRole('button', { name: 'On map', exact: true }),
target: p => detail(p, VIEWED.title).getByRole('button', { name: 'Map', exact: true }),
act: async p => {
await detail(p, VIEWED.title).getByRole('button', { name: 'On map', exact: true }).click()
await detail(p, VIEWED.title).getByRole('button', { name: 'Map', exact: true }).click()
await expect(detail(p, VIEWED.title)).toHaveCount(0)
// The tab goes and the plan opens on the tour's day with its place selected.
await expect(p.getByRole('heading', { name: 'Bookings', exact: true, level: 2 })).toHaveCount(0)
@@ -590,7 +703,9 @@ const SCRIPTS: Record<string, GuideScript> = {
await expect(modal(p).getByRole('button', { name: UNATTACHED_FILE, exact: true })).toBeVisible()
await beat(p, 300)
},
target: p => modal(p).getByRole('button', { name: 'Link existing file' }).locator('xpath=..'),
// The list it opens above the button: what the reader picks from. The
// button's own box leaves the list out, since it floats over the form.
target: p => modal(p).getByRole('button', { name: UNATTACHED_FILE, exact: true }).locator('xpath=..'),
act: async p => {
await modal(p).getByRole('button', { name: UNATTACHED_FILE, exact: true }).click()
await expect(modal(p).getByRole('button', { name: UNATTACHED_FILE, exact: true })).toHaveCount(0)
@@ -711,9 +826,9 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
{
target: p => filterMenu(p).getByRole('button', { name: /^Tour\b/ }),
target: p => filterMenu(p).getByRole('button', { name: /^Guided tour\b/ }),
act: async p => {
await filterMenu(p).getByRole('button', { name: /^Tour\b/ }).click()
await filterMenu(p).getByRole('button', { name: /^Guided tour\b/ }).click()
await expect(bookingCard(p, 'Haneda Airport P4')).toHaveCount(0)
await expect(bookingCard(p, 'Kyoto Cycling Tour')).toBeVisible()
await settle(p)
@@ -819,6 +934,89 @@ const SCRIPTS: Record<string, GuideScript> = {
await deleteTripFiles(p, BOOKING_EML)
},
},
'forward-booking-mail': {
guide: guide('forward-booking-mail'),
start: async p => {
await mailImportOn(p, true)
await openBookings(p)
},
steps: [
{
target: p => p.getByRole('button', { name: 'Import booking confirmations', exact: true }),
act: async p => {
await p.getByRole('button', { name: 'Import booking confirmations', exact: true }).click()
await expect(importDialog(p)).toBeVisible()
await expect(forwardCard(p)).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
{
target: forwardCard,
act: async p => {
await forwardCard(p).getByRole('button', { name: 'Create an address for this trip' }).click()
await expect(forwardCard(p).locator('code')).toContainText('@', { timeout: 15_000 })
await settle(p)
},
},
{
// The address and its copy button; copying itself needs a clipboard the headless browser lacks.
target: p => forwardCard(p).locator('code').locator('xpath=..'),
act: async p => {
await importDialog(p).getByRole('button', { name: 'Cancel', exact: true }).click()
await expect(importDialog(p)).toHaveCount(0)
await forwardMail(p)
},
},
{
prepare: async p => {
// A fresh page reads the waiting count, as anyone arriving later would.
await openBookings(p)
await userMenu(p).click()
await expect(inboxEntryPoint(p)).toBeVisible()
await expect(inboxEntryPoint(p)).toContainText('1')
await beat(p, 300)
},
target: inboxEntryPoint,
act: async p => {
await inboxEntryPoint(p).click()
await expect(inboxEntry(p)).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
{
target: inboxEntry,
act: async p => {
await inboxEntry(p).getByRole('button', { name: 'Fill in yourself' }).click()
await expect(mailInbox(p)).toHaveCount(0)
await expect(modal(p).getByRole('heading', { name: 'New Reservation' })).toBeVisible({ timeout: 20_000 })
await expect(codeBox(p)).toHaveValue(MAIL_BOOKING.code)
await settle(p)
},
},
{
prepare: async p => {
await typeInto(p, titleBox(p), MAIL_BOOKING.title)
await settle(p)
},
target: p => modal(p).getByRole('dialog'),
act: async p => {
await saveButton(p, 'Add').click()
await expect(modal(p)).toHaveCount(0, { timeout: 20_000 })
// Fill in yourself opens the trip without its tab; the result shows the booking where it belongs.
await openBookings(p)
await expect(bookingCard(p, MAIL_BOOKING.title)).toBeVisible({ timeout: 20_000 })
await bookingCard(p, MAIL_BOOKING.title).scrollIntoViewIfNeeded()
await settle(p)
},
},
],
cleanup: async p => {
await closeModal(p)
await clearPanelState(p)
await deleteBookings(p, MAIL_BOOKING.title)
await mailImportOn(p, false)
},
},
'edit-booking': {
guide: guide('edit-booking'),
start: openBookings,
+249 -2
View File
@@ -1,7 +1,8 @@
import { readFileSync } from 'node:fs'
import { test, expect, type Locator, type Page } from '@playwright/test'
import { captureGuide, captureHero, beat, typeInto, settle, VIEWPORT, type GuideScript } from './guide'
import { day, long, short } from '../dates'
import { seededTrip, ensureCostsFixtures } from './fixtures'
import { seededTrip, ensureCostsFixtures, filesPdfFixture } from './fixtures'
import { openTrip, modal } from './trip-shared'
import { RAMEN, RECEIPT_FILE, receiptFixture, removeReceiptFiles } from './fixtures-trip-costs'
import { tripCostsContext, tripCostsGuides } from '../../src/help/contexts/tripCosts'
@@ -30,7 +31,8 @@ const SEEDED_EUR = 'Flights FRA → HND'
const BOOKING = 'LH716 FRA → HND'
/** A seeded expense costs-table gives its days to. */
const JR_PASS = 'JR Pass (14 days)'
const DINNER = 'Kaiseki dinner in Gion'
/** The dinner add-expense records; not the seed's Kaiseki dinner, which cleanup would delete with it. */
const DINNER = 'Yakitori dinner in Pontocho'
const UPGRADE = 'Shinkansen seat upgrade'
const LUNCH = { name: 'Nishiki Market lunch', category: 'food', total_price: 4800, currency: 'JPY', expense_date: day(-4) }
/** The row costs-table adds to Food & drink; the table names a new row this until it is renamed. */
@@ -38,6 +40,12 @@ const MATCHA = 'Matcha in Uji'
const NEW_ROW = 'New Entry'
/** Where the tab keeps the list/table choice (CostsPanel's COSTS_VIEW_KEY). */
const VIEW_KEY = 'trek:costs-view'
/** A stay split-by-shares divides by nights: three, three and two, so the shares come out even. */
const MACHIYA = { name: 'Machiya stay in Kyoto', category: 'accommodation', total_price: 39000, currency: 'JPY', expense_date: day(-5) }
/** The trip file link-receipt-file puts on the JR Pass; the voucher is the pass's invoice. */
const VOUCHER = 'JR-Pass-voucher.pdf'
/** Where useCostsCurrency keeps one trip's picked currency. */
const SHOWN_IN_KEY = (tripId: number) => `trek:costs-currency:${tripId}`
/** The Costs tab, waited out: its panel is lazy and its figures come from the server. */
const openCosts = async (p: Page): Promise<void> => {
@@ -185,6 +193,36 @@ async function pickCurrency(page: Page, code: string): Promise<void> {
await settle(page)
}
// ── The bar's currency picker and the sidebar's switches ─────────────────────
const showIn = (page: Page) => page.getByRole('button', { name: 'Show amounts in', exact: true })
const showInList = (page: Page) => page.getByRole('group', { name: 'Show amounts in', exact: true })
const modeSwitch = (page: Page) => page.getByRole('button', { name: 'Split costs between travelers', exact: true })
async function setCostsMode(page: Page, mode: 'split' | 'totals'): Promise<void> {
const { tripId } = seededTrip()
const res = await page.request.put(`/api/trips/${tripId}`, { data: { costs_mode: mode } })
if (!res.ok()) throw new Error(`could not set costs_mode ${mode}: ${res.status()} ${await res.text()}`)
}
/** The voucher as a trip file, uploaded once; the seed has no document of its own. */
async function ensureVoucher(page: Page): Promise<void> {
const { tripId } = seededTrip()
const res = await page.request.get(`/api/trips/${tripId}/files`)
const { files = [] } = (await res.json()) as { files?: { original_name: string }[] }
if (files.some(f => f.original_name === VOUCHER)) return
const uploaded = await page.request.post(`/api/trips/${tripId}/files`, {
multipart: { file: { name: VOUCHER, mimeType: 'application/pdf', buffer: readFileSync(filesPdfFixture('JR-Pass-voucher')) } },
})
if (!uploaded.ok()) throw new Error(`could not upload ${VOUCHER}: ${uploaded.status()} ${await uploaded.text()}`)
}
/** Open the expense editor on a ledger row with its pencil. */
async function editRow(page: Page, name: string): Promise<void> {
await rowActions(page, name).getByRole('button', { name: 'Edit' }).click()
await expect(nameBox(page)).toHaveValue(name)
await settle(page)
}
const SCRIPTS: Record<string, GuideScript> = {
'add-expense': {
guide: guide('add-expense'),
@@ -422,6 +460,90 @@ const SCRIPTS: Record<string, GuideScript> = {
cleanup: p => deleteExpenses(p, UPGRADE),
},
'split-by-shares': {
guide: guide('split-by-shares'),
start: async p => {
await createExpense(p, MACHIYA)
await openCosts(p)
},
steps: [
{
prepare: p => editRow(p, MACHIYA.name),
target: p => block(p, 'Split').getByRole('button', { name: 'Custom', exact: true }),
act: async p => {
await block(p, 'Split').getByRole('button', { name: 'Custom', exact: true }).click()
await expect(block(p, 'Split').getByRole('group', { name: 'Enter shares as' })).toBeVisible()
await settle(p)
},
},
{
target: p => block(p, 'Split').getByRole('group', { name: 'Enter shares as' }),
act: async p => {
await block(p, 'Split').getByRole('group', { name: 'Enter shares as' }).getByRole('button', { name: 'Shares', exact: true }).click()
await expect(block(p, 'Split').getByRole('textbox', { name: /^Shares for / })).toHaveCount(3)
await settle(p)
},
},
{
// Three nights, three nights, and jonas came a day later.
prepare: async p => {
const fields = block(p, 'Split').getByRole('textbox', { name: /^Shares for / })
await fields.nth(0).fill('3')
await fields.nth(1).fill('3')
await fields.nth(2).fill('2')
await expect(block(p, 'Split').getByText('Split matches total')).toBeVisible()
await settle(p)
},
target: p => block(p, 'Split').getByRole('textbox', { name: /^Shares for / }).first().locator('xpath=ancestor::div[contains(@class,"divide-y")][1]'),
},
{
target: p => modal(p).getByRole('button', { name: 'Save', exact: true }),
act: async p => {
await modal(p).getByRole('button', { name: 'Save', exact: true }).click()
await expect(modal(p)).toHaveCount(0)
await dropFocus(p)
await expect(expRow(p, MACHIYA.name)).toBeVisible()
await expRow(p, MACHIYA.name).evaluate(el => el.scrollIntoView({ block: 'center' }))
await settle(p)
},
},
],
cleanup: async p => {
await closeModal(p)
await deleteExpenses(p, MACHIYA.name)
},
},
'costs-show-in': {
guide: guide('costs-show-in'),
start: openCosts,
steps: [
only(showIn),
{
prepare: async p => {
await showIn(p).click()
await expect(showInList(p)).toBeVisible()
await beat(p, 300)
},
target: showInList,
act: async p => {
await showInList(p).locator('input').first().fill('EUR')
await showInList(p).getByRole('button', { name: /^EUR/ }).click()
await expect(showIn(p)).toHaveText(/EUR/)
await expect(card(p, 'Total trip spend')).toHaveText(/€/, { timeout: 20_000 })
await settle(p)
},
},
only(p => p.locator('.costs-summary')),
// Ringed in its new state; the reader picks the first entry to go back.
only(showIn),
],
cleanup: async p => {
const { tripId } = seededTrip()
await p.evaluate(key => { try { localStorage.removeItem(key) } catch { /* no storage: nothing to put back */ } }, SHOWN_IN_KEY(tripId))
},
},
'expense-receipts': {
guide: guide('expense-receipts'),
start: async p => {
@@ -488,6 +610,62 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
'link-receipt-file': {
guide: guide('link-receipt-file'),
start: async p => {
await ensureVoucher(p)
await openCosts(p)
},
steps: [
{
target: p => rowActions(p, JR_PASS).getByRole('button', { name: 'Edit' }),
act: async p => {
await editRow(p, JR_PASS)
await expect(block(p, 'Receipts & Invoices')).toBeVisible()
},
},
{
// Opened for the picture, so the files it offers stand under the icon.
prepare: async p => {
await block(p, 'Receipts & Invoices').getByRole('button', { name: 'Link', exact: true }).click()
await expect(modal(p).getByRole('button', { name: VOUCHER })).toBeVisible()
await settle(p)
},
target: p => block(p, 'Receipts & Invoices').getByRole('button', { name: 'Link', exact: true }),
// Pointer on the offered file, so the icon's tooltip does not cover the list.
hover: async p => {
await modal(p).getByRole('button', { name: VOUCHER }).hover()
},
},
{
target: p => modal(p).getByRole('button', { name: VOUCHER }),
act: async p => {
await modal(p).getByRole('button', { name: VOUCHER }).click()
await expect(block(p, 'Receipts & Invoices').getByText(VOUCHER)).toBeVisible()
await settle(p)
},
},
{
target: p => modal(p).getByRole('button', { name: 'Save', exact: true }),
act: async p => {
await modal(p).getByRole('button', { name: 'Save', exact: true }).click()
await expect(modal(p)).toHaveCount(0, { timeout: 20_000 })
await dropFocus(p)
await expect(expRow(p, JR_PASS).getByRole('button', { name: 'View receipt' })).toBeVisible({ timeout: 20_000 })
await expRow(p, JR_PASS).evaluate(el => el.scrollIntoView({ block: 'center' }))
await settle(p)
},
},
],
cleanup: async p => {
await closeModal(p)
const { tripId } = seededTrip()
for (const item of (await budgetItems(p)).filter(i => i.name === JR_PASS)) {
await p.request.put(`/api/trips/${tripId}/budget/${item.id}`, { data: { receipt_file_ids: [] } })
}
},
},
'filter-costs': {
guide: guide('filter-costs'),
start: openCosts,
@@ -559,6 +737,31 @@ const SCRIPTS: Record<string, GuideScript> = {
],
},
'leave-out-category': {
guide: guide('leave-out-category'),
start: openCosts,
steps: [
only(p => card(p, 'By category')),
{
prepare: async p => {
await card(p, 'By category').getByRole('button', { name: 'Leave Transport out of the totals' }).click()
await expect(card(p, 'By category').getByRole('button', { name: 'Count all', exact: true })).toBeVisible()
await settle(p)
},
target: p => card(p, 'By category'),
},
only(p => card(p, 'Total trip spend')),
{
target: p => card(p, 'By category').getByRole('button', { name: 'Count all', exact: true }),
act: async p => {
await card(p, 'By category').getByRole('button', { name: 'Count all', exact: true }).click()
await expect(card(p, 'By category').getByText('Select a category to leave it out of the totals.')).toBeVisible()
await settle(p)
},
},
],
},
'settle-up': {
guide: guide('settle-up'),
start: async p => {
@@ -638,6 +841,50 @@ const SCRIPTS: Record<string, GuideScript> = {
],
},
'costs-totals-only': {
guide: guide('costs-totals-only'),
start: openCosts,
steps: [
only(p => card(p, 'Split costs between travelers')),
{
prepare: async p => {
await modeSwitch(p).click()
await expect(modeSwitch(p)).toHaveAttribute('aria-pressed', 'false', { timeout: 15_000 })
await expect(card(p, 'Settle up')).toHaveCount(0)
await settle(p)
},
// The count under the total, which stands alone now; the frame around it
// shows the total and the ledger under it without payers or split. The
// card itself spans the whole width and would be cut at both sides.
target: p => card(p, 'Total trip spend').getByText(/^\d+ expenses?$/),
},
{
prepare: async p => {
await addExpense(p).click()
await expect(nameBox(p)).toBeVisible()
await expect(modal(p).getByText('Who paid?', { exact: true })).toHaveCount(0)
await settle(p)
},
// The editor itself, not the dimmed backdrop around it.
target: p => p.getByRole('dialog').last(),
act: closeModal,
},
{
target: p => card(p, 'Split costs between travelers'),
act: async p => {
await modeSwitch(p).click()
await expect(modeSwitch(p)).toHaveAttribute('aria-pressed', 'true', { timeout: 15_000 })
await expect(card(p, 'Settle up')).toBeVisible()
await settle(p)
},
},
],
cleanup: async p => {
await closeModal(p)
await setCostsMode(p, 'split')
},
},
'expense-from-booking': {
guide: guide('expense-from-booking'),
start: async p => {
+22 -3
View File
@@ -224,7 +224,12 @@ const SCRIPTS: Record<string, GuideScript> = {
only(p => stop(p, 'Arashiyama Bamboo Grove')),
only(p => stop(p, 'Nishiki Market')),
only(connector),
only(routeBar),
{
// Hovered on Route itself: the bar's centre is the Walking button, whose
// tooltip would stand over the ring.
target: routeBar,
hover: async p => { await routeBar(p).getByRole('button', { name: 'Route', exact: true }).hover() },
},
],
},
'place-onto-day': {
@@ -252,7 +257,16 @@ const SCRIPTS: Record<string, GuideScript> = {
target: p => toOpenDay(p, SPARE.name),
},
only(p => p.getByRole('button', { name: 'Add place to this day' }).first()),
only(p => p.getByRole('button', { name: 'Add to the open day' })),
{
target: p => p.getByRole('button', { name: 'Add to the open day' }),
// The result shows the place as a stop on day 2, where step 1 dropped it,
// with the details panel of the open day out of the way.
act: async p => {
await closeDayDetails(p)
await stop(p, SPARE.name).evaluate(el => el.scrollIntoView({ block: 'center' }))
await settle(p)
},
},
],
cleanup: p => deleteByName(p, SPARE.name),
},
@@ -474,6 +488,8 @@ const SCRIPTS: Record<string, GuideScript> = {
},
{
target: p => noteDialog(p).getByText('Icon', { exact: true }).locator('xpath=../..'),
// Pointed at the heading: the block's centre is an icon whose tooltip would stand in it.
hover: async p => { await noteDialog(p).getByText('Icon', { exact: true }).hover() },
act: async p => {
await noteDialog(p).getByRole('button', { name: 'Add', exact: true }).click()
await expect(noteDialog(p)).toHaveCount(0)
@@ -528,7 +544,9 @@ const SCRIPTS: Record<string, GuideScript> = {
guide: guide('manage-days'),
start: p => openTrip(p),
steps: [
only(p => dayHeader(p, 1)),
// The dates, and with them the days, are changed in the trip's edit form,
// which Trip settings at the top of the planner opens.
only(p => p.getByRole('button', { name: 'Trip settings' }).first()),
{
prepare: async p => {
await p.getByRole('button', { name: 'Reorder days' }).click()
@@ -655,6 +673,7 @@ const SCRIPTS: Record<string, GuideScript> = {
only(p => modal(p).getByText('Document', { exact: true }).locator('xpath=ancestor::section[1]')),
only(p => modal(p).getByText('Calendar', { exact: true }).locator('xpath=ancestor::section[1]')),
only(p => modal(p).getByText(/^Maps & GPS/).locator('xpath=ancestor::section[1]')),
only(p => modal(p).getByText(/^Google Maps/).locator('xpath=ancestor::section[1]')),
],
cleanup: closeModal,
},
+307 -143
View File
@@ -17,8 +17,12 @@ import type { HelpGuide } from '../../src/help/types'
* not undo their changes one by one: the list is snapshotted once before the
* first guide (`fixtures-trip-lists.ts`) and put back from that snapshot when
* each packing guide starts and again when it ends. What lives outside the
* items (a template, a bag, a list's assignees, a task) is removed by the
* guide that made it.
* items (a template, a bag, a list's assignees, who brings or sees an item, a
* task) is removed by the guide that made it.
*
* A packing row shows only what is set; a click on its name opens the item's
* window, where every choice about the item lives. The list-wide actions sit
* in the menu behind the three dots next to Add list.
*/
const guide = (id: string): HelpGuide => {
@@ -57,16 +61,23 @@ const OPEN_ITEM = 'Slip-on shoes for temples'
/** A list with one open item, so Check All visibly finishes it. */
const CHECK_ALL_LIST = 'Electronics'
const CHECK_ALL_OPEN = 'eSIM activation code'
/** Fully packed in the seed, so the Open filter hides its list. */
/** Fully packed in the seed, so Hide packed hides its list. */
const PACKED_ITEM = 'Passport'
/** What the ordering guide moves: the third list onto the first, then the last item of that first list to its top. */
const MOVED_LIST = 'Electronics'
const FIRST_LIST = 'Documents'
const MOVED_ITEM = 'Credit card and some yen'
const TOP_ITEM = 'Passport'
/** A to Z puts this one first in Clothing, where the seed has it in the middle. */
const SORTED_LIST = 'Clothing'
const SORTED_FIRST = 'Light layers'
/** Packed in the seed; the counting guide unticks it and counts five pairs in. */
const PIECES_ITEM = 'Merino socks'
const PIECES = 5
/** The item whose window the editing guide walks through; it gets a second bringer. */
const EDIT_ITEM = 'Power bank'
/** The list the whole-list sharing guide hands to one person. */
const SHARE_LIST = 'Toiletries'
/** The count in the label moves with what is ticked, so it is matched, not spelled. */
const CLEAR_CHECKED = /^Remove \d+ checked$/
@@ -76,8 +87,8 @@ const CLEAR_CHECKED = /^Remove \d+ checked$/
const cat = (page: Page, name: string): Locator =>
page.getByText(name, { exact: true }).first().locator('xpath=ancestor::div[2]')
/**
* The head band of a card. The ⋯ has to be taken from here: every item row
* carries a ⋯ of its own, so the card as a whole holds several of them.
* The head band of a card. The ⋯ has to be taken from here: the card's rows
* and its add field hold buttons of their own.
*/
const catHeader = (page: Page, name: string): Locator => cat(page, name).locator('> div').first()
const catMenu = (page: Page, name: string): Locator =>
@@ -91,48 +102,38 @@ const item = (page: Page, name: string): Locator =>
page.locator('.packing-item-row').filter({ hasText: name }).first()
/** A row's own grip is a bare draggable div, the first thing in the row. */
const rowGrip = (page: Page, name: string): Locator => item(page, name).locator('div[draggable="true"]')
/** The name of a row is the button that opens the item's window. */
const itemName = (page: Page, name: string): Locator => item(page, name).locator('button[aria-haspopup="dialog"]')
/** The item's window, portalled to <body>; only one is ever open. */
const itemWindow = (page: Page): Locator => page.locator('div[role="dialog"].trek-menu-enter')
/** The short list a pill of the window opens under its line. */
const choiceList = (page: Page): Locator => itemWindow(page).locator('div.max-h-56')
/** A line of the window found by its label, for the pill on it. */
const windowLine = (page: Page, label: string): Locator =>
itemWindow(page).getByText(label, { exact: true }).locator('xpath=..')
/** The two-column grid of list cards; its children are the cards, in order. */
const listGrid = (page: Page): Locator =>
page.locator('div.grid').filter({ has: page.locator('.packing-item-row') }).first()
/** The only item of the list the first guide builds; its name changes mid-guide. */
const onlyRow = (page: Page): Locator => cat(page, NEW_LIST).locator('.packing-item-row').first()
/** An item's own ⋯, which holds Move to List, Sharing, Rename and Delete. */
const rowMenu = (page: Page, name: string): Locator => item(page, name).locator('.packing-row-overflow button')
/** The open item menu; Sharing is a whole line in it. */
const rowMenuSharing = (page: Page): Locator =>
page.locator('.trek-menu-enter').getByRole('button', { name: /^Sharing/ })
/**
* The progress card's count and percentage. The total is a span of its own
* that reads "/28"; the category badges hold "n/m" in one span, so they never match.
*/
const progressCount = (page: Page): Locator =>
page.getByText(/^\/\d+$/).first().locator('xpath=ancestor::div[2]')
/** The quantity badge is the first field among a row's inline actions while it has no counter. */
const quantityField = (page: Page, name: string): Locator =>
item(page, name).locator('.packing-row-inline-actions input').first()
/** The packed counter of a multi-piece item, named "3 of 5 packed". */
const piecesCounter = (page: Page, name: string): Locator =>
item(page, name).getByRole('group', { name: / of \d+ packed$/ })
/** The line beside Shared and My list that counts what is packed. */
const progressLine = (page: Page): Locator => page.getByText(/^\d+ of \d+ packed$/).first().locator('xpath=..')
/** The name dialog that Add list and Save as template open. */
const nameDialog = (page: Page, confirm: string): Locator => page.getByRole('button', { name: confirm, exact: true })
/** The sharing dropdown is portalled to <body>, so the hint's parent is the card itself. */
const shareMenu = (page: Page): Locator =>
page.getByText('In the group pool, visible to everyone').locator('xpath=ancestor::div[1]')
/** Its click-catcher, the only way back out of the menu once a name is ticked. */
const shareOverlay = (page: Page): Locator => page.locator('div[role="presentation"][style*="z-index: 1099"]').last()
/** The three dots next to Add list, and the menu they open. */
const listsMenuButton = (page: Page): Locator =>
page.getByRole('button', { name: 'Add list' }).locator('xpath=..').getByRole('button', { name: 'Show more' })
const listsMenu = (page: Page): Locator => page.getByRole('menu')
/** The bulk-import dialog, a DialogShell whose head band carries its title. */
const importCard = (page: Page): Locator =>
page.getByRole('dialog').filter({ has: page.getByText('Import Packing List', { exact: true }) })
/**
* The bag picker of a row and the member picker of a bag both hang off the
* body, so they are found by their caption rather than inside the row.
*/
const bagPicker = (page: Page): Locator => page.locator('.trek-menu-enter').filter({ hasText: 'Bags' }).last()
/** The whole-list sharing dialog, found by its footer button. */
const listSharing = (page: Page): Locator =>
page.getByRole('dialog').filter({ has: page.getByRole('button', { name: 'Apply to list' }) })
/** The member picker of a bag hangs off the body, so it is found by its caption. */
const bagMemberPicker = (page: Page): Locator => page.locator('.trek-menu-enter').filter({ hasText: 'Assign members' }).last()
/** The calendar a date field opens, a portal of its own. */
const datePicker = (page: Page): Locator => page.getByRole('dialog', { name: 'Date picker' })
/** The Export button's menu: print, Markdown and CSV. */
const exportMenu = (page: Page): Locator => page.getByRole('menu')
/** The printable page inside the preview, a srcdoc frame of its own. */
const printFrame = (page: Page) => page.frameLocator('iframe[title^="Packing List"]')
/** The bag sidebar: the innermost box holding the guide's bag and the weight summary below the cards. */
@@ -177,6 +178,35 @@ async function openTodos(page: Page): Promise<void> {
await settle(page)
}
/** The three dots next to Add list, opened. */
async function openListsMenu(page: Page): Promise<void> {
await listsMenuButton(page).click()
await expect(listsMenu(page)).toBeVisible()
await beat(page, 300)
}
/**
* The menu and the item window sit over a full-viewport catcher; a click in
* the corner closes either without touching what is under it.
*/
async function clickAside(page: Page): Promise<void> {
await page.mouse.click(20, VIEWPORT.height - 40)
}
/** Opens an item's window, with its row in the middle of the screen so the window has room below it. */
async function openItem(page: Page, name: string): Promise<void> {
await item(page, name).evaluate(el => el.scrollIntoView({ block: 'center' }))
await itemName(page, name).click()
await expect(itemWindow(page)).toBeVisible()
await settle(page)
}
async function closeItem(page: Page): Promise<void> {
await itemWindow(page).getByRole('button', { name: 'Close', exact: true }).click()
await expect(itemWindow(page)).toHaveCount(0)
await settle(page)
}
// ── Putting the seed back ────────────────────────────────────────────────────
/** The packing list as the seed and the fixtures left it, taken in beforeAll. */
@@ -198,6 +228,9 @@ async function startLists(page: Page): Promise<void> {
interface PackingRow {
id: number
name: string
category: string | null
is_private?: number | boolean
contributors?: { user_id: number; username: string }[]
}
async function packingItems(page: Page): Promise<PackingRow[]> {
@@ -207,6 +240,24 @@ async function packingItems(page: Page): Promise<PackingRow[]> {
return body.items ?? []
}
/** Puts items back into the group pool, the seed's tier for every item. */
async function shareWithEveryone(page: Page, rows: PackingRow[]): Promise<void> {
const { tripId } = seededTrip()
for (const row of rows) {
await page.request.put(`/api/trips/${tripId}/packing/${row.id}/sharing`, { data: { visibility: 'common', recipient_ids: [] } })
}
}
/** Takes a member off the people who bring an item. */
async function dropBringer(page: Page, itemName: string, username: string): Promise<void> {
const { tripId } = seededTrip()
const row = (await packingItems(page)).find(x => x.name === itemName)
if (!row) return
for (const c of (row.contributors ?? []).filter(x => x.username === username)) {
await page.request.delete(`/api/trips/${tripId}/packing/${row.id}/contributors/${c.user_id}`)
}
}
async function deleteTemplate(page: Page, name: string): Promise<void> {
const res = await page.request.get('/api/admin/packing-templates')
const body = (await res.json()) as { templates?: { id: number; name: string }[] }
@@ -266,7 +317,7 @@ const SCRIPTS: Record<string, GuideScript> = {
await cat(p, NEW_LIST).getByRole('button', { name: 'Add item' }).click()
const field = p.getByPlaceholder('Item name...')
await typeInto(p, field, FIRST_ITEM)
// Enter renames the list's '...' row rather than adding a second one,
// Enter fills the list's empty row rather than adding a second one,
// and leaves the field open; Escape is how it closes.
await field.press('Enter')
await expect(item(p, FIRST_ITEM)).toBeVisible({ timeout: 20_000 })
@@ -275,18 +326,19 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
{
prepare: async p => { await onlyRow(p).hover() },
// A click on the name renames it; the row has no pencil of its own.
target: p => onlyRow(p).getByRole('button', { name: FIRST_ITEM }),
prepare: async p => {
await onlyRow(p).locator('button[aria-haspopup="dialog"]').click()
await expect(itemWindow(p)).toBeVisible()
await settle(p)
},
// The name at the top of the window is the field the text means.
target: p => itemWindow(p).getByRole('textbox', { name: 'Rename' }),
act: async p => {
await onlyRow(p).getByRole('button', { name: FIRST_ITEM }).click()
// While editing, the name is the row's first input; the quantity and
// the weight come after it.
const field = onlyRow(p).locator('input').first()
const field = itemWindow(p).getByRole('textbox', { name: 'Rename' })
await typeInto(p, field, RENAMED_ITEM)
await field.press('Enter')
await expect(item(p, RENAMED_ITEM)).toBeVisible({ timeout: 20_000 })
await settle(p)
await closeItem(p)
},
},
{
@@ -301,8 +353,11 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
{
// Shown on the first list: the new one is the last card on the page, and
// its menu would run past the bottom of the screen.
prepare: async p => {
await catMenu(p, NEW_LIST).click()
await catHeader(p, FIRST_LIST).evaluate(el => el.scrollIntoView({ block: 'center' }))
await catMenu(p, FIRST_LIST).click()
await expect(p.getByRole('button', { name: 'Delete List' })).toBeVisible()
await beat(p, 300)
},
@@ -310,14 +365,15 @@ const SCRIPTS: Record<string, GuideScript> = {
// The pointer rests on the three dots that opened it, not on an entry.
// Moved by coordinates: the menu's click-catcher covers the button.
hover: async p => {
const b = await catMenu(p, NEW_LIST).boundingBox()
const b = await catMenu(p, FIRST_LIST).boundingBox()
if (b) await p.mouse.move(b.x + b.width / 2, b.y + b.height / 2)
},
act: async p => {
// The menu sits over a full-viewport catcher; a click in the corner
// closes it without deleting the list the picture was just taken of.
await p.mouse.click(20, VIEWPORT.height - 40)
// A click in the corner closes the menu without deleting the list the picture was just taken of.
await clickAside(p)
await expect(p.getByRole('button', { name: 'Delete List' })).toHaveCount(0)
// Back to the new list for the after-picture.
await cat(p, NEW_LIST).evaluate(el => el.scrollIntoView({ block: 'center' }))
await settle(p)
},
},
@@ -328,6 +384,61 @@ const SCRIPTS: Record<string, GuideScript> = {
await p.request.put(`/api/trips/${tripId}/packing/category-assignees/${encodeURIComponent(NEW_LIST)}`, { data: { user_ids: [] } })
},
},
'edit-packing-item': {
guide: guide('edit-packing-item'),
start: async p => {
await dropBringer(p, EDIT_ITEM, MEMBER)
await startLists(p)
},
steps: [
{
target: p => itemName(p, EDIT_ITEM),
act: p => openItem(p, EDIT_ITEM),
},
only(p => itemWindow(p).getByRole('textbox', { name: 'Rename' })),
{
prepare: async p => {
await windowLine(p, 'List').getByRole('button').click()
await expect(choiceList(p)).toBeVisible()
await settle(p)
},
target: choiceList,
// The pointer on another list, as if about to pick it.
hover: async p => { await choiceList(p).getByRole('button', { name: FIRST_LIST, exact: true }).hover() },
act: async p => {
// Shown, not picked: the item would leave its row and the window with it.
await windowLine(p, 'List').getByRole('button').click()
await expect(choiceList(p)).toHaveCount(0)
await settle(p)
},
},
{
prepare: async p => {
await windowLine(p, 'Brought by').getByRole('button').click()
await expect(choiceList(p)).toBeVisible()
await settle(p)
},
target: choiceList,
hover: async p => { await choiceList(p).getByRole('button', { name: MEMBER, exact: true }).hover() },
act: async p => {
await choiceList(p).getByRole('button', { name: MEMBER, exact: true }).click()
await expect(windowLine(p, 'Brought by')).toContainText(MEMBER, { timeout: 20_000 })
await windowLine(p, 'Brought by').getByRole('button').click()
await expect(choiceList(p)).toHaveCount(0)
await settle(p)
},
},
{
target: p => itemWindow(p).getByRole('button', { name: 'Delete', exact: true }),
// Shown, not pressed: the window closes with its cross.
act: closeItem,
},
],
cleanup: async p => {
await dropBringer(p, EDIT_ITEM, MEMBER)
await resetPacking(p)
},
},
'arrange-packing-list': {
guide: guide('arrange-packing-list'),
start: startLists,
@@ -355,10 +466,14 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
{
target: p => p.getByRole('button', { name: 'A to Z' }),
prepare: openListsMenu,
target: p => listsMenu(p).getByRole('button', { name: 'A to Z' }),
act: async p => {
await p.getByRole('button', { name: 'A to Z' }).click()
await expect(p.getByRole('button', { name: 'A to Z' })).toHaveAttribute('aria-pressed', 'true')
await listsMenu(p).getByRole('button', { name: 'A to Z' }).click()
// The order is a switch with a tick; the menu stays open for the next one.
await clickAside(p)
await expect(listsMenu(p)).toHaveCount(0)
await expect(cat(p, SORTED_LIST).locator('.packing-item-row').first()).toContainText(SORTED_FIRST, { timeout: 20_000 })
await settle(p)
},
},
@@ -375,17 +490,14 @@ const SCRIPTS: Record<string, GuideScript> = {
start: startLists,
steps: [
{
// The grip is a div, so the tick box is the row's first button.
target: p => item(p, OPEN_ITEM).getByRole('button').first(),
target: p => item(p, OPEN_ITEM).locator('.packing-check'),
act: async p => {
await item(p, OPEN_ITEM).getByRole('button').first().click()
await item(p, OPEN_ITEM).locator('.packing-check').click()
await expect(item(p, OPEN_ITEM).locator('.packing-check')).toHaveAttribute('aria-pressed', 'true', { timeout: 20_000 })
await settle(p)
},
},
// The count and the percentage, with the bar beside them: the whole card is
// wider than any frame and would lose both at its edges.
only(progressCount),
only(progressLine),
{
prepare: async p => {
await catMenu(p, CHECK_ALL_LIST).click()
@@ -400,23 +512,27 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
{
target: p => p.getByRole('button', { name: 'Open', exact: true }),
prepare: openListsMenu,
target: p => listsMenu(p).getByRole('button', { name: 'Hide packed' }),
act: async p => {
await p.getByRole('button', { name: 'Open', exact: true }).click()
await listsMenu(p).getByRole('button', { name: 'Hide packed' }).click()
await clickAside(p)
await expect(listsMenu(p)).toHaveCount(0)
await expect(item(p, PACKED_ITEM)).toHaveCount(0, { timeout: 20_000 })
await settle(p)
},
},
{
target: p => p.getByRole('button', { name: CLEAR_CHECKED }),
prepare: openListsMenu,
target: p => listsMenu(p).getByRole('button', { name: CLEAR_CHECKED }),
act: async p => {
// A native window.confirm, which cannot be pictured. The step shows the
// button and answers the browser with Cancel: with the Open filter on,
// the screen looks the same either way, and the seed's ticked items
// (most of the list) stay where they are for the guides after this one.
// entry and answers the browser with Cancel: with the packed items
// hidden, the screen looks the same either way, and the seed's ticked
// items (most of the list) stay where they are for the guides after this one.
p.once('dialog', d => { void d.dismiss() })
await p.getByRole('button', { name: CLEAR_CHECKED }).click()
await expect(p.getByRole('button', { name: CLEAR_CHECKED })).toBeVisible()
await listsMenu(p).getByRole('button', { name: CLEAR_CHECKED }).click()
await expect(listsMenu(p)).toHaveCount(0)
await settle(p)
},
},
@@ -432,39 +548,34 @@ const SCRIPTS: Record<string, GuideScript> = {
},
steps: [
{
prepare: async p => { await item(p, PIECES_ITEM).hover() },
target: p => quantityField(p, PIECES_ITEM),
target: p => itemName(p, PIECES_ITEM),
act: p => openItem(p, PIECES_ITEM),
},
{
target: p => itemWindow(p).getByRole('group', { name: 'Qty' }),
act: async p => {
const field = quantityField(p, PIECES_ITEM)
const field = itemWindow(p).getByRole('group', { name: 'Qty' }).locator('input')
await typeInto(p, field, String(PIECES))
await field.press('Enter')
await expect(piecesCounter(p, PIECES_ITEM)).toHaveAccessibleName(`0 of ${PIECES} packed`, { timeout: 20_000 })
await expect(itemWindow(p).getByRole('group', { name: `0 of ${PIECES} packed` })).toBeVisible({ timeout: 20_000 })
await settle(p)
},
},
{
target: p => piecesCounter(p, PIECES_ITEM),
target: p => itemWindow(p).getByRole('group', { name: / of \d+ packed$/ }),
act: async p => {
for (let n = 1; n <= 3; n++) {
await item(p, PIECES_ITEM).getByRole('button', { name: 'Pack one more' }).click()
await expect(piecesCounter(p, PIECES_ITEM)).toHaveAccessibleName(`${n} of ${PIECES} packed`, { timeout: 20_000 })
await itemWindow(p).getByRole('button', { name: 'Pack one more' }).click()
await expect(itemWindow(p).getByRole('group', { name: `${n} of ${PIECES} packed` })).toBeVisible({ timeout: 20_000 })
}
await settle(p)
},
},
{
// Partly packed: the counter in the accent, the tick box outlined in it.
// Partly packed: the count in the row, the tick box outlined in the accent.
prepare: closeItem,
target: p => item(p, PIECES_ITEM),
act: async p => {
for (let n = 4; n <= PIECES; n++) {
await item(p, PIECES_ITEM).getByRole('button', { name: 'Pack one more' }).click()
await expect(piecesCounter(p, PIECES_ITEM)).toHaveAccessibleName(`${n} of ${PIECES} packed`, { timeout: 20_000 })
}
await expect(item(p, PIECES_ITEM).locator('.packing-check')).toHaveAttribute('aria-pressed', 'true', { timeout: 20_000 })
await settle(p)
},
},
only(p => item(p, PIECES_ITEM)),
],
cleanup: resetPacking,
},
@@ -473,26 +584,32 @@ const SCRIPTS: Record<string, GuideScript> = {
start: startLists,
steps: [
{
target: p => p.getByRole('button', { name: 'Apply template' }),
target: listsMenuButton,
act: async p => {
await p.getByRole('button', { name: 'Apply template' }).click()
await expect(p.locator('.trek-menu-enter').last()).toBeVisible()
await openListsMenu(p)
await settle(p)
},
},
{
target: p => p.locator('.trek-menu-enter').last(),
prepare: async p => {
await listsMenu(p).getByRole('button', { name: 'Apply template' }).click()
await expect(listsMenu(p).getByRole('button', { name: new RegExp(`^${TEMPLATE.name}`) })).toBeVisible()
await settle(p)
},
target: p => listsMenu(p).getByRole('button', { name: new RegExp(`^${TEMPLATE.name}`) }),
act: async p => {
await p.locator('.trek-menu-enter').last().getByRole('button', { name: new RegExp(`^${TEMPLATE.name}`) }).click()
await listsMenu(p).getByRole('button', { name: new RegExp(`^${TEMPLATE.name}`) }).click()
await expect(cat(p, TEMPLATE.category)).toBeVisible({ timeout: 30_000 })
await expect(listsMenu(p)).toHaveCount(0)
await settle(p)
},
},
only(p => p.getByRole('button', { name: /^Shared/ })),
{
target: p => p.getByRole('button', { name: 'Save as template' }),
prepare: openListsMenu,
target: p => listsMenu(p).getByRole('button', { name: 'Save as template' }),
act: async p => {
await p.getByRole('button', { name: 'Save as template' }).click()
await listsMenu(p).getByRole('button', { name: 'Save as template' }).click()
const field = p.getByPlaceholder('Template name')
await typeInto(p, field, SAVED_TEMPLATE)
await nameDialog(p, 'Save').click()
@@ -511,10 +628,10 @@ const SCRIPTS: Record<string, GuideScript> = {
start: startLists,
steps: [
{
// An icon at the right end of the bar, named Import by its label and tooltip.
target: p => p.getByRole('button', { name: 'Import', exact: true }),
prepare: openListsMenu,
target: p => listsMenu(p).getByRole('button', { name: 'Import', exact: true }),
act: async p => {
await p.getByRole('button', { name: 'Import', exact: true }).click()
await listsMenu(p).getByRole('button', { name: 'Import', exact: true }).click()
await expect(importCard(p)).toBeVisible()
await settle(p)
},
@@ -555,19 +672,21 @@ const SCRIPTS: Record<string, GuideScript> = {
start: startLists,
steps: [
{
target: p => p.getByRole('button', { name: 'Export', exact: true }),
target: listsMenuButton,
act: async p => {
await p.getByRole('button', { name: 'Export', exact: true }).click()
await expect(exportMenu(p)).toBeVisible()
await openListsMenu(p)
await settle(p)
},
},
// The two file entries download at once; the step shows them, it does not press them.
only(exportMenu),
{
target: p => exportMenu(p).getByRole('menuitem', { name: 'Print or save as PDF' }),
target: listsMenu,
hover: async p => { await listsMenu(p).getByRole('button', { name: 'CSV for import (.csv)' }).hover() },
},
{
target: p => listsMenu(p).getByRole('button', { name: 'Print or save as PDF' }),
act: async p => {
await exportMenu(p).getByRole('menuitem', { name: 'Print or save as PDF' }).click()
await listsMenu(p).getByRole('button', { name: 'Print or save as PDF' }).click()
await expect(printFrame(p).locator('h1')).toBeVisible({ timeout: 15_000 })
// The page carries the app's own Poppins; the result picture waits for it.
await printFrame(p).locator('body').evaluate(async () => { await document.fonts.ready })
@@ -577,7 +696,7 @@ const SCRIPTS: Record<string, GuideScript> = {
// Pressing it opens the operating system's print dialog, which is not part
// of the picture; the button is shown, not pressed. The result picture is the
// preview itself.
only(p => p.getByRole('button', { name: 'Print or save as PDF' })),
only(p => p.getByRole('button', { name: 'Print or save as PDF' }).last()),
],
cleanup: async p => {
await p.getByRole('button', { name: 'Close', exact: true }).first().click()
@@ -598,24 +717,17 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
{
prepare: async p => {
await item(p, SHARED_ITEM).hover()
await rowMenu(p, SHARED_ITEM).click()
await expect(rowMenuSharing(p)).toBeVisible()
await beat(p, 300)
},
target: rowMenuSharing,
act: async p => {
await rowMenuSharing(p).click()
await expect(shareMenu(p)).toBeVisible()
await settle(p)
},
prepare: p => openItem(p, SHARED_ITEM),
// The whole line: its label and the three choices.
target: p => itemWindow(p).getByRole('radiogroup', { name: 'Visible to' }).locator('xpath=../..'),
},
{
target: shareMenu,
target: p => itemWindow(p).getByRole('radio', { name: 'Only me' }),
act: async p => {
await shareMenu(p).getByRole('button', { name: /^Personal/ }).click()
await itemWindow(p).getByRole('radio', { name: 'Only me' }).click()
// The row leaves the shared list, and its window goes with it.
await expect(item(p, SHARED_ITEM)).toHaveCount(0, { timeout: 20_000 })
await expect(itemWindow(p)).toHaveCount(0)
await settle(p)
},
},
@@ -629,31 +741,80 @@ const SCRIPTS: Record<string, GuideScript> = {
},
{
prepare: async p => {
await item(p, SHARED_ITEM).hover()
await rowMenu(p, SHARED_ITEM).click()
await rowMenuSharing(p).click()
await expect(shareMenu(p)).toBeVisible()
await openItem(p, SHARED_ITEM)
await itemWindow(p).getByRole('radio', { name: 'Selected' }).click()
await expect(choiceList(p)).toBeVisible()
await settle(p)
},
target: choiceList,
hover: async p => { await choiceList(p).getByRole('button', { name: MEMBER, exact: true }).hover() },
act: async p => {
await choiceList(p).getByRole('button', { name: MEMBER, exact: true }).click()
await expect(item(p, SHARED_ITEM).getByLabel('shared with 1')).toBeVisible({ timeout: 20_000 })
await closeItem(p)
},
},
],
cleanup: async p => {
await shareWithEveryone(p, (await packingItems(p)).filter(x => x.name === SHARED_ITEM))
await resetPacking(p)
},
},
'share-packing-list': {
guide: guide('share-packing-list'),
start: async p => {
await shareWithEveryone(p, (await packingItems(p)).filter(x => x.category === SHARE_LIST))
await startLists(p)
},
steps: [
{
prepare: async p => {
await catMenu(p, SHARE_LIST).click()
await expect(p.getByRole('button', { name: 'Sharing for Whole List' })).toBeVisible()
await beat(p, 300)
},
target: p => shareMenu(p).getByRole('button', { name: MEMBER }),
target: p => p.getByRole('button', { name: 'Sharing for Whole List' }),
act: async p => {
await shareMenu(p).getByRole('button', { name: MEMBER }).click()
// Ticking a name leaves the menu open on purpose; its catcher closes it,
// and the item menu under it has one of its own.
await shareOverlay(p).click({ position: { x: 5, y: 5 } })
await p.mouse.click(20, VIEWPORT.height - 40)
await expect(p.locator('.trek-menu-enter')).toHaveCount(0)
await expect(item(p, SHARED_ITEM).getByLabel('shared with 1')).toBeVisible({ timeout: 20_000 })
await p.getByRole('button', { name: 'Sharing for Whole List' }).click()
await expect(listSharing(p)).toBeVisible()
await settle(p)
},
},
{
// The box of the three tiers; the list starts on Shared, where the seed has it.
target: p => listSharing(p).getByRole('button', { name: /^Shared with/ }).locator('xpath=..'),
hover: async p => { await listSharing(p).getByRole('button', { name: /^Shared with/ }).hover() },
act: async p => {
await listSharing(p).getByRole('button', { name: /^Shared with/ }).click()
await expect(listSharing(p).getByRole('button', { name: MEMBER, exact: true })).toBeVisible()
await settle(p)
},
},
{
target: p => listSharing(p).getByRole('button', { name: MEMBER, exact: true }),
act: async p => {
await listSharing(p).getByRole('button', { name: MEMBER, exact: true }).click()
await expect(listSharing(p).getByRole('button', { name: MEMBER, exact: true })).toHaveAttribute('aria-pressed', 'true')
await settle(p)
},
},
{
target: p => listSharing(p).getByRole('button', { name: 'Apply to list' }),
act: async p => {
await listSharing(p).getByRole('button', { name: 'Apply to list' }).click()
await expect(listSharing(p)).toHaveCount(0, { timeout: 30_000 })
// The confirmation is a toast; the after-picture waits for it to go.
const done = p.getByText(`Sharing changed for "${SHARE_LIST}"`)
await expect(done).toBeVisible({ timeout: 20_000 })
await p.getByRole('button', { name: /^My list/ }).click()
await expect(cat(p, SHARE_LIST)).toBeVisible({ timeout: 20_000 })
await expect(done).toHaveCount(0, { timeout: 20_000 })
await settle(p)
},
},
],
cleanup: async p => {
const { tripId } = seededTrip()
const row = (await packingItems(p)).find(x => x.name === SHARED_ITEM)
if (row) {
await p.request.put(`/api/trips/${tripId}/packing/${row.id}/sharing`, { data: { visibility: 'common', recipient_ids: [] } })
}
await shareWithEveryone(p, (await packingItems(p)).filter(x => x.category === SHARE_LIST))
await resetPacking(p)
},
},
@@ -666,35 +827,38 @@ const SCRIPTS: Record<string, GuideScript> = {
},
steps: [
{
prepare: p => openItem(p, BAG_ITEM),
// The weight field's placeholder really is a dash: it is the app's own
// string, not prose, so it is matched exactly as rendered.
target: p => item(p, BAG_ITEM).getByPlaceholder('—'),
// string, not prose, so it is matched exactly as rendered. The ring takes
// the whole pill, the grams with it.
target: p => itemWindow(p).getByPlaceholder('—').locator('xpath=..'),
act: async p => {
const field = item(p, BAG_ITEM).getByPlaceholder('—')
const field = itemWindow(p).getByPlaceholder('—')
await typeInto(p, field, '620')
await field.press('Enter')
await expect(field).toHaveValue('620', { timeout: 20_000 })
await settle(p)
},
},
{
prepare: async p => { await item(p, BAG_ITEM).hover() },
// The circle is dashed with a parcel in it while the item is in no bag.
target: p => item(p, BAG_ITEM).locator('button:has(svg.lucide-package)'),
target: p => windowLine(p, 'Bag').getByRole('button'),
act: async p => {
await item(p, BAG_ITEM).locator('button:has(svg.lucide-package)').click()
await expect(bagPicker(p).getByRole('button', { name: 'Add bag' })).toBeVisible()
await windowLine(p, 'Bag').getByRole('button').click()
await expect(itemWindow(p).getByPlaceholder('Add bag')).toBeVisible()
await settle(p)
},
},
{
target: p => bagPicker(p).getByRole('button', { name: 'Add bag' }),
// The line at the end of the bag list, with its round add button.
target: p => itemWindow(p).getByPlaceholder('Add bag').locator('xpath=..'),
act: async p => {
await bagPicker(p).getByRole('button', { name: 'Add bag' }).click()
const field = bagPicker(p).getByPlaceholder('Bag name...')
const field = itemWindow(p).getByPlaceholder('Add bag')
await typeInto(p, field, BAG)
await field.press('Enter')
await expect(windowLine(p, 'Bag')).toContainText(BAG, { timeout: 30_000 })
// The window repeats Total weight and the bag's name, so it goes before the card is looked for.
await closeItem(p)
await expect(bagSidebar(p)).toBeVisible({ timeout: 30_000 })
await expect(bagPicker(p)).toHaveCount(0)
await settle(p)
},
},
@@ -722,7 +886,7 @@ const SCRIPTS: Record<string, GuideScript> = {
await bagSidebar(p).locator('button[style*="dashed"]').first().click()
await bagMemberPicker(p).getByRole('button', { name: MEMBER }).click()
// The picker closes on a click anywhere beside it.
await p.mouse.click(20, VIEWPORT.height - 40)
await clickAside(p)
await expect(bagSidebar(p).getByRole('button', { name: MEMBER })).toBeVisible({ timeout: 20_000 })
// A bag with someone on it fills Per person at the foot of the card.
await expect(p.getByText('Per person', { exact: true })).toBeVisible({ timeout: 20_000 })
+87 -15
View File
@@ -310,6 +310,32 @@ interface TrekGlMap {
easeTo: (o: { bearing: number; pitch: number; duration: number }) => unknown
}
/** Turn the GL map to a bearing at once, and wait until it has painted it. */
/**
* How far the compass guide turns the map. The vector labels stay level at any
* bearing, and the compass icon is drawn leaning 45° to the right, so at 35°
* the map read as north up and the arrow as upright. At 70° the coast lies
* visibly askew and the arrow leans the other way.
*/
const TURN = 70
async function turnMap(page: Page, bearing: number): Promise<void> {
await page.evaluate(b => {
const m = (window as unknown as { __trek_map?: TrekGlMap }).__trek_map
if (!m) throw new Error('no GL map on the page')
m.easeTo({ bearing: b, pitch: 0, duration: 0 })
}, bearing)
await page.waitForFunction(b => {
const m = (window as unknown as { __trek_map?: TrekGlMap }).__trek_map
return !!m && Math.abs(m.getBearing() - b) < 0.5 && !m.isMoving()
}, bearing)
await page.evaluate(() => new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r))))
}
/** The GL map's bearing now. */
const mapBearing = (page: Page): Promise<number> =>
page.evaluate(() => (window as unknown as { __trek_map?: TrekGlMap }).__trek_map?.getBearing() ?? 0)
/** Wait until the GL map has its style, its tiles and a still camera. */
async function glMapIdle(page: Page): Promise<void> {
await page.waitForFunction(
@@ -369,6 +395,8 @@ let found = ''
let tourOnDay: TourOnDay | null = null
let line = { index: 0, x: 0, y: 0 }
let clickedTour = ''
/** Why the Dawarich connection could not be made (no media.env), for the one guide that needs it. */
let dawarichMissing: Error | null = null
const NEW_PLACE = 'Lunch stop'
@@ -421,6 +449,28 @@ const SCRIPTS: Record<string, GuideScript> = {
// captureGuide hovers the target itself; this only makes sure the card
// is up before the shot rather than a frame after it.
prepare: async p => {
// The card asks for the full photo, not the pin's thumb, and for some
// seeded places the photo proxy answers nothing: the card then shows a
// broken image. Walk the reachable photo pins until one card shows its
// photo, and keep that pin for the steps after this one.
const total = await photoPins(p).count()
for (let i = 0; i < total; i++) {
const candidate = photoPins(p).nth(i)
try {
await candidate.hover({ timeout: 1500 })
} catch {
continue
}
if (!(await hoverCard(p).isVisible().catch(() => false))) continue
const loaded = await expect.poll(
() => hoverCard(p).locator('img').evaluateAll(imgs => imgs.length > 0 && imgs.every(img => (img as HTMLImageElement).complete && (img as HTMLImageElement).naturalWidth > 0)),
{ timeout: 6_000 },
).toBe(true).then(() => true, () => false)
if (!loaded) continue
await p.locator('#trek-map [data-help-pin]').evaluateAll(els => els.forEach(el => el.removeAttribute('data-help-pin')))
await candidate.evaluate(el => el.setAttribute('data-help-pin', ''))
break
}
await markerPin(p).hover()
await expect(hoverCard(p)).toBeVisible({ timeout: 10_000 })
},
@@ -451,6 +501,13 @@ const SCRIPTS: Record<string, GuideScript> = {
await settle(p)
},
target: p => badged(p, 1),
// The badge is the subject, not the pin's card: the pointer waits on
// an empty spot, so no hover card covers the numbers.
hover: async p => {
const box = await map(p).boundingBox()
if (!box) throw new Error('the map has no box')
await p.mouse.move(box.x + EMPTY.x, box.y + EMPTY.y)
},
},
{
// Picture only, like the other drags in this family: HTML5 drag is what
@@ -726,7 +783,10 @@ const SCRIPTS: Record<string, GuideScript> = {
// along the Shinkansen and the walks through the cities vanish under the
// pins, so the map is framed on a day before the button is pressed;
// nothing fits the map to the trail.
start: openOnTokyo,
start: async p => {
if (dawarichMissing) throw dawarichMissing
await openOnTokyo(p)
},
steps: [
{
target: trailPill,
@@ -873,22 +933,28 @@ const SCRIPTS: Record<string, GuideScript> = {
{
// The turn itself is the map's own camera move rather than a synthetic
// right-button drag: a drag has to start on bare canvas, and the pins,
// the two floating columns and the explore pill all sit over it. 35°
// the two floating columns and the explore pill all sit over it. 70°
// is enough for the streets to lie visibly askew and the arrow to lean.
// A fit of the map to the day (MapLibre's fitBounds) also puts the
// bearing back to north, and one can still land after the turn while the
// trip's data settles: the earlier pictures caught the map upright for
// exactly that reason. So the turn is made again until it holds through
// a settle, and once more right before the shot.
prepare: async p => {
await p.evaluate(() => {
const m = (window as unknown as { __trek_map?: TrekGlMap }).__trek_map
if (!m) throw new Error('no GL map on the page')
m.easeTo({ bearing: 35, pitch: 0, duration: 0 })
})
await p.waitForFunction(() => {
const m = (window as unknown as { __trek_map?: TrekGlMap }).__trek_map
return !!m && Math.abs(m.getBearing() - 35) < 0.5 && !m.isMoving()
})
await settle(p)
for (let attempt = 0; attempt < 4; attempt++) {
await turnMap(p, TURN)
await settle(p)
if (Math.abs((await mapBearing(p)) - TURN) < 0.5) break
}
},
target: compassPill,
// The loop: the map turning from north to the still's 35°, the arrow
hover: async p => {
await resetNorth(p).hover()
if (Math.abs((await mapBearing(p)) - TURN) >= 0.5) await turnMap(p, TURN)
// The arrow follows the bearing with a 100 ms transition.
await p.waitForTimeout(300)
},
// The loop: the map turning from north to the still's bearing, the arrow
// leaning with it, and a pointer dragging sideways as a right-button
// turn would. The camera is moved by the map's own API, a notch a
// frame, for the reason the still's preparation gives.
@@ -915,7 +981,7 @@ const SCRIPTS: Record<string, GuideScript> = {
for (let i = 0; i < 3; i++) await frame()
for (let i = 1; i <= 14; i++) {
await p.mouse.move(x + (120 * i) / 14, y)
await turnTo((35 * i) / 14)
await turnTo((TURN * i) / 14)
await frame()
}
for (let i = 0; i < 4; i++) await frame()
@@ -952,7 +1018,13 @@ test.beforeAll(async ({ request }) => {
tourOnDay = await ensureTourOnDay(request)
// The recorded route: the addon on, the signed-in user connected to the
// Dawarich from media.env, the synthetic recording of the trip uploaded.
await ensureDawarichConnection(request)
// Without media.env it cannot be made; the Dawarich guide then fails at its
// start with the reason, and every other guide of the file still runs.
try {
await ensureDawarichConnection(request)
} catch (err) {
dawarichMissing = err instanceof Error ? err : new Error(String(err))
}
})
test.afterAll(async ({ request }) => {
+179 -33
View File
@@ -85,10 +85,25 @@ const weekday = (offset: number) => long(offset).split(',')[0]
const hoursRow = (page: Page) => card(page).locator('button:has(svg.lucide-clock)')
/** The hours block: the row and, once unfolded, the week in its place. */
const hoursBox = (page: Page) => section(page, 'Opening Hours')
/** The round picture in the head; its name says whether a picture of your own is set. */
const avatar = (page: Page) => card(page).getByRole('button', { name: /^(Upload image|Change image)$/ })
/** The popover the picture opens when the place has photos among its files. */
const imageChooser = (page: Page) => page.getByRole('dialog', { name: 'Choose a picture' })
/** Edit, the dark button at the right end of the card's footer. */
const editButton = (page: Page) => footer(page).getByRole('button', { name: 'Edit', exact: true })
/** Update, the place form's save button once the place exists. */
const updateButton = (page: Page) => modal(page).getByRole('button', { name: 'Update', exact: true })
/** The three dots of the footer: Remove from Day and Delete live there. */
const moreButton = (page: Page) => footer(page).getByRole('button', { name: 'More options', exact: true })
/** Pick a picture in the place form: the tiles and the credit line under them. */
const picker = (page: Page) =>
modal(page).getByText('Pick a picture', { exact: true }).first().locator('xpath=ancestor::section[1]')
/** The picker's first tile, which takes a picture from the device. */
const uploadTile = (page: Page) => picker(page).getByRole('button', { name: 'Upload image', exact: true })
/** The fold chevron in the card's head; its name follows the state. */
const foldButton = (page: Page, name: 'Collapse' | 'Expand') => head(page).getByRole('button', { name, exact: true })
/** The place the off-map guide puts in: an address a traveller typed, no pick from the search. */
const OFF_MAP = { name: 'Ramen at Karasuma Oike', address: 'Karasuma Oike, Nakagyo Ward, Kyoto', lat: '35.0107', lng: '135.7596' }
const NO_COORDINATES = 'No coordinates, so not on the map'
/** The form's location block: the address with its hint, and the two coordinate fields. */
const coordinates = (page: Page) => modal(page).getByRole('group', { name: 'Coordinates', exact: true })
const locationPanel = (page: Page) => coordinates(page).locator('xpath=..')
/** The place form's hours editor, found by its remove button (only there while editing). */
const hoursEditor = (page: Page) =>
modal(page).getByRole('button', { name: 'Remove opening hours' }).locator('xpath=ancestor::section[1]')
@@ -175,7 +190,7 @@ async function openStop(page: Page, name: string): Promise<void> {
// ── The seed over the API, for the cleanups ──────────────────────────────────
type ApiPlace = { id: number; name: string; lat?: number | null; lng?: number | null }
type ApiPlace = { id: number; name: string; lat?: number | null; lng?: number | null; image_url?: string | null }
type ApiAssignment = { id: number; place_id: number }
async function tripPlaces(page: Page): Promise<ApiPlace[]> {
@@ -216,6 +231,28 @@ const closeModal = async (page: Page): Promise<void> => {
const only = (target: (p: Page) => Locator) => ({ target })
/** Open the place's form from the card. */
async function openEditor(page: Page): Promise<void> {
await editButton(page).click()
await expect(updateButton(page)).toBeVisible()
await settle(page)
}
/** Save the form and wait until the place carries a picture of its own. */
async function saveWithPicture(page: Page, name: string): Promise<void> {
await updateButton(page).click()
await expect(modal(page)).toHaveCount(0, { timeout: 30_000 })
await expect.poll(async () => (await findPlace(page, name))?.image_url ?? null, { timeout: 30_000 }).toBeTruthy()
await settle(page)
}
async function removeOffMapPlace(page: Page): Promise<void> {
const { tripId } = seededTrip()
for (const place of (await tripPlaces(page)).filter(p => p.name === OFF_MAP.name)) {
await page.request.delete(`/api/trips/${tripId}/places/${place.id}`)
}
}
/**
* Take a place out of every collection it sits in.
*
@@ -300,26 +337,70 @@ const SCRIPTS: Record<string, GuideScript> = {
if (place) await p.request.delete(`/api/trips/${tripId}/places/${place.id}/rating`)
},
},
'place-image': {
guide: guide('place-image'),
start: p => openTrip(p, { day: null }),
'fold-place-card': {
guide: guide('fold-place-card'),
// From the stop, like the hero: the map then sits close enough that the
// highlighted marker is in the folded bar's picture.
start: async p => {
await openTrip(p, { day: null })
await selectDay(p, 1)
await openStop(p, 'Senso-ji Temple')
},
steps: [
{
target: p => row(p, 'Arashiyama Bamboo Grove'),
act: p => openPlace(p, 'Arashiyama Bamboo Grove'),
},
{
target: avatar,
target: p => foldButton(p, 'Collapse'),
act: async p => {
await card(p).locator('input[accept*="image/jpeg"]').setInputFiles(await coverFixture())
await expect(card(p).getByRole('button', { name: 'Remove image' })).toBeVisible({ timeout: 30_000 })
await foldButton(p, 'Collapse').click()
await expect(foldButton(p, 'Expand')).toBeVisible()
await expect(footer(p)).toBeHidden()
await settle(p)
},
},
only(head),
only(p => row(p, 'Arashiyama Bamboo Grove')),
{
// The map moved the way the step says, which brings the marker down to the bar.
prepare: async p => {
await p.mouse.move(960, 300)
await p.mouse.down()
await p.mouse.move(960, 450, { steps: 8 })
await p.mouse.move(960, 600, { steps: 8 })
await p.mouse.up()
await settle(p)
},
target: head,
},
{
target: p => foldButton(p, 'Expand'),
act: async p => {
await foldButton(p, 'Expand').click()
await expect(footer(p)).toBeVisible()
},
},
],
cleanup: p => patchPlace(p, 'Arashiyama Bamboo Grove', { image_url: null }),
},
'place-image': {
guide: guide('place-image'),
start: async p => {
await openTrip(p, { day: null })
await openPlace(p, 'Arashiyama Bamboo Grove')
},
steps: [
{ target: editButton, act: openEditor },
{
target: uploadTile,
act: async p => {
await picker(p).locator('input[type="file"]').setInputFiles(await coverFixture())
await expect(uploadTile(p)).toHaveAttribute('aria-pressed', 'true', { timeout: 30_000 })
await settle(p)
},
},
// Pointed at the label, not a tile: a hovered tile puts its own credit under the grid.
{ target: picker, hover: p => picker(p).getByText('Pick a picture', { exact: true }).hover() },
{ target: updateButton, act: p => saveWithPicture(p, 'Arashiyama Bamboo Grove') },
],
cleanup: async p => {
await closeModal(p)
await patchPlace(p, 'Arashiyama Bamboo Grove', { image_url: null })
},
},
'place-image-from-file': {
guide: guide('place-image-from-file'),
@@ -337,27 +418,28 @@ const SCRIPTS: Record<string, GuideScript> = {
target: p => section(p, 'Files'),
},
{
target: avatar,
act: async p => {
await avatar(p).click()
await expect(imageChooser(p)).toBeVisible()
// The thumbnails load as blobs one request later.
await expect(imageChooser(p).locator('img').first()).toBeVisible({ timeout: 20_000 })
prepare: async p => {
await openEditor(p)
// The attached photo's tile loads as a blob one request later.
await expect(picker(p).getByRole('button', { name: PHOTO_FILE, exact: true }).locator('img')).toBeVisible({ timeout: 20_000 })
await settle(p)
},
target: picker,
},
{
target: p => imageChooser(p).getByRole('button', { name: PHOTO_FILE, exact: true }),
target: p => picker(p).getByRole('button', { name: PHOTO_FILE, exact: true }),
act: async p => {
await imageChooser(p).getByRole('button', { name: PHOTO_FILE, exact: true }).click()
await expect(imageChooser(p)).toHaveCount(0)
await expect(card(p).getByRole('button', { name: 'Remove image' })).toBeVisible({ timeout: 30_000 })
await picker(p).getByRole('button', { name: PHOTO_FILE, exact: true }).click()
await expect(picker(p).getByRole('button', { name: PHOTO_FILE, exact: true })).toHaveAttribute('aria-pressed', 'true')
await settle(p)
},
},
only(head),
{ target: updateButton, act: p => saveWithPicture(p, PHOTO_PLACE) },
],
cleanup: p => removePlacePhoto(p.request),
cleanup: async p => {
await closeModal(p)
await removePlacePhoto(p.request)
},
},
'place-own-hours': {
guide: guide('place-own-hours'),
@@ -426,6 +508,61 @@ const SCRIPTS: Record<string, GuideScript> = {
await patchPlace(p, HOURS_PLACE, { phone: '', email: '', opening_hours: '' })
},
},
'place-off-map': {
guide: guide('place-off-map'),
// Put in over the API before the trip opens, the way a traveller leaves it:
// a name and a typed address, never picked from the search.
start: async p => {
await removeOffMapPlace(p)
const { tripId } = seededTrip()
const res = await p.request.post(`/api/trips/${tripId}/places`, { data: { name: OFF_MAP.name, address: OFF_MAP.address } })
if (!res.ok()) throw new Error(`could not add ${OFF_MAP.name}: ${res.status()} ${await res.text()}`)
await openTrip(p, { day: null })
},
steps: [
{
target: p => row(p, OFF_MAP.name),
act: async p => {
await openPlace(p, OFF_MAP.name)
await expect(head(p).getByText(NO_COORDINATES)).toBeVisible()
},
},
// Hovered for the picture, which brings up the tooltip with the way out.
only(p => head(p).getByText(NO_COORDINATES)),
{
prepare: async p => {
await openEditor(p)
await expect(locationPanel(p).getByText(/has no coordinates yet/)).toBeVisible()
},
target: locationPanel,
},
{
// Filled before the picture: the step is about the two values going in.
prepare: async p => {
await typeInto(p, coordinates(p).getByLabel('Latitude', { exact: true }), OFF_MAP.lat)
await typeInto(p, coordinates(p).getByLabel('Longitude', { exact: true }), OFF_MAP.lng)
await expect(locationPanel(p).getByText(/has no coordinates yet/)).toHaveCount(0)
await settle(p)
},
target: coordinates,
},
{
target: updateButton,
act: async p => {
await updateButton(p).click()
await expect(modal(p)).toHaveCount(0, { timeout: 20_000 })
await expect(head(p).getByText(NO_COORDINATES)).toHaveCount(0)
// Picked again, so the map goes to the new marker for the result.
await closeCard(p)
await openPlace(p, OFF_MAP.name)
},
},
],
cleanup: async p => {
await closeModal(p)
await removeOffMapPlace(p)
},
},
'place-day-assign': {
guide: guide('place-day-assign'),
start: p => openTrip(p, { day: null }),
@@ -445,7 +582,8 @@ const SCRIPTS: Record<string, GuideScript> = {
target: p => footer(p).getByRole('button', { name: 'Add to Day' }),
act: async p => {
await footer(p).getByRole('button', { name: 'Add to Day' }).click()
await expect(footer(p).getByRole('button', { name: 'Remove from Day' })).toBeVisible({ timeout: 20_000 })
await expect(stop(p, SPARE)).toBeVisible({ timeout: 20_000 })
await expect(footer(p).getByRole('button', { name: 'Add to Day' })).toHaveCount(0)
await settle(p)
},
},
@@ -453,9 +591,15 @@ const SCRIPTS: Record<string, GuideScript> = {
// last step's picture, and the arrow already says what to do.
{ target: p => stop(p, SPARE), dropTo: p => stop(p, 'Arashiyama Bamboo Grove') },
{
target: p => footer(p).getByRole('button', { name: 'Remove from Day' }),
// Remove from Day waits behind the three dots, so the menu is open for the picture.
prepare: async p => {
await moreButton(p).click()
await expect(p.getByRole('menu').getByRole('button', { name: 'Remove from Day' })).toBeVisible()
await settle(p)
},
target: p => p.getByRole('menu').getByRole('button', { name: 'Remove from Day' }),
act: async p => {
await footer(p).getByRole('button', { name: 'Remove from Day' }).click()
await p.getByRole('menu').getByRole('button', { name: 'Remove from Day' }).click()
await expect(footer(p).getByRole('button', { name: 'Add to Day' })).toBeVisible({ timeout: 20_000 })
await settle(p)
},
@@ -623,6 +767,8 @@ const SCRIPTS: Record<string, GuideScript> = {
act: async p => {
await p.keyboard.press('Escape')
await expect(p.getByRole('menu')).toHaveCount(0)
// Escape leaves the focus ring on Navigation, which the next picture would show.
await p.evaluate(() => (document.activeElement as HTMLElement | null)?.blur())
},
},
only(p => footer(p).getByRole('button', { name: 'Open Website' })),
+137 -28
View File
@@ -3,7 +3,9 @@ import { captureGuide, captureHero, beat, typeInto, settle, dragLoop, VIEWPORT,
import { seededTrip, gpxFixture } from './fixtures'
import { openTrip, modal, dialog, confirmDialog } from './trip-shared'
import { disconnectDawarich } from './external'
import { ensureDawarichStays, undoDawarichStays, setTours } from './fixtures-trip-places'
import {
ensureDawarichStays, undoDawarichStays, setTours, pinsKmlFixture, KML_PINS, ensureGuideTags, removeGuideTags, NEW_TAG,
} from './fixtures-trip-places'
import { tripPlacesContext, tripPlacesGuides } from '../../src/help/contexts/tripPlaces'
import type { HelpGuide } from '../../src/help/types'
@@ -11,10 +13,10 @@ import type { HelpGuide } from '../../src/help/types'
* Actions for the places column of a trip, keyed by the ids in
* `src/help/contexts/tripPlaces.ts`. They run on the seeded "Autumn in Japan"
* with the Tours add-on on, as on every install: the column has the Places and
* Tours switch, no Import file and no Tracks filter. The file import is
* pictured with Tours off, and the Dawarich stays with a connection, each for
* its own guide only; what a guide creates or switches it takes back again in
* `cleanup`, so the next one starts the same.
* Tours switch and no Tracks filter, and Import file sends a file with a line
* to the Tours import first. The Dawarich stays are pictured with a connection
* for their own guide only; what a guide creates or switches it takes back
* again in `cleanup`, so the next one starts the same.
*/
const guide = (id: string): HelpGuide => {
@@ -45,7 +47,7 @@ const head = (page: Page) =>
page.getByRole('button', { name: 'Import Places' }).locator('xpath=ancestor::div[contains(@class,"flex-col")][1]')
/** The list import's entry: List Import, Google List while Google is the only list provider. */
const LIST_IMPORT = /^(Google List|List Import)$/
/** The import button's menu: the list import, and Import file where Tours is off. */
/** The import button's menu: Import file and the list import. */
const importMenu = (page: Page) =>
page.locator('.trek-popover-enter').filter({ has: page.getByRole('button', { name: LIST_IMPORT }) }).last()
/** The Show dropdown (All, Unplanned, Planned; Tracks only with Tours off) and the list it opens. */
@@ -72,8 +74,30 @@ const importFileDialog = (page: Page) =>
page.getByRole('dialog').filter({ has: page.locator('input[type="file"][accept*=".gpx"]') })
/** ListImportModal, recognised by the link box. */
const listImportDialog = (page: Page) => page.getByRole('dialog').filter({ has: page.getByPlaceholder(/goo\.gl|naver/) })
/** The drop box of the file dialog: the dashed button that opens the file picker. */
const dropBox = (page: Page) => importFileDialog(page).locator('button.border-dashed').first()
/** The Tours import preview a file with a line opens, recognised by its points switch. */
const tourPreview = (page: Page) => page.getByRole('dialog').filter({ has: page.getByTestId('gpx-preview-points') })
/**
* Import file with Tours on: the Tours import's own file picker, a detached
* input, so the file goes in through the chooser it opens.
*/
async function pickImportFile(page: Page, file: string): Promise<void> {
const [chooser] = await Promise.all([
page.waitForEvent('filechooser'),
importMenu(page).getByRole('button', { name: 'Import file' }).click(),
])
await chooser.setFiles(file)
}
/** The tag guide's place, and the places that carry Must see before it starts. */
const TAGGED = 'Shibuya Crossing'
const ALREADY_TAGGED = ['Senso-ji Temple', 'Kinkaku-ji']
/** The group of tag pills in the place form. */
const tagGroup = (page: Page) => modal(page).getByRole('group', { name: 'Tags', exact: true })
/** The Tags card of the place form: the panel around the section with the pills. */
const tagsCard = (page: Page) => tagGroup(page).locator('xpath=ancestor::section[1]/..')
/** A tag's pill: its name button, which ticks it for the place. */
const tagPill = (page: Page, name: string) => tagGroup(page).getByRole('button', { name, exact: true })
const newTagField = (page: Page) => modal(page).getByRole('textbox', { name: 'New tag' })
const palette = (page: Page) => modal(page).getByRole('group', { name: 'Colour of Rainy day' })
/** The column itself: the header block around the search box. */
const column = (page: Page) => searchBox(page).locator('xpath=ancestor::div[contains(@class,"scroll") or @data-places-sidebar][1]')
@@ -496,11 +520,7 @@ const SCRIPTS: Record<string, GuideScript> = {
},
'import-places-file': {
guide: guide('import-places-file'),
// Import file is only in the menu of an install with the Tours add-on off.
start: async p => {
await setTours(p.request, false)
await openTrip(p)
},
start: p => openTrip(p),
steps: [
{
prepare: async p => {
@@ -509,35 +529,125 @@ const SCRIPTS: Record<string, GuideScript> = {
await beat(p, 300)
},
target: p => importMenu(p).getByRole('button', { name: 'Import file' }),
// A GPX with a track and two waypoints: the Tours import takes it first.
act: async p => {
await importMenu(p).getByRole('button', { name: 'Import file' }).click()
await expect(importFileDialog(p)).toBeVisible()
await pickImportFile(p, gpxFixture('arashiyama-loop'))
await expect(tourPreview(p)).toBeVisible({ timeout: 30_000 })
await settle(p)
},
},
{
target: p => p.getByTestId('gpx-preview-points'),
// Closing the preview stores nothing; the pins of the next step are what gets imported.
act: async p => {
await tourPreview(p).getByRole('button', { name: 'Cancel', exact: true }).click()
await expect(tourPreview(p)).toHaveCount(0)
await settle(p)
},
},
{
// A KML of pins only has no line for the Tours import, so Import file opens with it.
prepare: async p => {
await p.getByRole('button', { name: 'Import Places' }).click()
await expect(importMenu(p)).toBeVisible()
await pickImportFile(p, pinsKmlFixture())
await expect(importFileDialog(p).getByText('Points (Placemarks)')).toBeVisible({ timeout: 30_000 })
await settle(p)
},
target: importFileDialog,
},
{
target: p => importFileDialog(p).getByRole('button', { name: 'Import', exact: true }),
act: async p => {
await importFileDialog(p).getByRole('button', { name: 'Import', exact: true }).click()
// A KML answer keeps the dialog open with its summary; close it to show the new rows.
await expect(row(p, KML_PINS[0][0]).or(importFileDialog(p).getByText(/^Placemarks: /)).first())
.toBeVisible({ timeout: 60_000 })
if (await importFileDialog(p).isVisible().catch(() => false)) {
await importFileDialog(p).getByRole('button', { name: 'Cancel', exact: true }).click()
await expect(importFileDialog(p)).toHaveCount(0)
}
await expect(row(p, KML_PINS[0][0])).toBeVisible({ timeout: 20_000 })
await settle(p)
},
},
],
cleanup: p => deleteByName(p, ...KML_PINS.map(([name]) => name)),
},
'place-tags': {
guide: guide('place-tags'),
start: async p => {
await ensureGuideTags(p.request, seededTrip().tripId, ALREADY_TAGGED)
await openTrip(p)
},
steps: [
{
prepare: async p => {
await row(p, TAGGED).click({ button: 'right' })
await menu(p).getByRole('button', { name: 'Edit' }).click()
await expect(modal(p).getByPlaceholder('e.g. Eiffel Tower')).toHaveValue(TAGGED)
await tagPill(p, 'Must see').click()
await expect(tagPill(p, 'Must see')).toHaveAttribute('aria-pressed', 'true')
await settle(p)
},
target: tagsCard,
},
{
prepare: async p => {
await typeInto(p, newTagField(p), NEW_TAG)
await settle(p)
},
target: p => newTagField(p).locator('xpath=..'),
act: async p => {
await newTagField(p).press('Enter')
await expect(tagPill(p, NEW_TAG)).toHaveAttribute('aria-pressed', 'true', { timeout: 15_000 })
await settle(p)
},
},
{
prepare: async p => {
await importFileDialog(p).locator('input[type="file"]').setInputFiles(gpxFixture('arashiyama-loop'))
await expect(importFileDialog(p).getByText('Tracks (with path geometry)')).toBeVisible({ timeout: 15_000 })
await modal(p).getByRole('button', { name: 'Colour of Rainy day' }).click()
await expect(palette(p)).toBeVisible()
await beat(p, 300)
},
// The palette; the pill it colours sits right above it in the frame.
target: palette,
hover: p => palette(p).getByRole('button', { name: '#06b6d4' }).hover(),
act: async p => {
await palette(p).getByRole('button', { name: '#06b6d4' }).click()
await expect(palette(p)).toHaveCount(0)
await settle(p)
},
target: importFileDialog,
},
only(dropBox),
{
target: p => importFileDialog(p).getByRole('button', { name: 'Import', exact: true }),
target: p => modal(p).getByRole('button', { name: 'Update', exact: true }),
act: async p => {
await importFileDialog(p).getByRole('button', { name: 'Import', exact: true }).click()
await expect(importFileDialog(p)).toHaveCount(0, { timeout: 30_000 })
await expect(row(p, 'Arashiyama loop')).toBeVisible({ timeout: 20_000 })
await modal(p).getByRole('button', { name: 'Update', exact: true }).click()
await expect(modal(p)).toHaveCount(0, { timeout: 15_000 })
await settle(p)
},
},
{
prepare: async p => {
await categoryTrigger(p).click()
await expect(categoryList(p)).toBeVisible()
await categoryList(p).getByRole('button', { name: 'Must see', exact: true }).click()
await expect(categoryList(p).getByRole('button', { name: 'Clear filter' })).toBeVisible()
// The tags are at the foot of the list, under the categories.
await categoryList(p).evaluate(el => { el.scrollTop = el.scrollHeight })
await beat(p, 300)
},
target: categoryList,
// The list closes on a second click of its trigger; the filter stays.
act: async p => {
await categoryTrigger(p).click()
await expect(categoryList(p)).toHaveCount(0)
await expect(row(p, TAGGED)).toBeVisible()
await settle(p)
},
},
],
cleanup: async p => {
await deleteByName(p, 'Arashiyama loop', 'Togetsukyo Bridge', 'Okochi Sanso Villa')
await setTours(p.request, true)
},
cleanup: p => removeGuideTags(p.request, seededTrip().tripId),
},
'import-places-list': {
guide: guide('import-places-list'),
@@ -549,7 +659,6 @@ const SCRIPTS: Record<string, GuideScript> = {
await expect(importMenu(p)).toBeVisible()
await beat(p, 300)
},
// With Tours on, the list import is the menu's only entry.
target: p => importMenu(p).getByRole('button', { name: LIST_IMPORT }),
act: async p => {
await importMenu(p).getByRole('button', { name: LIST_IMPORT }).click()
+167 -20
View File
@@ -3,8 +3,9 @@ import { captureGuide, captureHero, settle, dragLoop, nudgeClock, VIEWPORT, type
import { seededTrip, ensureRoadtripFixtures } from './fixtures'
import { openTrip, modal, dialog } from './trip-shared'
import {
FERRY, FUEL_STOP, GOOGLE_ROUTE, HAZARD_TITLE, assignmentsOn, ensureFerry, ensureFuelStop, hideHazards, overnightFlight, placeIdOf,
removeFerry, removeFuelStop, removeImportedStops, removeNightAt, restoreFlight, stubGooglePreview, stubHazards,
FERRY, FUEL_STOP, GOOGLE_ROUTE, HAZARD_TITLE, PHOTO_STOP, assignmentsOn, ensureFerry, ensureFuelStop, ensurePhotoStop, hideHazards,
overnightFlight, placeIdOf, removeFerry, removeFuelStop, removeImportedStops, removeNightAt, removePhotoStop, restoreFlight,
stubGooglePreview, stubHazards,
} from './fixtures-trip-roadtrip'
import { tripRoadtripContext, tripRoadtripGuides } from '../../src/help/contexts/tripRoadtrip'
import type { HelpGuide } from '../../src/help/types'
@@ -89,14 +90,18 @@ const addFuelStop = (page: Page) => dryBand(page).getByRole('button', { name: /a
const viaHandle = (page: Page) => page.locator('.leaflet-marker-icon.leaflet-marker-draggable').first()
/** The Search button's card: Looking for, the day, Within, Search and Manual. */
const searchCard = (page: Page) => corridor(page).getByRole('button', { name: 'Search', exact: true }).locator('xpath=../..')
/** A hotel hit: its add button is the bed, Add as an overnight stay. */
/**
* A hotel hit: its add button is the bed, Add as an overnight stay. The last one,
* because the hits run in the order the drive passes them: the first lies a few
* kilometres into the morning, and a night there would read as a hotel at 10:30.
*/
const nightButton = (page: Page) =>
corridor(page).getByRole('button', { name: 'Add as an overnight stay', exact: true }).first()
corridor(page).getByRole('button', { name: 'Add as an overnight stay', exact: true }).last()
const nightRow = (page: Page) =>
corridor(page)
.getByRole('listitem')
.filter({ has: page.getByRole('button', { name: 'Add as an overnight stay', exact: true }) })
.first()
.last()
/**
* The battery badge of a refuelling stop. It has no label of its own: its name
* is its figure, "80 %", or the "+" it shows while nothing says how full.
@@ -112,6 +117,15 @@ const selectMenu = (page: Page) => page.locator('body > div[style*="99999"]').la
/** A warning area drawn by the hazard layer, in the warning colour. */
const hazardArea = (page: Page) => page.locator('.leaflet-overlay-pane path[stroke="var(--warning)"]').first()
const hazardPopup = (page: Page) => page.locator('.leaflet-popup.trek-hazard-popup')
/** Edit in the footer of the card the photo stop opens over the map. */
const cardEdit = (page: Page) =>
placeCardHead(page, PHOTO_STOP)
.locator('xpath=ancestor::*[.//button[@aria-label="Edit"]][1]')
.getByRole('button', { name: 'Edit', exact: true })
/** The picture in the stop dialog's head: the gallery trigger, named Show photos. */
const stopDialogPhoto = (page: Page) => modal(page).getByRole('button', { name: 'Show photos', exact: true })
/** The full-screen gallery the picture opens; portalled to the body, labelled like its trigger. */
const lightbox = (page: Page) => page.locator('div[role="dialog"][aria-modal="true"][aria-label="Show photos"]')
// ── Getting there ─────────────────────────────────────────────────────────────
@@ -182,8 +196,8 @@ type RoutePoint = { leg: number; x: number; y: number }
* what sits in the middle of it is usually somebody else's pin.
*
* The drawn casing is not what takes the click: it is non-interactive, and an
* invisible band over the same line (`RouteHitBand`, a transparent stroke with
* the class `cursor-copy`) catches it instead. So the point is read off the
* invisible band over the same line (`RouteHitBand`, a transparent stroke)
* catches it instead. So the point is read off the
* casing, which is the line the reader sees and the one the ring sits on, and
* the hit test asks for the band of that same leg. Both are drawn from the same
* positions, so their `d` is the same string.
@@ -206,7 +220,8 @@ async function routePoints(page: Page): Promise<RoutePoint[]> {
// The two panels float over the map; a point under one of them is not clickable.
if (x < 430 || x > 1550 || y < 220 || y > 950) continue
const hit = document.elementFromPoint(x, y)
const ownBand = hit instanceof SVGPathElement && hit.classList.contains('cursor-copy') && hit.getAttribute('d') === d
// By its transparent stroke: react-leaflet no longer carries the band's class onto the path.
const ownBand = hit instanceof SVGPathElement && hit.getAttribute('stroke') === 'transparent' && hit.getAttribute('d') === d
if (hit === path || ownBand) found.push({ leg, x, y })
}
})
@@ -229,8 +244,11 @@ async function aimAtLeg(page: Page): Promise<void> {
const points = await routePoints(page)
if (points.length === 0) {
const legs = await page.locator('.leaflet-overlay-pane svg path[stroke="#0a5cc2"]').count()
const bands = await page.locator('.leaflet-overlay-pane svg path.cursor-copy').count()
throw new Error(`no drawn leg is reachable on the map (${legs} drawn legs, ${bands} click bands)`)
const bands = await page.locator('.leaflet-overlay-pane svg path[stroke="transparent"]').count()
const kinds = await page.evaluate(() =>
[...new Set(Array.from(document.querySelectorAll('.leaflet-overlay-pane svg path')).map(el => `${el.getAttribute('stroke')}|${el.getAttribute('class')}`))].join(', '),
)
throw new Error(`no drawn leg is reachable on the map (${legs} drawn legs, ${bands} click bands; paths: ${kinds})`)
}
const counts = new Map<number, number>()
for (const point of points) counts.set(point.leg, (counts.get(point.leg) ?? 0) + 1)
@@ -270,12 +288,53 @@ async function aimAtHazard(page: Page): Promise<void> {
const top = document.elementFromPoint(box.left + box.width / 2, box.top + box.height / 2)
const why = `area at ${Math.round(box.left)},${Math.round(box.top)} ${Math.round(box.width)}x${Math.round(box.height)}, ` +
`on top at its centre: ${top ? `${top.tagName.toLowerCase()}.${String(top.getAttribute('class') ?? '')}` : 'nothing'}`
return { point: found[Math.floor(found.length / 2)] ?? null, why }
// Low in the area, not its middle: the popup opens above the click, and from the
// middle its title ends up under the map's category pills.
return { point: found[Math.floor(found.length * 0.8)] ?? null, why }
})
if (!aim.point) throw new Error(`no part of the warning area is reachable on the map (${aim.why})`)
hazardAt = aim.point
}
/**
* Drag the map so the warning area sits low enough for its popup. The popup
* opens above the click and is taller than the room left under the category
* pills when the area stays where framing on Hakone puts it, and Leaflet's own
* auto pan does not reliably clear the pills. The drag starts on bare map.
*/
async function lowerHazardArea(page: Page): Promise<void> {
const plan = await page.evaluate(() => {
const path = document.querySelector<SVGPathElement>('.leaflet-overlay-pane path[stroke="var(--warning)"]')
if (!path) return null
const box = path.getBoundingClientRect()
const dy = Math.round(760 - box.bottom)
for (let y = 300; y <= 700; y += 40) {
for (let x = 700; x <= 1400; x += 50) {
// Bare map: inside the map, but not a pin, a popup, a control or a drawn line.
const el = document.elementFromPoint(x, y)
const bare =
!!el?.closest('.leaflet-container') &&
!el.closest('.leaflet-marker-pane, .leaflet-popup-pane, .leaflet-tooltip-pane, .leaflet-control-container') &&
!(el instanceof SVGPathElement)
if (bare) return { x, y, dy }
}
}
return { x: 0, y: 0, dy }
})
if (!plan || plan.dy <= 0) return
if (plan.x === 0) {
console.warn('[roadtrip-hazards] no bare map to drag the warning area down from')
return
}
await page.mouse.move(plan.x, plan.y)
await page.mouse.down()
for (let i = 1; i <= 12; i++) await page.mouse.move(plan.x, plan.y + (plan.dy * i) / 12)
// Hold still before letting go, so the drag ends without a fling.
await page.waitForTimeout(400)
await page.mouse.up()
await finishMapPan(page)
}
/** Hold the loop's last frame a moment, on the state the gesture left. */
async function holdResult(page: Page, frame: () => Promise<void>): Promise<void> {
await settle(page)
@@ -283,6 +342,14 @@ async function holdResult(page: Page, frame: () => Promise<void>): Promise<void>
await frame()
}
/**
* On the stop's name, the handle a reader grabs: the item's centre can be its drive
* band, whose Other ways tooltip would lie over the picture.
*/
async function hoverShrineName(page: Page): Promise<void> {
await stopRow(page, 'Hakone Shrine').hover({ position: { x: 70, y: 12 } })
}
// ── Day 4 as the fixtures left it, for the guide that moves its stops ─────────
let day4Order: number[] = []
@@ -386,6 +453,18 @@ async function restorePlace(page: Page, name: string, data: Record<string, unkno
if (place) await page.request.put(`/api/trips/${tripId}/places/${place.id}`, { data })
}
/** Every visit of the place back on the place's own stay, the hour a new place starts with. */
async function clearVisitStays(page: Page, name: string): Promise<void> {
const { tripId, dayIds } = seededTrip()
const placeId = await placeIdOf(page.request, name)
if (placeId === null) return
for (let i = 0; i < dayIds.length; i++) {
for (const visit of (await assignmentsOn(page.request, i)).filter(a => a.place_id === placeId)) {
await page.request.put(`/api/trips/${tripId}/assignments/${visit.id}/stay`, { data: { stay_minutes: null } })
}
}
}
const closeModal = async (page: Page): Promise<void> => {
if (await modal(page).isVisible().catch(() => false)) {
await page.keyboard.press('Escape')
@@ -409,7 +488,15 @@ const SCRIPTS: Record<string, GuideScript> = {
},
only(p => p.getByText('Driving time', { exact: true }).locator('xpath=ancestor::header[1]')),
only(p => dayCard(p, 2).locator('header')),
only(p => dayCard(p, 2).getByRole('list').first()),
{
target: p => dayCard(p, 2).getByRole('list').first(),
// In the list's top corner: its centre is the drive band, whose Other ways
// tooltip would cover the next stop's name.
hover: async p => {
const box = await dayCard(p, 2).getByRole('list').first().boundingBox()
if (box) await p.mouse.move(box.x + 12, box.y + 8)
},
},
{
// Day 2, like the two steps above: the rail leaves out a day with
// nothing to drive, and day 1 is one of them.
@@ -473,7 +560,7 @@ const SCRIPTS: Record<string, GuideScript> = {
// Hakone Shrine, not a seeded stop: every seeded visit has an end time
// from the day plan, and a stop with one opens the read-only "until"
// version of the dialog, which has no slider and no Save. The drive's
// own fixture places carry no times, so the badge is the plus of Add a stay.
// own fixture places carry no times, only the hour a new place starts with.
target: p => stopItem(p, 'Hakone Shrine').getByRole('button', { name: /^(Time at this stop|Add a stay)/ }),
act: async p => {
await stopItem(p, 'Hakone Shrine').getByRole('button', { name: /^(Time at this stop|Add a stay)/ }).click()
@@ -484,21 +571,63 @@ const SCRIPTS: Record<string, GuideScript> = {
{
target: dialog,
act: async p => {
await modal(p).getByRole('button', { name: '1 h', exact: true }).click()
await expect(modal(p).getByRole('slider', { name: 'Minutes' })).toHaveValue('60')
// Not 1 h: a new place starts with an hour, so that preset would change nothing.
await modal(p).getByRole('button', { name: '45 min', exact: true }).click()
await expect(modal(p).getByRole('slider', { name: 'Minutes' })).toHaveValue('45')
await modal(p).getByRole('button', { name: 'Save', exact: true }).click()
await expect(modal(p)).toHaveCount(0)
await expect(stopItem(p, 'Hakone Shrine')).toContainText('1 h', { timeout: 20_000 })
await expect(stopItem(p, 'Hakone Shrine')).toContainText('45 min', { timeout: 20_000 })
await settle(p)
},
},
],
cleanup: async p => {
// Zero, not null: the update folds a null into "leave it alone".
await restorePlace(p, 'Hakone Shrine', { duration_minutes: 0 })
// The stay lands on the visit (#3092); null hands it back to the place, which has none.
await clearVisitStays(p, 'Hakone Shrine')
await restorePlace(p, 'Meiji Jingu', { stop_type: null })
},
},
'roadtrip-stop-photo': {
guide: guide('roadtrip-stop-photo'),
start: async p => {
await ensurePhotoStop(p.request)
await openRoadtrip(p)
},
steps: [
{
target: p => stopRow(p, PHOTO_STOP),
act: async p => {
await stopRow(p, PHOTO_STOP).click({ position: { x: 70, y: 12 } })
await expect(placeCardHead(p, PHOTO_STOP)).toBeVisible({ timeout: 15_000 })
await finishMapPan(p)
},
},
{
// Edit is the primary action at the right end of the card's footer.
target: cardEdit,
act: async p => {
await cardEdit(p).click()
await expect(stopDialogPhoto(p)).toBeVisible({ timeout: 15_000 })
await expect(stopDialogPhoto(p).locator('img')).toHaveJSProperty('complete', true)
await settle(p)
},
},
{
target: stopDialogPhoto,
act: async p => {
await stopDialogPhoto(p).click()
await expect(lightbox(p)).toBeVisible({ timeout: 15_000 })
await expect(lightbox(p).locator('img').first()).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
],
cleanup: async p => {
if (await lightbox(p).isVisible().catch(() => false)) await p.keyboard.press('Escape')
await closeModal(p)
await removePhotoStop(p.request)
},
},
'roadtrip-reorder': {
guide: guide('roadtrip-reorder'),
start: async p => {
@@ -510,6 +639,7 @@ const SCRIPTS: Record<string, GuideScript> = {
// Hakone Shrine onto Shinjuku Gyoen: the shrine moves up beside
// Owakudani, and the day stops driving to Tokyo and back.
target: p => stopItem(p, 'Hakone Shrine'),
hover: hoverShrineName,
dropTo: p => stopItem(p, 'Shinjuku Gyoen'),
clip: async (p, frame) => {
await dragLoop(p, stopItem(p, 'Hakone Shrine'), stopItem(p, 'Shinjuku Gyoen'), frame)
@@ -525,6 +655,7 @@ const SCRIPTS: Record<string, GuideScript> = {
// head of day 4 between them day 2 then lies above the rail's window, so
// the pointer let go off the rail and nothing moved.
target: p => stopItem(p, 'Hakone Shrine'),
hover: hoverShrineName,
dropTo: p => stopItem(p, 'Hakone Open-Air Museum'),
clip: async (p, frame) => {
await dragLoop(p, stopItem(p, 'Hakone Shrine'), stopItem(p, 'Hakone Open-Air Museum'), frame)
@@ -538,6 +669,7 @@ const SCRIPTS: Record<string, GuideScript> = {
// Day 4 is Owakudani and Shinjuku Gyoen now; Alt and up puts the garden
// first, and the day drives out of Tokyo to the valley.
target: p => stopRow(p, 'Shinjuku Gyoen'),
hover: async p => { await stopRow(p, 'Shinjuku Gyoen').hover({ position: { x: 70, y: 12 } }) },
act: async p => {
await stopRow(p, 'Shinjuku Gyoen').focus()
await p.keyboard.press('Alt+ArrowUp')
@@ -879,6 +1011,11 @@ const SCRIPTS: Record<string, GuideScript> = {
await settle(p)
},
target: p => modal(p).getByRole('group', { name: 'Daily travel times' }),
// In the group's corner: its centre carries the note's tooltip over Day end time.
hover: async p => {
const box = await modal(p).getByRole('group', { name: 'Daily travel times' }).boundingBox()
if (box) await p.mouse.move(box.x + 6, box.y + 6)
},
},
{
target: p => modal(p).getByRole('textbox', { name: 'Day start time' }),
@@ -939,7 +1076,14 @@ const SCRIPTS: Record<string, GuideScript> = {
await settle(p)
},
},
only(p => dryBand(p).getByRole('list').first()),
{
target: p => dryBand(p).getByRole('list').first(),
// In the list's corner: a badge under its centre would lay its tooltip over a name.
hover: async p => {
const box = await dryBand(p).getByRole('list').first().boundingBox()
if (box) await p.mouse.move(box.x + 6, box.y + 6)
},
},
{
prepare: async p => {
const label = (await addFuelStop(p).getAttribute('aria-label')) ?? ''
@@ -1161,6 +1305,7 @@ const SCRIPTS: Record<string, GuideScript> = {
// that stop (the way the via guide brings its leg into view) puts the
// area in the middle of the map at the same zoom, outline and all.
await frameOnStop(p, 'Hakone Shrine')
await lowerHazardArea(p)
await aimAtHazard(p)
},
},
@@ -1170,7 +1315,9 @@ const SCRIPTS: Record<string, GuideScript> = {
act: async p => {
await p.mouse.click(hazardAt.x, hazardAt.y)
await expect(hazardPopup(p)).toContainText(HAZARD_TITLE, { timeout: 15_000 })
await settle(p)
// The popup pans the map to fit itself, on Leaflet's clock: let that pan land,
// or its title stays under the map's category pills.
await finishMapPan(p)
},
},
],
+33
View File
@@ -218,6 +218,39 @@ const SCRIPTS: Record<string, GuideScript> = {
],
},
'tour-route-in-app': {
guide: guide('tour-route-in-app'),
// The hut trek: a hike, so the map apps follow it on foot.
start: async (p) => {
await openTourTrip(p, { day: null });
await toursTab(p).click();
await expect(row(p, TOUR_NAMES.hutToHut)).toBeVisible({ timeout: 30_000 });
await settle(p);
},
steps: [
{
target: (p) => row(p, TOUR_NAMES.hutToHut),
act: async (p) => {
await row(p, TOUR_NAMES.hutToHut).click();
await expect(head(p).getByRole('heading', { name: TOUR_NAMES.hutToHut, exact: true })).toBeVisible({
timeout: 30_000,
});
await settle(p);
},
},
{
target: (p) => footer(p).getByTestId('tour-route-apps'),
act: async (p) => {
await footer(p).getByTestId('tour-route-apps').click();
await expect(p.getByRole('menu')).toBeVisible();
await settle(p);
},
},
// No click: each entry hands the route to another app in a new tab.
only((p) => p.getByRole('menu')),
],
},
'tour-copy-keep': {
guide: guide('tour-copy-keep'),
start: async (p) => {
+6 -1
View File
@@ -180,7 +180,12 @@ const SCRIPTS: Record<string, GuideScript> = {
await openTours(p);
},
steps: [
{ target: (p) => tourRow(p, RECORDED_NAME), act: viewRecorded },
{
target: (p) => tourRow(p, RECORDED_NAME),
// On the name: the centre of the row is its time badge, whose tooltip would cover the next row.
hover: (p) => tourRow(p, RECORDED_NAME).getByText(RECORDED_NAME, { exact: true }).hover(),
act: viewRecorded,
},
{ target: (p) => railCard(p, RECORDED_NAME, 'Tour summary') },
{
target: (p) => importRail(p, RECORDED_NAME).getByRole('button', { name: 'Back to Tours' }),
+2
View File
@@ -35,6 +35,7 @@ import {
reliefSlider,
restartButton,
seamarksToggle,
searchAgainWhileUnavailable,
searchAlong,
speedGroup,
terrainToggle,
@@ -158,6 +159,7 @@ const SCRIPTS: Record<string, GuideScript> = {
act: async (p) => {
await alongSearch(p).click();
await expect(alongSearch(p)).toHaveText(/Search again/, { timeout: 90_000 });
await searchAgainWhileUnavailable(p);
await settle(p);
},
},
+41 -2
View File
@@ -145,8 +145,39 @@ async function searchTheHut(page: Page): Promise<void> {
const local = options.filter({
hasText: /Santa Cristina|Gardena|Gröden|Bolzano|Bozen|Südtirol|Alto Adige|Trentino/i,
});
await ((await local.count()) ? local.first() : options.first()).click();
const hut = local.filter({ hasText: /Regensburger|Firenze/i });
await ((await hut.count()) ? hut.first() : (await local.count()) ? local.first() : options.first()).click();
await landMap(page);
await fitTheDrawing(page);
}
/**
* The search lands on whatever the place search answers for the hut, and as
* close in as that answer is small: an area mapped as a building lands so far
* in that the spots of the drawing are off the screen. Out with the wheel, on
* the middle of the map, until the first and the last spot are both in sight.
*/
async function fitTheDrawing(page: Page): Promise<void> {
const g = await line(page);
const ends = [DRAWN_OFFSETS[0], DRAWN_OFFSETS[DRAWN_OFFSETS.length - 1]];
const inSight = async () => {
for (const offset of ends) {
if (
!(await screenOf(page, spotAt(g, offset)).then(
() => true,
() => false
))
)
return false;
}
return true;
};
for (let i = 0; i < 6 && !(await inSight()); i++) {
await page.mouse.move(VIEWPORT.width / 2, VIEWPORT.height / 2 + 40);
await page.mouse.wheel(0, 120);
await landMap(page);
}
expect(await inSight(), 'the drawing does not fit on the map after the search').toBe(true);
}
/** Click spot `i` of the drawing onto the map and wait for its row. */
@@ -230,12 +261,16 @@ const SCRIPTS: Record<string, GuideScript> = {
await p.getByTestId('tour-rail-add').click();
}
await expect(p.getByRole('group', { name: 'Add tour', exact: true })).toHaveCount(0);
// The plus keeps the focus, and with it its tooltip, into the pictures after it.
await p.evaluate(() => (document.activeElement as HTMLElement | null)?.blur());
},
},
{ target: mapSearch },
{ target: layerPill },
{
target: (p) => tourRow(p, TOUR_NAMES.recorded),
// On the name: the centre of the row is its time badge, whose tooltip would cover the next row.
hover: (p) => tourRow(p, TOUR_NAMES.recorded).getByText(TOUR_NAMES.recorded, { exact: true }).hover(),
act: async (p) => {
await tourRow(p, TOUR_NAMES.recorded).click();
await expect(p.getByRole('heading', { name: 'GPX tour', exact: true })).toBeVisible({ timeout: 30_000 });
@@ -562,12 +597,16 @@ const SCRIPTS: Record<string, GuideScript> = {
target: breaks,
act: async (p) => {
await typeInto(p, breaks(p), '0:45');
await breaks(p).press('Tab');
// Blurred rather than tabbed away from: Tab would focus Planned, whose
// tooltip then covers the field the next step is about.
await breaks(p).blur();
await settle(p);
},
},
{
target: planned,
// Not on the field itself: its tooltip would cover the time the step is about.
hover: (p) => p.getByText('Breaks', { exact: true }).first().hover(),
act: async (p) => {
await typeInto(p, planned(p), '3:30');
await planned(p).press('Enter');
+24
View File
@@ -505,8 +505,32 @@ const SCRIPTS: Record<string, GuideScript> = {
await tourRow(p, /Vallunga cross-country/).click();
await expect(p.getByTestId('ski-track-card')).toBeVisible({ timeout: 30_000 });
await settle(p);
// The card lies below the fold of its panel while the panel still grows; the picture
// was taken of the empty space below the window. Wait until the button sits inside it.
const change = p.getByTestId('ski-track-card').getByRole('button', { name: 'Change' });
await expect
.poll(
async () => {
await change.evaluate((el) => el.scrollIntoView({ block: 'center', inline: 'nearest' }));
await p.evaluate(() => window.scrollTo(0, 0));
const box = await change.boundingBox();
const vp = p.viewportSize();
return !!box && !!vp && box.y > 0 && box.y + box.height < vp.height && box.x > 0;
},
{ timeout: 20_000 }
)
.toBe(true);
await p.waitForTimeout(800);
await settle(p);
},
target: (p) => p.getByTestId('ski-track-card').getByRole('button', { name: 'Change' }),
hover: async (p) => {
const change = p.getByTestId('ski-track-card').getByRole('button', { name: 'Change' });
// A throwaway full screenshot first: the one render that came out right had one here, and
// the clipped shot alone has come out as an empty, shifted frame without the ring.
await p.screenshot();
await change.hover();
},
act: async (p) => {
await p.getByTestId('ski-track-card').getByRole('button', { name: 'Change' }).click();
await expect(classifyDialog(p)).toBeVisible();
+12 -1
View File
@@ -184,6 +184,12 @@ const SCRIPTS: Record<string, GuideScript> = {
// The hut trek has three stages, so the day it is given asks how next.
prepare: async (p) => {
await hoverRow(p, TOUR_NAMES.hutToHut);
// The second menu opens at the Add to day button, which only shows while the row is
// hovered or focused. Choosing the day moves both away, so the button would have no box
// and the menu would open in the window's top left corner; kept in sight, it anchors there.
await tourRow(p, TOUR_NAMES.hutToHut)
.getByTestId('tour-action-row')
.evaluate((el) => ((el as HTMLElement).style.display = 'flex'));
await tourRow(p, TOUR_NAMES.hutToHut).getByRole('button', { name: 'Add to day', exact: true }).click();
await expect(dayMenu(p)).toBeVisible();
await dayMenu(p)
@@ -196,7 +202,12 @@ const SCRIPTS: Record<string, GuideScript> = {
},
target: dayMenu,
// Nothing chosen: the hut trek keeps its days 4 to 6.
act: closeMenu,
act: async (p) => {
await closeMenu(p);
await tourRow(p, TOUR_NAMES.hutToHut)
.getByTestId('tour-action-row')
.evaluate((el) => (el as HTMLElement).style.removeProperty('display'));
},
},
],
cleanup: noDayTours,
+117 -3
View File
@@ -1,10 +1,11 @@
import { test, expect, type Locator, type Page } from '@playwright/test'
import { captureGuide, captureHero, beat, typeInto, settle, VIEWPORT, type GuideScript } from './guide'
import { seededTrip, ensureTransportFixtures, TRANSIT_JOURNEY, flightEmlFixture, FLIGHT_EML, FLIGHT_TO_IMPORT } from './fixtures'
import { openTrip, openTripOnDay, selectDay, modal, dialog, portalDialog, importSteps, importTask, dismissImportTask, deleteTripFiles } from './trip-shared'
import { openTrip, openTripOnDay, selectDay, closeDayDetails, modal, dialog, portalDialog, importSteps, importTask, dismissImportTask, deleteTripFiles } from './trip-shared'
import { ensureAirtrailConnection, disconnectAirtrail, AIRTRAIL_FLIGHTS, requireExtractor, allowEmlUploads } from './external'
import { tripTransportsContext, tripTransportsGuides } from '../../src/help/contexts/tripTransports'
import type { HelpGuide } from '../../src/help/types'
import { at, day } from '../dates'
/**
* Actions for the Transports tab of a trip, keyed by the ids in
@@ -200,6 +201,67 @@ const joinToggle = (page: Page) =>
const connectionGroup = (page: Page) => joinToggle(page).locator('xpath=..')
const importCta = (page: Page) => airtrailPicker(page).getByRole('button', { name: /^Import \d+$/ })
/**
* The flight home on the trip's last day, the picture day, for flight-live-status.
* Departure 15:20 in Tokyo (06:20 UTC) and arrival 21:25 in Frankfurt (20:25
* UTC), so at the pinned 09:00 UTC it has been in the air for two and a half
* hours: 15 minutes late off the ground and 25 minutes late on the estimate.
*/
const LIVE = {
title: 'NH223 HND → FRA',
code: 'NH7QF2',
flightNumber: 'NH223',
from: { code: 'HND', name: 'Tokyo Haneda', lat: 35.5494, lng: 139.7798, timezone: 'Asia/Tokyo' },
to: { code: 'FRA', name: 'Frankfurt', lat: 50.0379, lng: 8.5622, timezone: 'Europe/Berlin' },
}
/** Creates the flight home and answers its id. */
async function createLiveFlight(page: Page): Promise<number> {
const { tripId, dayIds } = seededTrip()
const res = await page.request.post(`/api/trips/${tripId}/reservations`, {
data: {
title: LIVE.title, type: 'flight', status: 'confirmed',
day_id: dayIds[dayIds.length - 1], end_day_id: dayIds[dayIds.length - 1],
reservation_time: at(0, '15:20'), reservation_end_time: at(0, '21:25'),
confirmation_number: LIVE.code, location: LIVE.from.name,
metadata: { airline: 'All Nippon Airways', flight_number: LIVE.flightNumber, departure_airport: 'HND', arrival_airport: 'FRA' },
endpoints: [
{ role: 'from', sequence: 0, name: LIVE.from.name, code: LIVE.from.code, lat: LIVE.from.lat, lng: LIVE.from.lng, timezone: LIVE.from.timezone, local_date: day(0), local_time: '15:20' },
{ role: 'to', sequence: 1, name: LIVE.to.name, code: LIVE.to.code, lat: LIVE.to.lat, lng: LIVE.to.lng, timezone: LIVE.to.timezone, local_date: day(0), local_time: '21:25' },
],
},
})
if (!res.ok()) throw new Error(`could not create the live flight: ${res.status()} ${await res.text()}`)
const body = (await res.json()) as { reservation?: { id: number }; id?: number }
const id = body.reservation?.id ?? body.id
if (!id) throw new Error('the live flight came back without an id')
return id
}
/**
* What the open ADS-B feeds would say about the flight two and a half hours
* after take-off, over north-east China on the great circle to Frankfurt. The
* feed cannot be asked from here (and the real NH223 may be anywhere), so the
* trip's live read answers this leg: the same shape the server sends.
*/
function liveLeg(reservationId: number) {
const utc = (hhmm: string) => `${day(0)}T${hhmm}:00.000Z`
return {
reservation_id: reservationId, leg_index: 0, callsign: 'ANA223', flight_number: 'NH 223', service_date: day(0),
origin: LIVE.from, destination: LIVE.to, phase: 'airborne',
scheduled_departure: utc('06:20'), scheduled_arrival: utc('20:25'),
departed_at: utc('06:35'), landed_at: null, estimated_arrival: utc('20:50'),
departure_delay_min: 15, arrival_delay_min: 25,
progress: 0.17, distance_total_km: 9361, distance_remaining_km: 7770,
position: { lat: 47.66, lng: 129.51, altitude_ft: 37000, ground_speed_kt: 486, track_deg: 304, vertical_rate_fpm: 0, on_ground: false },
aircraft: { registration: 'JA791A', type: 'B77W' },
last_seen_at: utc('08:59'), fetched_at: utc('08:59'), stale: false, source: 'adsb.lol',
}
}
/** The live card in the open booking, named by the flight number and where it stands. */
const liveCard = (page: Page) => bookingDetail(page, LIVE.title).locator('section[aria-label^="NH 223 "]')
/** Give a day's legs back to the day's own mode, whichever stop carries the one that was set. */
async function resetLegModes(page: Page, dayIndex: number): Promise<void> {
const { tripId, dayIds } = seededTrip()
@@ -666,9 +728,9 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
{
target: p => bookingDetail(p, TRAIN.title).getByRole('button', { name: 'On map', exact: true }),
target: p => bookingDetail(p, TRAIN.title).getByRole('button', { name: 'Map', exact: true }),
act: async p => {
await bookingDetail(p, TRAIN.title).getByRole('button', { name: 'On map', exact: true }).click()
await bookingDetail(p, TRAIN.title).getByRole('button', { name: 'Map', exact: true }).click()
// The Plan opens on day 5 with the train's line switched on.
await expect(transportRowTitled(p, TRAIN.title).getByRole('button', { name: 'Hide booking routes' })).toBeVisible({ timeout: 20_000 })
await settle(p)
@@ -801,6 +863,58 @@ const SCRIPTS: Record<string, GuideScript> = {
await p.evaluate(() => { try { sessionStorage.clear() } catch { /* a locked-down browser keeps its filters */ } })
},
},
'flight-live-status': {
guide: guide('flight-live-status'),
// The server's own poll is switched off for the guide, so no push from the
// real feed lands over the answer the page is given for this flight.
start: async p => {
await p.request.put('/api/auth/app-settings', { data: { flight_live_enabled: false } })
await deleteByTitle(p, LIVE.title)
const id = await createLiveFlight(p)
await p.context().route(/\/api\/trips\/\d+\/flights\/live$/, route =>
route.fulfill({ json: { enabled: true, attribution: 'adsb.lol', flights: [liveLeg(id)] } }))
await openTrip(p, { tab: 'transports' })
await expect(card(p, LIVE.title).getByText(/^In the air, Lands in /)).toBeVisible({ timeout: 20_000 })
await settle(p)
},
steps: [
only(p => card(p, LIVE.title)),
{
prepare: async p => {
await card(p, LIVE.title).click()
await expect(liveCard(p)).toBeVisible({ timeout: 20_000 })
await settle(p)
// The route map under the pass is a vector map; its tiles land after idle.
await p.waitForTimeout(1500)
},
target: p => liveCard(p).locator('> header'),
},
only(p => liveCard(p).locator('> div > div').first()),
only(p => liveCard(p).locator('div.mt-3.grid')),
{
prepare: async p => {
await p.keyboard.press('Escape')
await expect(bookingDetail(p, LIVE.title)).toHaveCount(0)
// The tab is remembered, so the Plan is opened by its tab. It opens on
// today, the trip's last day, where the flight home is.
await p.getByRole('button', { name: 'Plan', exact: true }).click()
await expect(transportRowTitled(p, LIVE.title)).toBeVisible({ timeout: 20_000 })
await closeDayDetails(p)
await transportRowTitled(p, LIVE.title).scrollIntoViewIfNeeded()
await expect(transportRowTitled(p, LIVE.title).getByText(/^In the air, Lands in /)).toBeVisible({ timeout: 20_000 })
await settle(p)
await p.waitForTimeout(1500)
},
target: p => transportRowTitled(p, LIVE.title),
},
],
cleanup: async p => {
await p.context().unroute(/\/api\/trips\/\d+\/flights\/live$/)
await deleteByTitle(p, LIVE.title)
await p.request.put('/api/auth/app-settings', { data: { flight_live_enabled: true } })
await p.evaluate(() => { try { sessionStorage.clear() } catch { /* a locked-down browser keeps its tab */ } })
},
},
'airtrail-import': {
guide: guide('airtrail-import'),
// The connection is made here and taken away in cleanup, so the hero and
+218 -12
View File
@@ -1,14 +1,24 @@
import { test, expect, type Page, type Locator } from '@playwright/test'
import { captureGuide, captureHero, beat, typeInto, settle, VIEWPORT, type GuideScript } from './guide'
import { ensureUsers, seededTrip, ADMIN_USERS, JOURNEY_TITLE } from './fixtures'
import { openTrip, openTripOnDay, modal } from './trip-shared'
import { openTrip, openTripOnDay, modal, confirmDialog } from './trip-shared'
import { mockTripAssistant, resetTripAssistant, QUESTION, SUGGESTED, type AssistantRun } from './fixtures-assistant'
import { tripContext, tripGuides } from '../../src/help/contexts/trip'
import type { HelpGuide } from '../../src/help/types'
/** The round button at the bottom of the planner, not the navbar's twin of the same name. */
const assistantLauncher = (page: Page) => page.locator('button.trek-assistant-pop')
const assistantWindow = (page: Page) => page.getByRole('dialog', { name: 'Assistant', exact: true })
/** The answer's card of changes: the last section inside the window, by its title while it waits. */
const changeCard = (page: Page) =>
assistantWindow(page).locator('section').filter({ has: page.getByText('Suggested changes', { exact: true }) }).last()
/** What the mocked chat made for real, for cleanup. */
let assistantRun: AssistantRun | null = null
/**
* Actions for the trip frame, keyed by the ids in `src/help/contexts/trip.ts`:
* the trip's Settings (people, sharing, the linked journal), the columns and
* the undo. They run on the seeded "Autumn in Japan"; what a guide creates (a
* the trip's Settings (people, sharing, the linked journal, the trip's addons
* and its own form), the columns and the undo. They run on the seeded "Autumn in Japan"; what a guide creates (a
* member, a guest, a link, a linked journal) it leaves for the next one or
* takes away again in `cleanup`.
*/
@@ -28,7 +38,8 @@ const block = (page: Page, opening: RegExp) => modal(page).locator('section').fi
const inviteBlock = (page: Page) => block(page, /^Invite User/)
const accessBlock = (page: Page) => block(page, /^Access\s*\d/)
/** An area in the dialog's list on the left; each carries the area's name as its label. */
const area = (page: Page, name: 'People' | 'Sharing' | 'Journal') => modal(page).getByRole('button', { name, exact: true })
type AreaName = 'People' | 'Sharing' | 'Journal' | 'Addons' | 'Edit Trip'
const area = (page: Page, name: AreaName) => modal(page).getByRole('button', { name, exact: true })
/** The Trip settings pill beside the trip's name. */
const settingsPill = (page: Page) => page.getByRole('button', { name: 'Trip settings', exact: true })
/**
@@ -52,7 +63,7 @@ async function openSettings(page: Page): Promise<void> {
await clickSettings(page)
}
async function pickArea(page: Page, name: 'Sharing' | 'Journal'): Promise<void> {
async function pickArea(page: Page, name: AreaName): Promise<void> {
await area(page, name).click()
await expect(area(page, name)).toHaveAttribute('aria-current', 'page')
await settle(page)
@@ -61,6 +72,8 @@ async function pickArea(page: Page, name: 'Sharing' | 'Journal'): Promise<void>
const closeModal = async (page: Page): Promise<void> => {
await page.keyboard.press('Escape')
await expect(modal(page)).toHaveCount(0)
// The dialog hands the focus back to the pill, whose focus ring would stay in the picture.
await page.evaluate(() => (document.activeElement as HTMLElement | null)?.blur())
}
/** Take the journal off the trip again; a trip without one answers that too, which is fine. */
@@ -71,6 +84,49 @@ async function unlinkJournal(page: Page): Promise<void> {
const only = (target: (p: Page) => Locator) => ({ target })
/**
* Wait until the first rows of the places column show their photos. A photo
* that comes back late leaves the category icon in its place for good, so a
* page that does not get them in time is opened again, at most twice.
*/
async function placePhotos(page: Page): Promise<void> {
for (let attempt = 0; attempt < 3; attempt++) {
const loaded = await page
.waitForFunction(
() => {
const rows = [...document.querySelectorAll('[role="option"]')].slice(0, 8)
return rows.length > 0 && rows.every(row => row.querySelector('img')?.complete)
},
null,
{ timeout: 15_000 },
)
.then(() => true)
.catch(() => false)
if (loaded) break
await openTrip(page)
}
await settle(page)
}
/** The addon the trip-addons guide switches; its row in the Addons area is the switch's row. */
const ADDON_ID = 'roadtrip'
const ADDON_NAME = 'Road trip'
const addonSwitch = (page: Page) => modal(page).getByRole('button', { name: ADDON_NAME, exact: true })
/** A row of the Addons area: the switch's parent, with the tile, the name, the badge and the line under it. */
const addonRow = (page: Page) => addonSwitch(page).locator('xpath=..')
/** The list of every trip addon, one row each. */
const addonList = (page: Page) => addonRow(page).locator('xpath=..')
/** Back to whatever the instance says for the addon the guide switched. */
async function resetAddon(page: Page): Promise<void> {
const { tripId } = seededTrip()
await page.request.put(`/api/trips/${tripId}/addons/${ADDON_ID}`, { data: { enabled: null } })
}
/** A panel of the trip's form by its heading: the heading, its CardHead, then the panel. */
const formPanel = (page: Page, heading: string) =>
modal(page).getByRole('heading', { name: heading, exact: true }).locator('xpath=../../..')
const SCRIPTS: Record<string, GuideScript> = {
'add-member': {
guide: guide('add-member'),
@@ -152,7 +208,7 @@ const SCRIPTS: Record<string, GuideScript> = {
act: p => pickArea(p, 'Sharing'),
},
{
// The first row of chips: Map & Plan, Bookings, Packing, Costs, Chat.
// The chips under Options: Map & Plan, Bookings, Packing, Costs, Chat, then the two options.
target: p => modal(p).getByRole('button', { name: 'Map & Plan' }).locator('xpath=..'),
act: async p => {
await modal(p).getByRole('button', { name: 'Packing', exact: true }).click()
@@ -161,11 +217,8 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
{
// Options with its two chips; the pointer on the first shows what it leaves out.
target: p => modal(p).getByRole('button', { name: 'Travel & stays only' }).locator('xpath=../..'),
hover: async p => {
await modal(p).getByRole('button', { name: 'Travel & stays only' }).hover()
},
// The first of the two options; the pointer on it shows what it leaves out.
target: p => modal(p).getByRole('button', { name: 'Travel & stays only' }),
},
{
target: p => modal(p).getByRole('button', { name: 'Create link', exact: true }),
@@ -243,9 +296,71 @@ const SCRIPTS: Record<string, GuideScript> = {
],
cleanup: unlinkJournal,
},
'trip-addons': {
guide: guide('trip-addons'),
start: async p => {
await resetAddon(p)
await openSettings(p)
},
steps: [
{
target: p => area(p, 'Addons'),
act: async p => {
await pickArea(p, 'Addons')
await expect(addonSwitch(p)).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
{
target: addonList,
act: async p => {
const before = await addonSwitch(p).getAttribute('aria-pressed')
await addonSwitch(p).click()
await expect(addonSwitch(p)).not.toHaveAttribute('aria-pressed', before ?? '')
await expect(addonRow(p).getByText('This trip only', { exact: true })).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
{
target: addonRow,
// The result shows the trip with the addon switched.
act: async p => {
await closeModal(p)
await placePhotos(p)
},
},
],
cleanup: resetAddon,
},
'edit-trip-settings': {
guide: guide('edit-trip-settings'),
start: openSettings,
steps: [
{
target: p => area(p, 'Edit Trip'),
act: async p => {
await pickArea(p, 'Edit Trip')
await expect(formPanel(p, 'Name and description')).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
only(p => formPanel(p, 'Name and description')),
{
target: p => modal(p).getByRole('button', { name: 'Update', exact: true }),
act: async p => {
await modal(p).getByRole('button', { name: 'Update', exact: true }).click()
await expect(modal(p)).toHaveCount(0, { timeout: 15_000 })
await settle(p)
},
},
],
},
'collapse-columns': {
guide: guide('collapse-columns'),
start: p => openTrip(p),
start: async p => {
await openTrip(p)
await placePhotos(p)
},
steps: [
{
target: leftToggle,
@@ -303,6 +418,30 @@ const SCRIPTS: Record<string, GuideScript> = {
// The day has to stay open for that: the + at the end of a row belongs to
// the open day, and closing the day's details panel closes the day with it.
await openTripOnDay(p, 1)
// The picture shows the rows around it, so their photos have to be in
// first; the spare place has none of its own and is left out of the wait.
for (let attempt = 0; attempt < 3; attempt++) {
const loaded = await p
.waitForFunction(
() => {
// A place's avatar is an <img> with the place's name as its alt
// while it has a photo, and the category icon once the photo is
// given up. Day 1's places sit in the day plan and in the places
// column, so each needs two loaded photos.
const names = ['Senso-ji Temple', 'teamLab Planets']
return names.every(name => {
const imgs = [...document.querySelectorAll('img')].filter(img => img.alt === name)
return imgs.length >= 2 && imgs.every(img => img.complete && img.naturalWidth > 0)
})
},
null,
{ timeout: 20_000 },
)
.then(() => true)
.catch(() => false)
if (loaded) break
await openTripOnDay(p, 1)
}
const row = p.getByRole('option', { name: /^Tsukiji Outer Market/ })
await row.hover()
const add = row.getByRole('button', { name: '+ Day' })
@@ -331,6 +470,73 @@ const SCRIPTS: Record<string, GuideScript> = {
}
},
},
'trip-assistant': {
guide: guide('trip-assistant'),
// No provider answers in the run: fixtures-assistant.ts answers for it, and Apply plans the place for real.
start: async p => {
assistantRun = await mockTripAssistant(p)
await openTrip(p)
await expect(assistantLauncher(p)).toBeVisible({ timeout: 20_000 })
await settle(p)
},
steps: [
{
target: p => assistantLauncher(p),
act: async p => {
await assistantLauncher(p).click()
await expect(assistantWindow(p).getByRole('textbox')).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
{
prepare: async p => {
await typeInto(p, assistantWindow(p).getByRole('textbox'), QUESTION)
await beat(p, 300)
await settle(p)
},
target: p => assistantWindow(p).locator('form').last(),
hover: async p => { await assistantWindow(p).getByRole('button', { name: 'Send', exact: true }).hover() },
act: async p => {
await assistantWindow(p).getByRole('button', { name: 'Send', exact: true }).click()
await expect(changeCard(p)).toBeVisible({ timeout: 20_000 })
await expect(changeCard(p).getByRole('button', { name: 'Apply', exact: true })).toBeEnabled()
await settle(p)
},
},
{
target: p => changeCard(p),
hover: async p => { await changeCard(p).getByRole('button', { name: 'Apply', exact: true }).hover() },
act: async p => {
await changeCard(p).getByRole('button', { name: 'Apply', exact: true }).click()
await expect(assistantWindow(p).getByRole('button', { name: 'Undo', exact: true }).first()).toBeVisible({ timeout: 20_000 })
// The place lands in day 1 of the plan behind the window, through the websocket.
await expect(p.getByText(SUGGESTED.name, { exact: true }).first()).toBeVisible({ timeout: 20_000 })
await settle(p)
},
},
{
target: p => assistantWindow(p).getByRole('button', { name: 'Share in the trip chat' }).last(),
act: async p => {
await assistantWindow(p).getByRole('button', { name: 'Share in the trip chat' }).last().click()
await expect(confirmDialog(p).getByRole('button', { name: 'Share', exact: true })).toBeVisible({ timeout: 10_000 })
await settle(p)
},
},
{
target: p => confirmDialog(p),
hover: async p => { await confirmDialog(p).getByRole('button', { name: 'Share', exact: true }).hover() },
act: async p => {
await confirmDialog(p).getByRole('button', { name: 'Share', exact: true }).click()
await expect(p.getByText('Shared in the trip chat').first()).toBeVisible({ timeout: 15_000 })
await settle(p)
},
},
],
cleanup: async p => {
await resetTripAssistant(p.request, assistantRun)
assistantRun = null
},
},
}
// ── Run ───────────────────────────────────────────────────────────────────────
+66 -4
View File
@@ -4,7 +4,7 @@ import { monthName, monthsAhead, year } from '../dates'
import {
PARTNER, ensureFused, ensureSeparate, clearPartnerDays, requestFusionFromPartner, clearFusionRequest,
shareWithAdmin, unshareWithAdmin, ownColor, setOwnColor, ensurePublicCalendar, calendarColors,
restoreCalendarColors, companyHolidayFraction, setCompanyHoliday,
restoreCalendarColors, companyHolidayFraction, setCompanyHoliday, adminId, asMember,
} from './fixtures-vacay'
import { vacayGuides, vacayContext } from '../../src/help/contexts/vacay'
import type { HelpGuide } from '../../src/help/types'
@@ -218,8 +218,57 @@ const calendarRow = (page: Page): Locator => settings(page).getByPlaceholder('La
/** The Fusion Request dialog, which opens by itself while an invite waits for an answer. */
const fusionDialog = (page: Page): Locator => page.getByRole('dialog', { name: 'Fusion Request' })
/**
* Log the admin's LOG_DAY through the API when it is not logged yet, and say
* whether it did. The colour guide's result shows logged days in the new
* colour; run on its own (a --grep re-render) the plan had none, so the
* result showed only the small dot in Persons changing.
*/
async function ensureOwnDay(page: Page): Promise<boolean> {
const date = nextMonthDate(LOG_DAY)
const res = await page.request.get(`/api/addons/vacay/entries/${YEAR}`)
if (!res.ok()) throw new Error(`could not load the entries: ${res.status()}`)
const me = await adminId(page)
const { entries } = (await res.json()) as { entries: { user_id: number; date: string }[] }
if (entries.some(e => e.user_id === me && e.date === date)) return false
await toggleOwnDay(page, date)
return true
}
async function toggleOwnDay(page: Page, date: string): Promise<void> {
const res = await page.request.post('/api/addons/vacay/entries/toggle', { data: { date, fraction: 1, kind: 'vacation' } })
if (!res.ok()) throw new Error(`could not toggle ${date}: ${res.status()}`)
}
/**
* Days mira has off in her own plan while she shares it with the admin. Without
* them her shared calendar drew nothing on the grid, so the guide about rings
* on the grid showed none.
*/
const SHARED_DAYS = WORKDAYS.slice(6, 8).map(nextMonthDate)
/** Log (`on`) or clear mira's SHARED_DAYS in her own plan, leaving days already as wanted alone. */
async function setPartnerOwnDays(on: boolean): Promise<void> {
const member = await asMember()
try {
const me = (await (await member.get('/api/auth/me')).json()) as { user: { id: number } }
const res = await member.get(`/api/addons/vacay/entries/${YEAR}`)
if (!res.ok()) throw new Error(`could not load ${PARTNER.username}'s entries: ${res.status()}`)
const { entries } = (await res.json()) as { entries: { user_id: number; date: string }[] }
for (const date of SHARED_DAYS) {
const logged = entries.some(e => e.user_id === me.user.id && e.date === date)
if (logged === on) continue
const t = await member.post('/api/addons/vacay/entries/toggle', { data: { date, fraction: 1, kind: 'vacation' } })
if (!t.ok()) throw new Error(`could not toggle ${PARTNER.username}'s ${date}: ${t.status()}`)
}
} finally {
await member.dispose()
}
}
/** What a guide has to put back, read in its start and used in its cleanup. */
let savedColor = ''
let loggedForColor = false
let savedCalendarColors = new Map<number, string>()
let christmasEveBefore: number | null = null
@@ -342,7 +391,12 @@ const SCRIPTS: Record<string, GuideScript> = {
// The chip with its minus showing, rather than the minus alone: the step
// says to hover the chip, and a ring round the tiny minus put its number
// on top of the year it belongs to.
prepare: async p => { await yearChip(p, YEAR + 1).hover() },
// The chip clicked last keeps the focus, and a focused chip shows its
// minus too, so the picture had two minuses; the focus goes first.
prepare: async p => {
await p.evaluate(() => { (document.activeElement as HTMLElement | null)?.blur() })
await yearChip(p, YEAR + 1).hover()
},
target: p => yearChip(p, YEAR + 1),
// With the ring on the chip, this is what still fails the guide when the minus is gone.
act: async p => { await expect(yearChip(p, YEAR + 1).getByRole('button', { name: 'Remove year' })).toBeVisible() },
@@ -552,6 +606,7 @@ const SCRIPTS: Record<string, GuideScript> = {
guide: guide('person-color'),
start: async p => {
savedColor = await ownColor(p)
loggedForColor = await ensureOwnDay(p)
await openVacay(p)
},
steps: [
@@ -569,7 +624,10 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
],
cleanup: async p => { await setOwnColor(p, savedColor) },
cleanup: async p => {
await setOwnColor(p, savedColor)
if (loggedForColor) await toggleOwnDay(p, nextMonthDate(LOG_DAY))
},
},
invite: {
@@ -725,6 +783,7 @@ const SCRIPTS: Record<string, GuideScript> = {
// so mira shares hers with the admin first. The page learns of it over
// the socket; a reload is the fallback should that message not come.
prepare: async p => {
await setPartnerOwnDays(true)
await shareWithAdmin(p)
const incoming = cardRow(p, 'Shared Calendars', PARTNER.username)
if (!(await incoming.waitFor({ state: 'visible', timeout: 8_000 }).then(() => true, () => false))) await openVacay(p)
@@ -735,7 +794,10 @@ const SCRIPTS: Record<string, GuideScript> = {
hover: async p => { await cardRow(p, 'Shared Calendars', 'jonas').hover() },
},
],
cleanup: unshareWithAdmin,
cleanup: async p => {
await unshareWithAdmin(p)
await setPartnerOwnDays(false)
},
},
}
+3 -3
View File
@@ -31,7 +31,7 @@ test('#1432 iPad: the places list scrolls under a swipe', async ({ page }) => {
await page.getByText(title).first().click()
await expect(page).toHaveURL(/\/trips\/\d+/)
await expect(page.locator('.leaflet-container')).toBeVisible({ timeout: 20_000 })
await expect(page.locator('.leaflet-container, .maplibregl-canvas, .mapboxgl-canvas').first()).toBeVisible({ timeout: 20_000 })
const tripId = page.url().match(/\/trips\/(\d+)/)![1]
@@ -43,7 +43,7 @@ test('#1432 iPad: the places list scrolls under a swipe', async ({ page }) => {
expect(res.ok(), `seed place ${i}`).toBeTruthy()
}
await page.reload()
await expect(page.locator('.leaflet-container')).toBeVisible({ timeout: 20_000 })
await expect(page.locator('.leaflet-container, .maplibregl-canvas, .mapboxgl-canvas').first()).toBeVisible({ timeout: 20_000 })
// An iPad is inside the 768-1023px band, where only one side panel is open at a
// time so the map keeps a usable width (#2247). The places list is one tap away.
@@ -88,7 +88,7 @@ test('#1432 iPad: the places list scrolls under a swipe', async ({ page }) => {
// 3. The iPad must still get the desktop shell — isMobile stayed width-based. One
// panel at a time (#2247), so opening Places closed the day plan and left its
// tab as the way back.
await expect(page.locator('.leaflet-container')).toBeVisible()
await expect(page.locator('.leaflet-container, .maplibregl-canvas, .mapboxgl-canvas').first()).toBeVisible()
// The top tab bar has a button named Plan as well; the way back is the panel's
// own tab, which is accented while its panel is closed.
await expect(page.locator('button[aria-label="Plan"].bg-accent')).toBeVisible()
+2 -2
View File
@@ -22,7 +22,7 @@ test('desktop: reorder arrows are hidden-and-inert until the row is hovered', as
await page.getByText(title).first().click()
await expect(page).toHaveURL(/\/trips\/\d+/)
await expect(page.locator('.leaflet-container')).toBeVisible({ timeout: 20_000 })
await expect(page.locator('.leaflet-container, .maplibregl-canvas, .mapboxgl-canvas').first()).toBeVisible({ timeout: 20_000 })
// Two places on day 1, so the day plan renders rows carrying reorder arrows.
const tripId = page.url().match(/\/trips\/(\d+)/)![1]
@@ -38,7 +38,7 @@ test('desktop: reorder arrows are hidden-and-inert until the row is hovered', as
})
}
await page.reload()
await expect(page.locator('.leaflet-container')).toBeVisible({ timeout: 20_000 })
await expect(page.locator('.leaflet-container, .maplibregl-canvas, .mapboxgl-canvas').first()).toBeVisible({ timeout: 20_000 })
const row = page.locator('.dp-row').filter({ hasText: 'Alpha' }).first()
await expect(row).toBeVisible({ timeout: 20_000 })
+3 -1
View File
@@ -58,7 +58,9 @@ test('desktop: a stay booked in another session shows in the day plan without a
const hotel = `Mercure Hotel ${Date.now()}`;
const { tripId, dayIds } = await seedTrip(page.request, `Stay live ${Date.now()}`);
await openPlanner(page, tripId);
await expect(page.locator('.leaflet-container')).toBeVisible({ timeout: 20_000 });
await expect(page.locator('.leaflet-container, .maplibregl-canvas, .mapboxgl-canvas').first()).toBeVisible({
timeout: 20_000,
});
await bookElsewhere(browser, tripId, dayIds, hotel);
+234
View File
@@ -0,0 +1,234 @@
import { devices, expect, test, type Locator, type Page } from '@playwright/test';
import { encodePolyline6 } from '@trek/shared';
async function createTourTrip(page: Page): Promise<number> {
const trip = await page.request.post('/api/trips', {
data: { title: 'Tour type picker', start_date: '2099-06-01', end_date: '2099-06-05' },
});
await expect(trip).toBeOK();
const {
trip: { id },
} = await trip.json();
await expect(await page.request.put(`/api/trips/${id}/addons/tours`, { data: { enabled: true } })).toBeOK();
return id;
}
async function expectInside(element: Locator, boundary: Locator) {
await expect
.poll(async () => {
const target = await element.boundingBox();
const rail = await boundary.boundingBox();
return (
!!target &&
!!rail &&
target.x >= rail.x - 1 &&
target.y >= rail.y - 1 &&
target.x + target.width <= rail.x + rail.width + 1 &&
target.y + target.height <= rail.y + rail.height + 1
);
})
.toBe(true);
}
function editorFields(page: Page) {
const trigger = page.getByTestId('tour-type-select');
const scrollArea = page.getByTestId('tour-planner-editor-scroll');
return { trigger, scrollArea, menu: page.getByRole('group', { name: 'Tour type', exact: true }) };
}
test('Tour type follows and fits inside the narrow editor rail', async ({ page }) => {
await page.setViewportSize({ width: 1024, height: 480 });
const tripId = await createTourTrip(page);
await page.goto(`/trips/${tripId}?tab=tour-planner`);
await page.getByRole('button', { name: 'Plan new tour' }).click();
await expect(page.getByTestId('tour-planner-empty-state')).toBeAttached();
const grip = page.locator('[data-resize="left"]');
for (let step = 0; step < 8; step++) await grip.press('ArrowLeft');
const { trigger, scrollArea, menu } = editorFields(page);
await trigger.scrollIntoViewIfNeeded();
await expectInside(trigger, scrollArea);
await trigger.click();
await expectInside(menu, scrollArea);
await expect.poll(() => menu.evaluate((el) => el.scrollHeight > el.clientHeight)).toBe(true);
async function anchorGap() {
return menu.evaluate((el) => {
const anchor = document.querySelector('[data-testid="tour-type-select"]')!.getBoundingClientRect();
const panel = el.getBoundingClientRect();
return Math.round(Math.max(panel.top - anchor.bottom, anchor.top - panel.bottom));
});
}
await expect.poll(anchorGap).toBe(4);
const start = await scrollArea.evaluate((el) => el.scrollTop);
await scrollArea.evaluate((el) => el.scrollBy(0, 20));
await expect.poll(() => scrollArea.evaluate((el) => el.scrollTop)).toBeGreaterThan(start);
await expect.poll(anchorGap).toBe(4);
await expectInside(menu, scrollArea);
await scrollArea.evaluate((el, top) => {
el.scrollTop = top;
}, start);
await expect.poll(anchorGap).toBe(4);
await page.keyboard.press('Escape');
await expect(trigger).toBeFocused();
await expect(menu).toHaveCount(0);
await trigger.click();
await scrollArea.evaluate((el) => el.scrollBy(0, 180));
await expect(trigger).toHaveAttribute('aria-expanded', 'false');
await expect(menu).toHaveCount(0);
await scrollArea.evaluate((el) => {
el.scrollTop = 0;
});
await expect(menu).toHaveCount(0);
await trigger.click();
const ski = menu.getByTestId('tour-type-option-ski');
await page.keyboard.press('End');
await expect(ski).toBeInViewport();
await expect(ski).toBeFocused();
await page.keyboard.press('Enter');
await expect(trigger).toContainText('Ski & winter');
await expect(menu).toHaveCount(0);
await page.getByRole('button', { name: 'Alpine', exact: true }).click();
const hardest = page.getByRole('button', { name: 'Hardest runs', exact: true });
const hardestMenu = page.getByRole('group', { name: 'Hardest runs', exact: true });
await hardest.click();
await expectInside(hardestMenu, scrollArea);
await hardestMenu.getByRole('button', { name: 'Easy', exact: true }).click();
await expect(hardest).toContainText('Easy');
await expect(hardestMenu).toHaveCount(0);
});
test('the saved hike difficulty dropdown fits above the field and keeps alpine confirmation', async ({ page }) => {
await page.setViewportSize({ width: 1024, height: 520 });
const tripId = await createTourTrip(page);
const saved = await page.request.post(`/api/trips/${tripId}/tours`, {
data: {
name: 'Saved ridge walk',
tour_type: 'hike',
max_hiking_difficulty: 2,
route_geometry: [
[48.1, 11.1, 500],
[48.11, 11.11, 550],
],
waypoints: [
{ lat: 48.1, lng: 11.1, role: 'start', sequence: 0 },
{ lat: 48.11, lng: 11.11, role: 'end', sequence: 1 },
],
},
});
await expect(saved).toBeOK();
const {
tour: { place_id },
} = await saved.json();
const detailUrl = `**/api/trips/${tripId}/tours/${place_id}`;
const detailGate = Promise.withResolvers<void>();
await page.route(
detailUrl,
async (route) => {
await detailGate.promise;
await route.continue();
},
{ times: 1 }
);
const shape = encodePolyline6([
{ lat: 48.1, lon: 11.1 },
{ lat: 48.11, lon: 11.11 },
]);
await page.route('**/api/routing/valhalla/route', (route) =>
route.fulfill({
json: { trip: { legs: [{ shape, summary: { length: 1.4, time: 1200 } }] } },
})
);
await page.goto(`/trips/${tripId}?tab=tour-planner`);
const detailRequested = page.waitForRequest(detailUrl);
await page.getByRole('option', { name: /Saved ridge walk/ }).click();
await detailRequested;
const { trigger, menu, scrollArea } = editorFields(page);
try {
await expect(trigger).toHaveCount(0);
await expect(menu).toHaveCount(0);
} finally {
detailGate.resolve();
}
await expect(page.getByLabel('Tour name')).toHaveValue('Saved ridge walk');
await trigger.click();
await expectInside(menu, scrollArea);
await page.keyboard.press('Escape');
const difficulty = page.getByRole('button', { name: 'Maximum trail difficulty', exact: true });
const difficultyMenu = page.getByRole('group', { name: 'Maximum trail difficulty', exact: true });
await difficulty.scrollIntoViewIfNeeded();
await difficulty.click();
await expectInside(difficultyMenu, scrollArea);
await expect(difficultyMenu).toHaveCSS('transform-origin', /px [1-9][0-9.]*px$/);
await page.keyboard.press('Escape');
await expect(difficulty).toBeFocused();
await expect(difficultyMenu).toHaveCount(0);
await difficulty.click();
await scrollArea.evaluate((el) => {
el.scrollTop = 0;
});
await expect(difficulty).toHaveAttribute('aria-expanded', 'false');
await expect(difficultyMenu).toHaveCount(0);
await difficulty.click();
await difficultyMenu.getByRole('button', { name: 'T3: Demanding mountain hiking' }).click();
await expect(difficulty).toContainText('T3:');
await difficulty.click();
await difficultyMenu.getByRole('button', { name: 'T4: Alpine hiking' }).click();
await expect(page.getByRole('heading', { name: 'Enable alpine routing?' })).toBeVisible();
await page.getByRole('button', { name: 'Cancel' }).click();
await expect(difficulty).toContainText('T3:');
const categories = page.getByTestId('tour-poi-categories');
await categories.click();
await expectInside(page.getByRole('group', { name: 'What to look for', exact: true }), scrollArea);
});
test('the tour editor dropdowns fit in the native tablet layout', async ({ playwright, baseURL, storageState }) => {
const browser = await playwright.webkit.launch();
try {
const page = await browser.newPage({
...devices['iPad Pro 11'],
viewport: { width: 680, height: 620 },
baseURL,
storageState,
});
page.setDefaultTimeout(10_000);
// The browser supplies the WebKit viewport and touch input. This flag selects the app shell.
await page.addInitScript(() => Object.assign(window, { CapacitorCustomPlatform: { name: 'ios' } }));
const tripId = await createTourTrip(page);
await page.goto(`/trips/${tripId}?tab=tour-planner`);
await page.getByRole('tab', { name: 'Plan a tour', exact: true }).tap();
await page.getByRole('button', { name: 'Plan new tour' }).tap();
const { trigger, menu, scrollArea } = editorFields(page);
await trigger.tap();
await expectInside(menu, scrollArea);
await scrollArea.evaluate((el) => el.scrollBy(0, 160));
await expect(trigger).toHaveAttribute('aria-expanded', 'false');
const difficulty = page.getByRole('button', { name: 'Maximum trail difficulty', exact: true });
const difficultyMenu = page.getByRole('group', { name: 'Maximum trail difficulty', exact: true });
await difficulty.tap();
await expectInside(difficultyMenu, scrollArea);
await difficultyMenu.getByRole('button', { name: 'T1: Hiking' }).tap();
await expect(difficulty).toContainText('T1:');
await expect(difficultyMenu).toHaveCount(0);
await trigger.tap();
await menu.getByTestId('tour-type-option-ski').tap();
await page.getByRole('button', { name: 'Alpine', exact: true }).tap();
const hardest = page.getByRole('button', { name: 'Hardest runs', exact: true });
const hardestMenu = page.getByRole('group', { name: 'Hardest runs', exact: true });
await hardest.tap();
await expectInside(hardestMenu, scrollArea);
await hardestMenu.getByRole('button', { name: 'Easy', exact: true }).tap();
await expect(hardest).toContainText('Easy');
} finally {
await browser.close();
}
});
+2 -2
View File
@@ -24,6 +24,6 @@ test('open a trip and land in the planner with a map', async ({ page }) => {
await page.getByText(title).first().click()
await expect(page).toHaveURL(/\/trips\/\d+/)
// The planner shows a Leaflet map once mounted (past the splash screen).
await expect(page.locator('.leaflet-container')).toBeVisible({ timeout: 20_000 })
// The planner shows its configured map once mounted.
await expect(page.locator('.leaflet-container, .maplibregl-canvas, .mapboxgl-canvas').first()).toBeVisible({ timeout: 20_000 })
})
+2 -2
View File
@@ -102,9 +102,9 @@ test('#1809 iPhone: flow screens scroll the document, full-screen ones do not',
// deliberately do NOT scroll the document (and so keep the address bar), and
// the map must not collapse to zero height now that the shell has none.
await page.goto('/atlas')
await expect(page.locator('.leaflet-container')).toBeVisible({ timeout: 20_000 })
await expect(page.locator('canvas[aria-label="Atlas"]')).toBeVisible({ timeout: 20_000 })
const atlas = await page.evaluate(() => {
const map = document.querySelector('.leaflet-container') as HTMLElement
const map = document.querySelector('canvas[aria-label="Atlas"]') as HTMLElement
window.scrollBy(0, 400)
return {
top: document.scrollingElement!.scrollTop,
+22 -3
View File
@@ -18,11 +18,30 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
TrekSharedFiles.receive(context.url)
}
// Launched by a tap on a widget or a Live Activity: held like a quick action.
// Capacitor still hears of the link, the UI ignores it there (feature appLinks).
for context in connectionOptions.urlContexts {
// Capacitor must not hear of the link as well, or a UI that still follows the
// launch URL (a server before feature appLinks) opens the page twice.
let appLinks = connectionOptions.urlContexts.filter { TrekQuickActions.appLinkPath($0.url) != nil }
for context in appLinks {
if let path = TrekQuickActions.appLinkPath(context.url) { TrekQuickActions.open(path: path) }
}
SceneDelegateProxy.shared.scene(scene, willConnectTo: session, options: connectionOptions)
if appLinks.isEmpty {
SceneDelegateProxy.shared.scene(scene, willConnectTo: session, options: connectionOptions)
} else {
connectWithoutAppLinks(scene, others: connectionOptions.urlContexts.subtracting(appLinks),
activities: connectionOptions.userActivities)
}
}
/// What SceneDelegateProxy does on a launch, for the links it may have: the
/// options cannot be rebuilt without the app links, so they go in here.
private func connectWithoutAppLinks(_ scene: UIScene, others: Set<UIOpenURLContext>, activities: Set<NSUserActivity>) {
NotificationCenter.default.post(name: .capacitorSceneWillConnect, object: scene)
var token: NSObjectProtocol?
token = NotificationCenter.default.addObserver(forName: .capacitorViewDidAppear, object: nil, queue: .main) { _ in
if let token { NotificationCenter.default.removeObserver(token) }
if !others.isEmpty { SceneDelegateProxy.shared.scene(scene, openURLContexts: others) }
for activity in activities { SceneDelegateProxy.shared.scene(scene, continue: activity) }
}
}
// The app switcher takes its snapshot as the scene resigns active, so the
@@ -121,6 +121,9 @@ class TrekBridgeViewController: CAPBridgeViewController {
right: max(0, safe.right - (window.bounds.maxX - frame.maxX))
)
let corner = cornerElement(in: frame, window: window)
if corner != .zero, UIDevice.current.model == "iPhone", cornerWindowSizes.insert(sizeKey(window.bounds.size)).inserted {
setNeedsStatusBarAppearanceUpdate()
}
if !force, insets == publishedSafeArea, corner == publishedCorner { return }
publishedSafeArea = insets
publishedCorner = corner
@@ -139,15 +142,37 @@ class TrekBridgeViewController: CAPBridgeViewController {
private var publishedCorner: UIEdgeInsets?
// MARK: - The status bar beside a corner element
/// The window sizes on which a corner element was seen. On an iPhone Duo
/// that element is the status capsule, so the app hides the status bar
/// there to take the capsule away; whatever still covers the corner stays
/// in the safe area the page keeps clear of. A size stays in the set
/// once seen: with the bar hidden the next measure may find no corner, and
/// showing the bar again would bring the capsule back and start over. The
/// folded and the unfolded display differ in size, so each keeps its own
/// answer, and a device without such an element never hides its bar. Only
/// on an iPhone: an iPad's window controls are such an element as well.
private var cornerWindowSizes = Set<String>()
private func sizeKey(_ size: CGSize) -> String {
"\(Int(size.width.rounded()))x\(Int(size.height.rounded()))"
}
override var prefersStatusBarHidden: Bool {
if super.prefersStatusBarHidden { return true }
guard let size = view.window?.bounds.size else { return false }
return cornerWindowSizes.contains(sizeKey(size))
}
/// An element in a top corner of the screen, such as the status capsule of
/// an iPhone Duo: how far down it reaches (top) and how wide it is on its
/// side (left/right), in the web view's coordinates; zero where there is
/// none. iOS 26 tells a corner apart from a whole edge: the safe area with
/// the corner avoided vertically reaches lower than the one avoiding it
/// horizontally, which in turn is wider on the corner's side. The page puts
/// its top bar beside the element and starts its content below it, using
/// the full width (mobile.css), instead of giving up a strip of the whole
/// height.
/// horizontally, which in turn is wider on the corner's side. The page
/// counts it into its safe area (mobile.css): upright its content starts
/// below the element, on a wide window it leaves the element's side free.
private func cornerElement(in frame: CGRect, window: UIWindow) -> UIEdgeInsets {
guard #available(iOS 26.0, *) else { return .zero }
let vertical = view.edgeInsets(for: .safeArea(cornerAdaptation: .vertical))
@@ -477,9 +502,14 @@ enum TrekServerStore {
/// filled in with that server (previousURL). Raise both together.
private static let serverCheck = 3
private static var rechecked = false
/// Runs before the first bridge is built, so a server picked under an older
/// minimum is not loaded unchecked.
/// minimum is not loaded unchecked. Once per launch: the bridge that
/// restoreForOffline restarts must keep the server it put back.
static func recheckAfterUpdate() {
guard !rechecked else { return }
rechecked = true
let defaults = UserDefaults.standard
guard defaults.integer(forKey: checkedKey) < serverCheck else { return }
defaults.set(serverCheck, forKey: checkedKey)
@@ -165,14 +165,20 @@ enum TrekDate {
guard let iso, iso.count >= 10 else { return nil }
let ymd = iso.prefix(10).split(separator: "-").compactMap { Int($0) }
guard ymd.count == 3 else { return nil }
return Calendar.current.date(from: DateComponents(year: ymd[0], month: ymd[1], day: ymd[2]))
return gregorian().date(from: DateComponents(year: ymd[0], month: ymd[1], day: ymd[2]))
}
static func iso(_ date: Date) -> String {
let parts = Calendar.current.dateComponents([.year, .month, .day], from: date)
let parts = gregorian().dateComponents([.year, .month, .day], from: date)
return String(format: "%04d-%02d-%02d", parts.year ?? 0, parts.month ?? 0, parts.day ?? 0)
}
private static func gregorian() -> Calendar {
var calendar = Calendar(identifier: .gregorian)
calendar.timeZone = .current
return calendar
}
/// yyyy-MM-dd and HH:mm as a moment, in `zone` when given, else here; midnight without a time.
static func moment(_ date: String?, _ time: String?, zone: String? = nil) -> Date? {
guard let date, date.count >= 10 else { return nil }
+29 -10
View File
@@ -512,8 +512,8 @@ struct StopList: View {
ForEach(Array(window.enumerated()), id: \.offset) { offset, stop in
let past = (stop.minutes ?? Int.max) < nowMinutes
let isNext = !past && (offset == 0 || (window[offset - 1].minutes ?? Int.max) < nowMinutes)
if isNext && offset > 0, let nowLabel { nowLine(nowLabel) }
row(stop, past: past, isNext: isNext, last: offset == window.count - 1)
if isNext && offset > 0, let nowLabel { nowLine(nowLabel, in: window) }
row(stop, in: window, past: past, isNext: isNext, last: offset == window.count - 1)
}
}
}
@@ -528,13 +528,33 @@ struct StopList: View {
private var ink: Color { onPhoto ? .white : Trek.ink(scheme) }
private func row(_ stop: WidgetSnapshot.Stop, past: Bool, isNext: Bool, last: Bool) -> some View {
/// The time column, as wide as the longest time in the window (and the now
/// marker's label): every row lays all of them over each other, hidden, so
/// "5:45 AM" fits as well as "09:30" and the dots still stand in one line.
private func timeColumn<Label: View>(_ window: [WidgetSnapshot.Stop], @ViewBuilder label: () -> Label) -> some View {
ZStack(alignment: .leading) {
ForEach(Array(window.enumerated()), id: \.offset) { _, stop in
Text(stop.time ?? "–").font(Trek.number(11.5, .heavy)).hidden()
}
if let nowLabel { nowText(nowLabel).hidden() }
label()
}
.lineLimit(1)
.fixedSize(horizontal: true, vertical: false)
.frame(minWidth: 38, alignment: .leading)
}
private func nowText(_ label: String) -> some View {
Text(label.uppercased()).font(.system(size: 8.5, weight: .heavy)).tracking(0.5).foregroundStyle(Trek.danger)
}
private func row(_ stop: WidgetSnapshot.Stop, in window: [WidgetSnapshot.Stop], past: Bool, isNext: Bool, last: Bool) -> some View {
let color = Color(css: stop.color) ?? (onPhoto ? .white : Trek.info)
return HStack(alignment: .top, spacing: 8) {
Text(stop.time ?? "–")
.font(Trek.number(11.5, isNext ? .heavy : .semibold))
.frame(width: 38, alignment: .leading)
.padding(.top, 1)
timeColumn(window) {
Text(stop.time ?? "–").font(Trek.number(11.5, isNext ? .heavy : .semibold))
}
.padding(.top, 1)
VStack(spacing: 0) {
ZStack {
Circle().fill(color).frame(width: isNext ? 11 : 8, height: isNext ? 11 : 8)
@@ -562,10 +582,9 @@ struct StopList: View {
.frame(height: 24, alignment: .top)
}
private func nowLine(_ label: String) -> some View {
private func nowLine(_ label: String, in window: [WidgetSnapshot.Stop]) -> some View {
HStack(spacing: 5) {
Text(label.uppercased()).font(.system(size: 8.5, weight: .heavy)).tracking(0.5).foregroundStyle(Trek.danger)
.frame(width: 38, alignment: .leading)
timeColumn(window) { nowText(label) }
Circle().fill(Trek.danger).frame(width: 5, height: 5).frame(width: 15)
Rectangle().fill(Trek.danger).frame(height: 1.2)
}
@@ -320,14 +320,16 @@ struct WidgetSnapshot: Codable {
guard let days, !days.isEmpty else { return self }
let key = WidgetSnapshot.key(date)
var snapshot = self
snapshot.today = days.first { $0.date == key }
if today?.date != key { snapshot.today = days.first { $0.date == key } }
snapshot.bookings = bookings?.filter { ($0.date ?? key) >= key }
return snapshot
}
/// A date as the app writes one, yyyy-MM-dd in the device's calendar day.
static func key(_ date: Date) -> String {
let parts = Calendar.current.dateComponents([.year, .month, .day], from: date)
var calendar = Calendar(identifier: .gregorian)
calendar.timeZone = .current
let parts = calendar.dateComponents([.year, .month, .day], from: date)
return String(format: "%04d-%02d-%02d", parts.year ?? 0, parts.month ?? 0, parts.day ?? 0)
}
+4 -1
View File
@@ -5,6 +5,7 @@ import { SplashScreen } from '@capacitor/splash-screen';
import { StatusBar, Style } from '@capacitor/status-bar';
import { PASSWORD_MIN_LENGTH, passwordProblem, passwordRuleStates } from '../../shared/src/auth/password-policy';
import logoWhite from '../public/logo-light.svg'; // #fff wordmark, for the landscape
import { pageUnderStatusBar } from '../src/native/appBoot';
import { AUTH_GATE_NAMES, canSignInInApp, type AuthGate } from '../src/native/authGate';
import { opensSoon, refundedBeforeOpening } from '../src/native/cloudOrders';
import { fakeIapClient, getIapClient, productIdFor, type Purchase } from '../src/native/iap';
@@ -1705,7 +1706,9 @@ function showUnreachable(server: string, cert?: ClientCertDemand, failure?: stri
*/
async function paintStatusBar(): Promise<void> {
try {
await StatusBar.setStyle({ style: Style.Dark });
// Below the bar on an older Android WebView the page stops, and the bar
// stands on the window's light colour instead: dark icons there.
await StatusBar.setStyle({ style: pageUnderStatusBar() ? Style.Dark : Style.Light });
if (wideLayout.matches) await StatusBar.hide();
else await StatusBar.show();
} catch {
+26 -5
View File
@@ -204,11 +204,32 @@
--sea: #cfe3ef;
--text-face: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
--display-face: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
/* The insets of the device, from the web view or, on iOS, from the native side. */
--safe-top: max(env(safe-area-inset-top, 0px), var(--trek-native-safe-top, 0px));
--safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--trek-native-safe-bottom, 0px));
--safe-start: max(env(safe-area-inset-left, 0px), var(--trek-native-safe-left, 0px));
--safe-end: max(env(safe-area-inset-right, 0px), var(--trek-native-safe-right, 0px));
/* The insets of the device, from the web view or from the native side. On
* Android a web view can report env() as 0 while the page reaches under the
* status and navigation bars; Capacitor's SystemBars writes the real insets
* to --safe-area-inset-* instead (0 where it lays the web view out between
* the bars). iOS measures its own (TrekBridgeViewController publishSafeArea).
* In a browser the variables are unset: env() alone. */
--safe-top: max(
env(safe-area-inset-top, 0px),
var(--safe-area-inset-top, 0px),
var(--trek-native-safe-top, 0px)
);
--safe-bottom: max(
env(safe-area-inset-bottom, 0px),
var(--safe-area-inset-bottom, 0px),
var(--trek-native-safe-bottom, 0px)
);
--safe-start: max(
env(safe-area-inset-left, 0px),
var(--safe-area-inset-left, 0px),
var(--trek-native-safe-left, 0px)
);
--safe-end: max(
env(safe-area-inset-right, 0px),
var(--safe-area-inset-right, 0px),
var(--trek-native-safe-right, 0px)
);
color-scheme: light;
-webkit-text-size-adjust: 100%;
}
+28 -22
View File
@@ -1,6 +1,6 @@
{
"name": "@trek/client",
"version": "5.1.4",
"version": "5.2.2",
"engines": {
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
},
@@ -53,7 +53,7 @@
"format:check": "prettier --check \"src/**/*.tsx\" \"src/**/*.css\""
},
"dependencies": {
"@assistant-ui/react": "0.15.36",
"@assistant-ui/react": "0.15.38",
"@capacitor/action-sheet": "^8.1.1",
"@capacitor/android": "^8.6.2",
"@capacitor/app": "^8.1.1",
@@ -102,23 +102,24 @@
"@fontsource/shrikhand": "^5.3.0",
"@fontsource/yellowtail": "^5.3.0",
"@maplibre/maplibre-gl-leaflet": "0.1.4",
"@noble/hashes": "^1.8.0",
"@simplewebauthn/browser": "^13.3.0",
"@noble/hashes": "^2.4.0",
"@simplewebauthn/browser": "^14.0.0",
"@trek/shared": "*",
"axios": "^1.21.0",
"dexie": "^4.4.7",
"drag-drop-touch": "^1.3.1",
"earcut": "^3.0.2",
"heic-to": "^1.6.7",
"iso-3166-2": "^1.0.0",
"leaflet": "^1.9.4",
"lucide-react": "^0.577.0",
"mapbox-gl": "^3.35.0",
"maplibre-gl": "6.18.0",
"mapbox-gl": "3.32.0",
"maplibre-gl": "6.19.0",
"modern-screenshot": "4.7.0",
"plyr": "^3.8.5",
"react": "^19.3.1",
"react-dom": "^19.3.1",
"react-dropzone": "^14.4.1",
"react-dropzone": "^20.2.1",
"react-leaflet": "^5.0.0",
"react-leaflet-cluster": "^4.1.3",
"react-markdown": "^10.1.0",
@@ -126,6 +127,7 @@
"rehype-sanitize": "^6.0.0",
"remark-breaks": "^4.0.0",
"remark-gfm": "^4.0.1",
"topojson-client": "^3.1.0",
"tz-lookup": "^6.1.25",
"zod": "^4.6.7",
"zustand": "^5.0.15"
@@ -135,37 +137,41 @@
"@eslint/js": "^10.0.1",
"@jscpd/core": "^4.2.5",
"@jscpd/tokenizer": "^4.2.6",
"@playwright/test": "^1.65.0",
"@testing-library/jest-dom": "^6.10.0",
"@playwright/test": "^1.65.1",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^8.0.0",
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.6.10",
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
"@types/leaflet": "^1.9.22",
"@types/node": "^25.9.8",
"@types/react": "^19.3.0",
"@testing-library/user-event": "^14.6.13",
"@trivago/prettier-plugin-sort-imports": "^6.0.3",
"@types/geojson": "^7946.0.16",
"@types/leaflet": "^1.9.23",
"@types/node": "^26.6.11",
"@types/react": "^19.3.2",
"@types/react-dom": "^19.3.0",
"@types/topojson-client": "^3.1.5",
"@types/topojson-specification": "^1.0.5",
"@vitejs/plugin-react": "^6.2.1",
"@vitest/coverage-v8": "^4.1.12",
"autoprefixer": "^10.6.2",
"@vitest/coverage-v8": "^5.1.2",
"autoprefixer": "^10.7.0",
"eslint": "^10.11.0",
"eslint-config-flat-gitignore": "^2.4.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.7",
"eslint-plugin-react-refresh": "^0.5.8",
"fake-indexeddb": "^6.2.7",
"jsdom": "^29.1.1",
"msw": "^2.15.0",
"postcss": "^8.5.28",
"msw": "^3.0.8",
"postcss": "^8.5.33",
"prettier": "^3.10.1",
"prettier-plugin-organize-imports": "^4.3.0",
"prettier-plugin-tailwindcss": "^0.8.1",
"rollup-plugin-visualizer": "^7.1.2",
"rollup-plugin-visualizer": "^7.3.0",
"sharp": "^0.35.5",
"tailwindcss": "^3.4.19",
"typescript": "^6.0.3",
"typescript-eslint": "^8.72.1",
"typescript-eslint": "^8.74.0",
"vite": "8.3.8",
"vite-plugin-pwa": "^2.0.0",
"vitest": "^4.1.12"
"vitest": "^5.1.2"
}
}
+4 -1
View File
@@ -143,7 +143,10 @@ export default defineConfig({
stderr: 'pipe',
},
{
command: 'npm run dev',
// E2E_WEB_PREVIEW serves the client already built in dist/ (`npm run build`
// first) instead of a dev server compiling it again: several media runs at
// once otherwise spend the machine on Vite and time out on the first page.
command: process.env.E2E_WEB_PREVIEW ? `npx vite preview --port ${WEB_PORT} --strictPort` : 'npm run dev',
port: WEB_PORT,
env: { TREK_DEV_PORT: String(WEB_PORT), TREK_DEV_API: `http://localhost:${API_PORT}` },
reuseExistingServer: !process.env.CI,
Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 KiB

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Some files were not shown because too many files have changed in this diff Show More