mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 23:46:35 +00:00
31859651d7
Every help screen checked against the v5 redesign. Tours is documented for the first time, as a screen of its own with twelve screens under it, and notifications get help of their own. All pictures are taken again on a realistic demo trip, with short loops where a still cannot show the motion. The English is plain and every language is written naturally rather than word for word. The switcher shows two levels at most, a screen's overview lists its sub-screens as cards above its guides, each wiki page is linked once, and the help sidebar is wider. Fixes found along the way: Save to Collection keeps a tour's route, a track dropped on the places column opens the Tours import, tour Share on desktop, the unsaved tour draft lives on the account, a route click no longer adds an end point, Trip places leaves the trip's tours out, Escape closes a stage's day menu, confirms before destructive deletes, DWD warnings sharing one id kept apart, a booking's date moves with it, and smaller fixes across notifications, bookings, the day plan, stays, Atlas, Collections, Vacay and the admin screens.
43 lines
2.0 KiB
TypeScript
43 lines
2.0 KiB
TypeScript
import { test as setup, expect } from '@playwright/test'
|
|
import { writeFileSync, mkdirSync } from 'node:fs'
|
|
import path from 'node:path'
|
|
import { seedDemoData } from './seed'
|
|
import { ensureShowcase } from '../help/showcase'
|
|
import { E2E_BASE_URL, E2E_SEED_FILE } from '../../playwright.config'
|
|
|
|
/**
|
|
* Populates the throwaway E2E database with the demo trip before any screenshot
|
|
* runs. Its own Playwright project so it executes exactly once, after `setup`
|
|
* (which produces the authenticated storageState) and before `screenshots`.
|
|
*
|
|
* The resulting ids are written to disk because Playwright projects do not
|
|
* share memory — the capture specs read them back.
|
|
*/
|
|
setup('seed the demo trip', async ({ page, playwright }) => {
|
|
// page.request carries the storageState cookie, so this is authenticated as
|
|
// the admin. The factory hands the seeder throwaway contexts for the other
|
|
// members — see the comment in seed.ts on why they must not share one.
|
|
const result = await seedDemoData(page.request, token =>
|
|
playwright.request.newContext({
|
|
baseURL: E2E_BASE_URL,
|
|
// MUST be explicit: newContext otherwise picks up the project's
|
|
// storageState, i.e. the admin's trek_session cookie — and the server
|
|
// reads the cookie BEFORE the Authorization header
|
|
// (server/src/middleware/auth.ts:9), so every "member" write would be
|
|
// recorded as the admin while still returning 200.
|
|
storageState: undefined,
|
|
extraHTTPHeaders: token ? { Authorization: `Bearer ${token}` } : {},
|
|
}),
|
|
)
|
|
|
|
// The other trips with covers, places and the bookings ahead, so the
|
|
// dashboard and the lists around the seeded trip look lived in.
|
|
await ensureShowcase(page.request)
|
|
|
|
expect(result.tripId, 'trip was created').toBeTruthy()
|
|
expect(result.placeIds.length, 'places were created').toBeGreaterThan(0)
|
|
|
|
mkdirSync(path.join(process.cwd(), 'e2e', '.tmp'), { recursive: true })
|
|
writeFileSync(path.join(process.cwd(), E2E_SEED_FILE), JSON.stringify(result, null, 2))
|
|
})
|