Files
resolutionflow/frontend/e2e/command-palette.spec.ts
Michael Chihlas 69f2a37591
Some checks failed
Mirror to GitHub / mirror (push) Successful in 11s
CI / frontend (pull_request) Successful in 5m52s
CI / e2e (pull_request) Has been cancelled
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:53:57 -04:00

96 lines
3.7 KiB
TypeScript

import { expect, test } from '@playwright/test'
import {
createAuthenticatedApiContext,
createTroubleshootingTree,
disposeApiContext,
uniqueName,
} from './helpers/api'
test.describe('command palette smoke tests', () => {
test('opens with Ctrl+K and shows empty state with quick actions', async ({ page }) => {
await page.goto('/')
await expect(page.getByTestId('app-shell')).toBeVisible()
// Open command palette with keyboard shortcut (Ctrl+K on Linux/CI)
await page.keyboard.press('Control+k')
// Should show the palette modal with search input
await expect(page.getByPlaceholder('Search flows, sessions, tags... or describe an issue to troubleshoot')).toBeVisible({ timeout: 3000 })
// Empty state should show quick actions — the palette label renders uppercase via CSS
// Use the palette container to scope the check
const palette = page.locator('.animate-scale-in')
await expect(palette.getByText('Create New Flow')).toBeVisible()
// Close with Escape
await page.keyboard.press('Escape')
await expect(page.getByPlaceholder('Search flows, sessions, tags... or describe an issue to troubleshoot')).not.toBeVisible()
})
test('searches and shows AI Assistant option', async ({ page }) => {
const api = await createAuthenticatedApiContext()
await createTroubleshootingTree(api, {
name: uniqueName('PW Palette Search Flow'),
})
try {
await page.goto('/')
await expect(page.getByTestId('app-shell')).toBeVisible()
await page.keyboard.press('Control+k')
const input = page.getByPlaceholder('Search flows, sessions, tags... or describe an issue to troubleshoot')
await expect(input).toBeVisible()
await input.fill('PW Palette Search')
// Should show AI Assistant section with FlowPilot option
await expect(page.getByText('AI Assistant')).toBeVisible({ timeout: 5000 })
await expect(page.getByText('Troubleshoot with FlowPilot')).toBeVisible()
} finally {
await disposeApiContext(api)
}
})
test('navigates to a page when typing a page name', async ({ page }) => {
await page.goto('/')
await expect(page.getByTestId('app-shell')).toBeVisible()
await page.keyboard.press('Control+k')
const input = page.getByPlaceholder('Search flows, sessions, tags... or describe an issue to troubleshoot')
await expect(input).toBeVisible()
await input.fill('analytics')
// Pages section should appear in the palette
const palette = page.locator('.animate-scale-in')
await expect(palette.getByText('Pages')).toBeVisible({ timeout: 3000 })
// Select the analytics page result — use the heading within the palette item
await palette.getByText('Analytics', { exact: true }).first().click()
await expect(page).toHaveURL(/\/analytics/)
})
test('FlowPilot option navigates to assistant chat', async ({ page }) => {
await page.goto('/')
await expect(page.getByTestId('app-shell')).toBeVisible()
await page.keyboard.press('Control+k')
const input = page.getByPlaceholder('Search flows, sessions, tags... or describe an issue to troubleshoot')
await expect(input).toBeVisible()
await input.fill('how do I fix a print spooler issue')
// AI Assistant section should appear with FlowPilot option
await expect(page.getByText('AI Assistant')).toBeVisible({ timeout: 3000 })
const flowpilotOption = page.getByText('Troubleshoot with FlowPilot')
await expect(flowpilotOption).toBeVisible()
await flowpilotOption.click()
// Phase 1 of the FlowPilot migration renamed /assistant to /pilot.
// /assistant still 301-redirects to /pilot, so accept either landing URL.
await expect(page).toHaveURL(/\/(pilot|assistant)/)
})
})