- Use specific command palette placeholder to avoid ambiguous matches - Fix 'Quick Actions' scoping (two elements with same text) - Fix 'Resolved' exact match on session detail page - Fix tree editor to use getByText instead of getByDisplayValue - Fix 'Add Step' strict mode by using .first() - Fix fallback description placeholder text - Update playwright.config.ts to use port 5433 and resolutionflow DB - Update FlowPilot chat selectors to match actual page layout 11/17 new tests now passing. Remaining 6 need procedural session navigation investigation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
93 lines
3.3 KiB
TypeScript
93 lines
3.3 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, ask a question, navigate')).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, ask a question, navigate')).not.toBeVisible()
|
|
})
|
|
|
|
test('searches and shows AI Assistant option', async ({ page }) => {
|
|
const api = await createAuthenticatedApiContext()
|
|
const tree = 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, ask a question, navigate')
|
|
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('Ask FlowPilot AI')).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, ask a question, navigate')
|
|
await expect(input).toBeVisible()
|
|
await input.fill('analytics')
|
|
|
|
// Pages section should appear
|
|
await expect(page.getByText('Pages')).toBeVisible({ timeout: 3000 })
|
|
|
|
// Select the analytics page result (use last() to avoid matching sidebar nav)
|
|
await page.getByText('Analytics').last().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, ask a question, navigate')
|
|
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('Ask FlowPilot AI')
|
|
await expect(flowpilotOption).toBeVisible()
|
|
|
|
await flowpilotOption.click()
|
|
|
|
await expect(page).toHaveURL(/\/assistant/)
|
|
})
|
|
})
|