Files
resolutionflow/frontend/e2e/history.spec.ts
Michael Chihlas 37c4e0c99e
Some checks failed
Mirror to GitHub / mirror (push) Successful in 15s
CI / frontend (pull_request) Failing after 2m37s
CI / e2e (pull_request) Has been skipped
CI / backend (pull_request) Has been cancelled
fix(e2e): update 5 selectors that drifted with FlowPilot/PSA UI changes
Mechanical drift between the e2e selectors and the current UI surfaced
on the first CI run after PR #149 unblocked the artifact upload step.
Five tests, three categories of drift:

1. **Page heading renames** (navigation.spec.ts)
   - `Sessions` → `Session History` on /sessions
   - `Account Settings` → `Account Management` on /account

2. **Route rename** (command-palette.spec.ts:74)
   - The "Troubleshoot with FlowPilot" command palette option now lands
     on /pilot (Phase 1 of the FlowPilot migration renamed /assistant).
     /assistant still 301-redirects, so the assertion accepts either.

3. **Feature moved to /sessions** (history.spec.ts, resume.spec.ts)
   - Default tab on /sessions is "AI Sessions"; flow-session filtering
     and the Resume button moved behind the "Flow Sessions" tab. Both
     tests now click that tab before asserting.
   - resume.spec.ts no longer starts at /trees (Resume buttons aren't
     rendered there anymore — the flow lives on /sessions). Destination
     URL (/trees/:id/navigate) is unchanged.

No product-code changes — these are pure test updates against the
shipped UI. Run the suite locally with
`cd frontend && npm run test:e2e` once a fresh build is available.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-25 15:21:25 -04:00

50 lines
1.8 KiB
TypeScript

import { expect, test } from '@playwright/test'
import {
createAuthenticatedApiContext,
createSession,
createTroubleshootingTree,
disposeApiContext,
uniqueName,
} from './helpers/api'
test.describe('session history smoke tests', () => {
test('can filter sessions by ticket and client, then open details', async ({ page }) => {
const api = await createAuthenticatedApiContext()
const ticketNumber = `PW-HISTORY-${Date.now()}`
const clientName = uniqueName('History Client')
const tree = await createTroubleshootingTree(api, {
name: uniqueName('Playwright History Flow'),
})
const session = await createSession(api, tree.id, {
ticket_number: ticketNumber,
client_name: clientName,
})
try {
await page.goto('/sessions')
await expect(
page.getByRole('heading', { name: 'Session History', exact: true }),
).toBeVisible()
// Default tab on /sessions is "AI Sessions"; flow sessions live behind
// the "Flow Sessions" tab and only that tab exposes ticket/client filters.
await page.getByRole('button', { name: 'Flow Sessions' }).click()
await page.getByPlaceholder('Search by ticket number...').fill(ticketNumber)
await page.getByPlaceholder('Search by client name...').fill(clientName)
const sessionCard = page.locator('.bg-card').filter({ hasText: ticketNumber }).filter({ hasText: clientName }).first()
await expect(sessionCard).toBeVisible()
await expect(sessionCard.getByText(tree.name)).toBeVisible()
await sessionCard.getByRole('button', { name: 'View Details' }).click()
await expect(page).toHaveURL(new RegExp(`/sessions/${session.id}$`))
await expect(page.getByRole('heading', { name: ticketNumber })).toBeVisible()
} finally {
await disposeApiContext(api)
}
})
})