mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 02:34:21 +00:00
feat(planner): bring the plan tab and every trip dialog into the new look
The Plan tab was the last trip tab still in the old design. It now reads like Bookings, Costs, Lists, Files and Collab, without losing a function: - Day plan: each day is a card with a head band (day tile with weather, stay and rental pills, a "+" menu for place, stay, transport, transit and note), rows with "..." menus, white badges and a white route bar. - Places column: add, search and filters in three rows, a show dropdown, category and rating filters, and a selection bar at the foot. - Place inspector, day details and the stay editor on the shared dialog frame; the place form in the editor look with the name in the head band. - Clicking a booking or transport anywhere on the plan opens the booking detail popup first; Edit leads to the editor. The popup is one host shared with the Bookings and Transports tabs. - Files and Collab dialogs, notes, polls, links and chat moved to the same frame; shared DialogShell and dialogParts hold the building blocks. - The map hover card shows the place photo and follows the theme. Every new and reworded string is translated into all locales, and a few older English leftovers (help center, cost split, import hints) with them. Phone screens keep their own look.
This commit is contained in:
@@ -58,13 +58,24 @@ const travellers = (page: Page) => page.locator('[aria-label="Travelers"]')
|
||||
/** The card's delete question is its own portal, with no backdrop class to find it by. */
|
||||
const deleteAsk = (page: Page) => portalDialog(page, page.getByText('Delete booking?', { exact: true }))
|
||||
|
||||
/** The Booking Type field at the head of the form is a CustomSelect; this opens it. */
|
||||
/** The Booking Type is a pill in the head of the form; its name reads the type after the label. */
|
||||
const typePill = (page: Page) => modal(page).getByRole('button', { name: /^Booking Type:/ })
|
||||
/** The pill's list is its own portal, named after the pill's label. */
|
||||
const typeMenu = (page: Page) => page.getByRole('group', { name: 'Booking Type' })
|
||||
/** The status pill beside it says what a click turns it into. */
|
||||
const statusPill = (page: Page) => modal(page).getByRole('button', { name: /^Set to / })
|
||||
|
||||
async function openTypeMenu(page: Page): Promise<void> {
|
||||
await block(page, /^Booking Type$/).getByRole('button').first().click()
|
||||
await expect(selectMenu(page)).toBeVisible()
|
||||
await typePill(page).click()
|
||||
await expect(typeMenu(page)).toBeVisible()
|
||||
await beat(page, 300)
|
||||
}
|
||||
|
||||
async function pickType(page: Page, type: RegExp): Promise<void> {
|
||||
await typeMenu(page).getByRole('button', { name: type }).first().click()
|
||||
await expect(typeMenu(page)).toHaveCount(0)
|
||||
}
|
||||
|
||||
/** The Travelers field opens its members as a list under it, inside the form. */
|
||||
const travelerList = (page: Page) => block(page, /^Travelers$/).getByRole('listbox')
|
||||
|
||||
@@ -162,17 +173,16 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
prepare: async p => {
|
||||
await openTypeMenu(p)
|
||||
},
|
||||
target: selectMenu,
|
||||
target: typeMenu,
|
||||
act: async p => {
|
||||
await selectMenu(p).getByRole('button', { name: /^Event$/ }).first().click()
|
||||
await expect(selectMenu(p)).toHaveCount(0)
|
||||
await expect(block(p, /^Booking Type$/).getByRole('button', { name: /Event/ })).toBeVisible()
|
||||
await pickType(p, /^Event$/)
|
||||
await expect(typePill(p)).toHaveAccessibleName(/^Booking Type:\s*Event$/)
|
||||
await settle(p)
|
||||
},
|
||||
},
|
||||
{
|
||||
prepare: async p => { await typeInto(p, titleBox(p), 'Kabuki at the Minamiza') },
|
||||
target: p => block(p, /^Title \*$/),
|
||||
target: titleBox,
|
||||
act: async p => {
|
||||
await expect(saveButton(p, 'Add')).toBeEnabled()
|
||||
await settle(p)
|
||||
@@ -195,7 +205,8 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
{
|
||||
prepare: async p => {
|
||||
await typeInto(p, codeBox(p), 'MZ-5521')
|
||||
await chooseIn(p, /^Status$/, /^Confirmed$/)
|
||||
await statusPill(p).click()
|
||||
await expect(statusPill(p)).toHaveAccessibleName('Set to Pending')
|
||||
},
|
||||
target: p => row(p, /^Booking Code$/),
|
||||
act: settle,
|
||||
@@ -222,10 +233,9 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
await expect(modal(p).getByRole('heading', { name: 'New Reservation' })).toBeVisible()
|
||||
await openTypeMenu(p)
|
||||
},
|
||||
target: selectMenu,
|
||||
target: typeMenu,
|
||||
act: async p => {
|
||||
await selectMenu(p).getByRole('button', { name: /^Accommodation$/ }).first().click()
|
||||
await expect(selectMenu(p)).toHaveCount(0)
|
||||
await pickType(p, /^Accommodation$/)
|
||||
await expect(label(p, /^Check-in until$/)).toBeVisible()
|
||||
await settle(p)
|
||||
},
|
||||
@@ -583,16 +593,12 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
act: settle,
|
||||
},
|
||||
{
|
||||
prepare: async p => {
|
||||
await block(p, /^Status$/).getByRole('button').first().click()
|
||||
await expect(selectMenu(p)).toBeVisible()
|
||||
await beat(p, 300)
|
||||
},
|
||||
target: p => block(p, /^Status$/),
|
||||
target: statusPill,
|
||||
act: async p => {
|
||||
await selectMenu(p).getByRole('button', { name: /^Confirmed$/ }).click()
|
||||
await expect(selectMenu(p)).toHaveCount(0)
|
||||
await expect(block(p, /^Status$/).getByRole('button', { name: 'Confirmed' })).toBeVisible()
|
||||
await expect(statusPill(p)).toHaveAccessibleName('Set to Confirmed')
|
||||
await statusPill(p).click()
|
||||
await expect(statusPill(p)).toHaveAccessibleName('Set to Pending')
|
||||
await expect(statusPill(p)).toHaveText('Confirmed')
|
||||
await settle(p)
|
||||
},
|
||||
},
|
||||
|
||||
@@ -42,8 +42,10 @@ const forecast = (page: Page) => panel(page).getByText(/^Forecast for /)
|
||||
const chips = (page: Page) => panel(page).locator('svg.lucide-sunrise').locator('xpath=ancestor::div[2]')
|
||||
/** The day's reservations block. */
|
||||
const bookings = (page: Page) => panel(page).getByText('Reservations', { exact: true }).locator('xpath=..')
|
||||
/** One booking row: the title sits in a wrapper, the row is its grandparent. */
|
||||
const bookingRow = (page: Page, title: string) => panel(page).getByText(title).locator('xpath=ancestor::div[2]')
|
||||
/** One booking row: on the desktop a button that opens the booking, named with its title. */
|
||||
const bookingRow = (page: Page, title: string) => panel(page).getByRole('button', { name: title })
|
||||
/** The booking a row opens, named by its title. */
|
||||
const bookingDetail = (page: Page, title: string) => page.getByRole('dialog', { name: title })
|
||||
|
||||
/**
|
||||
* Select a day by its title rather than by the middle of its header: a day with
|
||||
@@ -305,8 +307,15 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
only(bookings),
|
||||
only(p => bookingRow(p, EVENING_WALK)),
|
||||
only(p => bookingRow(p, 'Nozomi 21')),
|
||||
// Only pointed at: clicking it would leave the plan for the Bookings tab.
|
||||
only(p => p.getByRole('button', { name: 'Bookings', exact: true })),
|
||||
{
|
||||
// A row opens its booking over the plan; Edit at its foot is where it changes.
|
||||
prepare: async p => {
|
||||
await bookingRow(p, 'Nozomi 21').click()
|
||||
await expect(bookingDetail(p, 'Nozomi 21')).toBeVisible()
|
||||
await settle(p)
|
||||
},
|
||||
target: p => bookingDetail(p, 'Nozomi 21').getByRole('button', { name: 'Edit', exact: true }),
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { test, expect, type Locator, type Page } from '@playwright/test'
|
||||
import { captureGuide, captureHero, settle, typeInto, VIEWPORT, type GuideScript } from './guide'
|
||||
import { seededTrip, ensureMapFixtures } from './fixtures'
|
||||
import { openTrip, openTripOnDay, selectDay, modal } from './trip-shared'
|
||||
import { openTrip, openTripOnDay, selectDay, modal, dialog } from './trip-shared'
|
||||
import { ensureDawarichConnection, disconnectDawarich } from './external'
|
||||
import { tripMapContext, tripMapGuides } from '../../src/help/contexts/tripMap'
|
||||
import type { HelpGuide } from '../../src/help/types'
|
||||
@@ -367,7 +367,8 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
await settle(p)
|
||||
},
|
||||
},
|
||||
{ target: p => modal(p).getByPlaceholder('e.g. Eiffel Tower').locator('xpath=ancestor::form[1]') },
|
||||
// The whole dialog: the name is typed in its head band, outside the form.
|
||||
{ target: p => dialog(p) },
|
||||
{
|
||||
target: p => modal(p).getByRole('button', { name: 'Add', exact: true }),
|
||||
act: async p => {
|
||||
@@ -413,7 +414,7 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
await typeInto(p, modal(p).getByPlaceholder('e.g. Eiffel Tower'), NEW_PLACE)
|
||||
await settle(p)
|
||||
},
|
||||
target: p => modal(p).getByPlaceholder('e.g. Eiffel Tower').locator('xpath=ancestor::form[1]'),
|
||||
target: p => dialog(p),
|
||||
},
|
||||
{
|
||||
target: p => modal(p).getByRole('button', { name: 'Add', exact: true }),
|
||||
|
||||
@@ -53,8 +53,10 @@ const member = (page: Page, name: string) => participants(page).getByRole('butto
|
||||
const addMember = (page: Page) => participants(page).getByRole('button', { name: '+', exact: true })
|
||||
/** "Files" while the place has none, "<n> files" once it has. */
|
||||
const filesToggle = (page: Page) => card(page).getByRole('button', { name: /^(Files|\d+ files)$/ })
|
||||
/** The booking strip is a button only for a viewer who may open the booking. */
|
||||
const bookingStrip = (page: Page) => card(page).getByRole('button', { name: 'Edit Reservation' })
|
||||
/** The booking strip opens the booking; it is a button named after it. */
|
||||
const bookingStrip = (page: Page) => card(page).getByRole('button', { name: `Open booking: ${BOOKING}` })
|
||||
/** The booking the strip opens, named by its title. Its form is one Edit further. */
|
||||
const bookingDetail = (page: Page) => page.getByRole('dialog', { name: BOOKING })
|
||||
/** The strip's lower row: Date, Time and Booking Code beside each other. */
|
||||
const bookingFields = (page: Page) => bookingStrip(page).locator('> div').nth(1)
|
||||
const dayHeader = (page: Page, n: number) => page.getByRole('button', { name: new RegExp(`^${n} .*Day ${n} `) })
|
||||
@@ -407,11 +409,16 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
target: bookingStrip,
|
||||
act: async p => {
|
||||
await bookingStrip(p).click()
|
||||
await expect(modal(p).getByRole('heading', { name: 'Edit Reservation' })).toBeVisible()
|
||||
await expect(bookingDetail(p)).toBeVisible()
|
||||
await settle(p)
|
||||
},
|
||||
},
|
||||
{
|
||||
prepare: async p => {
|
||||
await bookingDetail(p).getByRole('button', { name: 'Edit', exact: true }).click()
|
||||
await expect(modal(p).getByRole('heading', { name: 'Edit Reservation' })).toBeVisible()
|
||||
await settle(p)
|
||||
},
|
||||
target: p => modal(p).getByText('Link to day assignment', { exact: true }).locator('xpath=..'),
|
||||
act: closeModal,
|
||||
},
|
||||
|
||||
@@ -102,7 +102,9 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
// The details column is an <aside> beside the form; both used to resolve to
|
||||
// the whole dialog, which gave two steps the same picture.
|
||||
only(p => modal(p).getByText('Place details', { exact: true }).locator('xpath=ancestor::aside[1]')),
|
||||
only(p => modal(p).getByPlaceholder('e.g. Eiffel Tower').locator('xpath=ancestor::form[1]')),
|
||||
// The name and the category sit in the head band, above the form, so the
|
||||
// step about the fields shows the dialog rather than the form alone.
|
||||
only(p => dialog(p)),
|
||||
{
|
||||
target: p => modal(p).getByRole('button', { name: 'Add', exact: true }),
|
||||
act: async p => {
|
||||
|
||||
@@ -43,6 +43,10 @@ const dayHeader = (page: Page, n: number) => page.getByRole('button', { name: ne
|
||||
const card = (page: Page, text: string) => page.locator('.bg-surface-card').filter({ hasText: text }).first()
|
||||
/** A transport's row in the day plan; the whole row is the button that opens it. */
|
||||
const transportRow = (page: Page, name: RegExp) => page.getByRole('button', { name }).first()
|
||||
/** The booking a click on a row or a card opens, named by the booking's title. */
|
||||
const bookingDetail = (page: Page, title: string) => page.getByRole('dialog', { name: title })
|
||||
/** The Edit at the foot of that booking, which leads on to its form. */
|
||||
const detailEdit = (page: Page, title: string) => bookingDetail(page, title).getByRole('button', { name: 'Edit', exact: true })
|
||||
/** A toolbar type chip or a section heading — both are a label followed by their count. */
|
||||
const counted = (page: Page, label: string) => page.getByRole('button', { name: new RegExp(`^${label} \\d+$`) })
|
||||
/** A labelled field block inside the open dialog. */
|
||||
@@ -393,15 +397,15 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
target: p => card(p, JOURNEY.onCard),
|
||||
act: async p => {
|
||||
await card(p, JOURNEY.onCard).click()
|
||||
await expect(modal(p).getByRole('heading', { name: 'Public transit journey' })).toBeVisible()
|
||||
await expect(bookingDetail(p, JOURNEY.title)).toBeVisible()
|
||||
await settle(p)
|
||||
},
|
||||
},
|
||||
only(p => modal(p).getByText('Itinerary', { exact: true }).locator('xpath=..')),
|
||||
only(p => bookingDetail(p, JOURNEY.title).getByText('Itinerary', { exact: true }).locator('xpath=..')),
|
||||
{
|
||||
target: p => modal(p).getByRole('button', { name: 'Change route' }),
|
||||
target: p => bookingDetail(p, JOURNEY.title).getByRole('button', { name: 'Change route' }),
|
||||
act: async p => {
|
||||
await modal(p).getByRole('button', { name: 'Change route' }).click()
|
||||
await bookingDetail(p, JOURNEY.title).getByRole('button', { name: 'Change route' }).click()
|
||||
await expect(modal(p).getByRole('button', { name: 'Search' })).toBeVisible()
|
||||
await settle(p)
|
||||
},
|
||||
@@ -476,11 +480,18 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
target: p => transportRow(p, FLIGHT.row),
|
||||
act: async p => {
|
||||
await transportRow(p, FLIGHT.row).click()
|
||||
await expect(bookingDetail(p, FLIGHT.title)).toBeVisible()
|
||||
await settle(p)
|
||||
},
|
||||
},
|
||||
{
|
||||
target: p => detailEdit(p, FLIGHT.title),
|
||||
act: async p => {
|
||||
await detailEdit(p, FLIGHT.title).click()
|
||||
await expect(modal(p).getByRole('heading', { name: 'Edit transport' })).toBeVisible()
|
||||
await settle(p)
|
||||
},
|
||||
},
|
||||
only(dialog),
|
||||
only(p => block(p, 'Route')),
|
||||
{
|
||||
// Escape rather than Update: nothing about the seeded flight may change.
|
||||
|
||||
Reference in New Issue
Block a user