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.

1.4 KB
Raw Blame
import { test, clearNotices, expect, seed } from './shot'

/**
 * Modals and dialogs.
 *
 * Captured as element screenshots (not full page) so the wiki gets the dialog
 * itself rather than a dimmed backdrop with a small box in the middle. Each one
 * asserts the dialog is actually open first — a missed click would otherwise
 * silently produce a screenshot of the page behind it.
 */


/**
 * The shared Modal (client/src/components/shared/Modal.tsx) sets neither
 * role="dialog" nor aria-modal, so there is no accessible role to query — the
 * backdrop class is the only stable hook. Target its child, which is the panel
 * itself, so the capture excludes the dimmed backdrop.
 */
function dialog(page: import('@playwright/test').Page) {
  return page.locator('.trek-modal-backdrop > div').first()
}

test('create trip modal — with the new currency field', async ({ page, shot }) => {
  await page.goto('/dashboard')
  await clearNotices(page)
  await page.getByRole('button', { name: /new trip/i }).first().click()
  await expect(dialog(page)).toBeVisible()
  await shot.element('TripCreate', dialog(page))
})

test('share dialog', async ({ page, shot }) => {
  await page.goto(`/trips/${seed.tripId}`)
  await clearNotices(page)
  await page.getByRole('button', { name: /share/i }).first().click()
  await expect(dialog(page)).toBeVisible()
  await shot.element('Share', dialog(page))
})