Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(help): three more the whole suite showed up

Mauricef6b2880abbac
diff --git a/client/e2e/help/trip-place.guide.ts b/client/e2e/help/trip-place.guide.ts
index 47fb2574b..1a610244c 100644
--- a/client/e2e/help/trip-place.guide.ts
+++ b/client/e2e/help/trip-place.guide.ts
@@ -384,9 +384,30 @@ const SCRIPTS: Record<string, GuideScript> = {
only(p => footer(p).getByRole('button', { name: 'Open Website' })),
],
},
+/**
+ * Take a place out of every collection it sits in.
+ *
+ * Run before the guide as well as after it: the Collections screen's own guides
+ * run earlier in the suite and leave places saved, and a place that is already
+ * in a list offers Saved where this guide's first step looks for Save to
+ * Collection.
+ */
+async function unsaveEverywhere(page: Page, name: string): Promise<void> {
+ const place = await findPlace(page, name)
+ if (!place) return
+ const query = new URLSearchParams({ name: place.name, lat: String(place.lat ?? ''), lng: String(place.lng ?? '') })
+ const res = await page.request.get(`/api/addons/collections/membership?${query.toString()}`)
+ if (!res.ok()) return
+ const body = (await res.json()) as { lists?: { place_id: number }[] }
+ for (const entry of body.lists ?? []) {
+ await page.request.delete(`/api/addons/collections/places/${entry.place_id}`)
+ }
+}
+
'place-to-collection': {
guide: guide('place-to-collection'),
start: async p => {
+ await unsaveEverywhere(p, 'Senso-ji Temple')
await openTrip(p, { day: null })
await openPlace(p, 'Senso-ji Temple')
},
@@ -417,16 +438,7 @@ const SCRIPTS: Record<string, GuideScript> = {
},
},
],
- cleanup: async p => {
- const place = await findPlace(p, 'Senso-ji Temple')
- if (!place) return
- const query = new URLSearchParams({ name: place.name, lat: String(place.lat ?? ''), lng: String(place.lng ?? '') })
- const res = await p.request.get(`/api/addons/collections/membership?${query.toString()}`)
- const body = (await res.json()) as { lists?: { place_id: number }[] }
- for (const entry of body.lists ?? []) {
- await p.request.delete(`/api/addons/collections/places/${entry.place_id}`)
- }
- },
+ cleanup: p => unsaveEverywhere(p, 'Senso-ji Temple'),
},
'place-track': {
guide: guide('place-track'),
diff --git a/client/e2e/help/trip-roadtrip.guide.ts b/client/e2e/help/trip-roadtrip.guide.ts
index 54f55faaa..0a9a5ce56 100644
--- a/client/e2e/help/trip-roadtrip.guide.ts
+++ b/client/e2e/help/trip-roadtrip.guide.ts
@@ -218,15 +218,17 @@ const SCRIPTS: Record<string, GuideScript> = {
only(p => dayCard(p, 2).locator('header')),
only(p => dayCard(p, 2).getByRole('list').first()),
{
- target: p => dayCard(p, 1).locator('header'),
+ // Day 2, like the two steps above: the rail leaves out a day with
+ // nothing to drive, and day 1 is one of them.
+ target: p => dayCard(p, 2).locator('header'),
act: async p => {
- await dayCard(p, 1).locator('header').click()
- await expect(dayCard(p, 1).locator('header')).toHaveAttribute('aria-expanded', 'false')
+ await dayCard(p, 2).locator('header').click()
+ await expect(dayCard(p, 2).locator('header')).toHaveAttribute('aria-expanded', 'false')
await settle(p)
// Folded is not the state to leave the trip in, and the result picture
// is of the whole drive rather than of one card shut.
- await dayCard(p, 1).locator('header').click()
- await expect(dayCard(p, 1).locator('header')).toHaveAttribute('aria-expanded', 'true')
+ await dayCard(p, 2).locator('header').click()
+ await expect(dayCard(p, 2).locator('header')).toHaveAttribute('aria-expanded', 'true')
await settle(p)
},
},
@@ -395,7 +397,9 @@ const SCRIPTS: Record<string, GuideScript> = {
// Which day the click landed on is the router's answer, not ours.
target: p => {
const day = seededTrip().dayIds.indexOf(viaDayId) + 1
- return dayCard(p, day > 0 ? day : 1).locator('header')
+ // Fall back to day 2, not day 1: the rail has no card for a day
+ // with nothing to drive.
+ return dayCard(p, day > 0 ? day : 2).locator('header')
},
},
{
diff --git a/client/e2e/help/trip-transports.guide.ts b/client/e2e/help/trip-transports.guide.ts
index 03f99dcfb..03ccedccf 100644
--- a/client/e2e/help/trip-transports.guide.ts
+++ b/client/e2e/help/trip-transports.guide.ts
@@ -68,9 +68,14 @@ const transportSheet = (page: Page) => portalDialog(page, page.getByRole('button
async function searchLocation(page: Page, box: Locator, query: string, match: RegExp): Promise<void> {
await box.click()
await typeInto(page, box, query)
- const first = suggestions(box).locator('button').first()
- await expect(first).toBeVisible({ timeout: 25_000 })
- await first.click()
+ const options = suggestions(box).locator('button')
+ await expect(options.first()).toBeVisible({ timeout: 25_000 })
+ // The suggestion that answers the query, not whatever came back first: this
+ // list is a live geocoder and its top hit for a landmark is as often a shop
+ // down the road, which then travels into the picture as the wrong address.
+ const wanted = options.filter({ hasText: match }).first()
+ await expect(wanted, `no suggestion for "${query}" matching ${match}`).toBeVisible({ timeout: 25_000 })
+ await wanted.click()
await expect(box).toHaveValue(match, { timeout: 15_000 })
}