From f6b2880abbacf5b8665371f258818b447ce2346f Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 22 Sep 2026 01:59:22 +0000 Subject: [PATCH] fix(help): three more the whole suite showed up - place-to-collection found the place already in a list, because the Collections screen's guides run earlier and leave it there. It clears the place first now, with the same helper its cleanup uses. - The road trip rail leaves out a day with nothing to drive, which its own helper says, and the fold step was the last place still pointing at day 1. - The transport form's location search took whatever the geocoder ranked first, and for a landmark that is as often a shop down the road. It picks the suggestion that answers the query. --- client/e2e/help/trip-place.guide.ts | 32 ++++++++++++++++-------- client/e2e/help/trip-roadtrip.guide.ts | 16 +++++++----- client/e2e/help/trip-transports.guide.ts | 11 +++++--- 3 files changed, 40 insertions(+), 19 deletions(-) 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 = { 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 { + 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 = { }, }, ], - 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 = { 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 = { // 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 { 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 }) }