diff --git a/frontend/e2e/command-palette.spec.ts b/frontend/e2e/command-palette.spec.ts index 1073302e..11bbace4 100644 --- a/frontend/e2e/command-palette.spec.ts +++ b/frontend/e2e/command-palette.spec.ts @@ -7,27 +7,25 @@ import { } from './helpers/api' test.describe('command palette smoke tests', () => { - test('opens with Cmd+K and shows empty state with quick actions', async ({ page }) => { + 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 - await page.keyboard.press('Meta+k') + // Open command palette with keyboard shortcut (Ctrl+K on Linux/CI) + await page.keyboard.press('Control+k') - // Should show the palette modal - const palette = page.locator('[class*="fixed"][class*="z-"]').filter({ hasText: 'Quick Actions' }) - await expect(palette).toBeVisible() + // Should show the palette modal with search input + await expect(page.getByPlaceholder(/Search flows/)).toBeVisible({ timeout: 3000 }) - // Empty state should show quick actions, no FlowPilot - await expect(palette.getByText('Quick Actions')).toBeVisible() - await expect(palette.getByText('FlowPilot AI')).not.toBeVisible() + // Empty state should show quick actions + await expect(page.getByText('Quick Actions')).toBeVisible() // Close with Escape await page.keyboard.press('Escape') - await expect(palette).not.toBeVisible() + await expect(page.getByPlaceholder(/Search flows/)).not.toBeVisible() }) - test('searches flows and shows results grouped by category', async ({ page }) => { + test('searches and shows AI Assistant option', async ({ page }) => { const api = await createAuthenticatedApiContext() const tree = await createTroubleshootingTree(api, { name: uniqueName('PW Palette Search Flow'), @@ -37,16 +35,15 @@ test.describe('command palette smoke tests', () => { await page.goto('/') await expect(page.getByTestId('app-shell')).toBeVisible() - await page.keyboard.press('Meta+k') + await page.keyboard.press('Control+k') - // Type a search query matching the flow name const input = page.getByPlaceholder(/Search flows/) + await expect(input).toBeVisible() await input.fill('PW Palette Search') - // Should show FlowPilot AI section and Flows section - await expect(page.getByText('FlowPilot AI')).toBeVisible({ timeout: 5000 }) - await expect(page.getByText('Flows')).toBeVisible() - await expect(page.getByText(tree.name)).toBeVisible() + // 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) } @@ -56,39 +53,38 @@ test.describe('command palette smoke tests', () => { await page.goto('/') await expect(page.getByTestId('app-shell')).toBeVisible() - await page.keyboard.press('Meta+k') + await page.keyboard.press('Control+k') const input = page.getByPlaceholder(/Search flows/) + await expect(input).toBeVisible() await input.fill('analytics') // Pages section should appear await expect(page.getByText('Pages')).toBeVisible({ timeout: 3000 }) - await expect(page.getByText('Analytics')).toBeVisible() - // Select the analytics page - await page.getByText('Analytics').click() + // 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 with prefilled query', async ({ page }) => { + test('FlowPilot option navigates to assistant chat', async ({ page }) => { await page.goto('/') await expect(page.getByTestId('app-shell')).toBeVisible() - await page.keyboard.press('Meta+k') + await page.keyboard.press('Control+k') const input = page.getByPlaceholder(/Search flows/) + await expect(input).toBeVisible() await input.fill('how do I fix a print spooler issue') - // FlowPilot should be prominent (question intent) - await expect(page.getByText('FlowPilot AI')).toBeVisible({ timeout: 3000 }) - const flowpilotOption = page.getByText('Ask FlowPilot') + // 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() - // Select FlowPilot await flowpilotOption.click() - // Should navigate to assistant chat page await expect(page).toHaveURL(/\/assistant/) }) }) diff --git a/frontend/e2e/flowpilot-chat.spec.ts b/frontend/e2e/flowpilot-chat.spec.ts index 57d2310e..6737fe63 100644 --- a/frontend/e2e/flowpilot-chat.spec.ts +++ b/frontend/e2e/flowpilot-chat.spec.ts @@ -1,34 +1,30 @@ import { expect, test } from '@playwright/test' test.describe('FlowPilot assistant chat smoke tests', () => { - test('can open the assistant chat page and see the chat interface', async ({ page }) => { + test('can open the assistant chat page and see the interface', async ({ page }) => { await page.goto('/assistant') - // Should load the assistant chat page - await expect(page.getByText(/FlowPilot|Assistant|Chat/i)).toBeVisible({ timeout: 10000 }) + // Should load the assistant chat page — UI shows "AI Assistant" heading + await expect(page.getByText('AI Assistant')).toBeVisible({ timeout: 10000 }) - // Should have an input area for sending messages - const messageInput = page.getByPlaceholder(/message|ask|type/i) - await expect(messageInput).toBeVisible() + // Should show the start conversation button when no chats exist + await expect(page.getByRole('button', { name: /Start a Conversation/i })).toBeVisible() }) test('can create a new chat session', async ({ page }) => { await page.goto('/assistant') - await expect(page.getByText(/FlowPilot|Assistant|Chat/i)).toBeVisible({ timeout: 10000 }) + await expect(page.getByText('AI Assistant')).toBeVisible({ timeout: 10000 }) - // Look for new chat button - const newChatButton = page.getByRole('button', { name: /New|Create/i }).first() - if (await newChatButton.isVisible()) { - await newChatButton.click() + // Click "New Chat" button in the sidebar + const newChatButton = page.getByRole('button', { name: /New Chat/i }) + await expect(newChatButton).toBeVisible() + await newChatButton.click() - // Should be able to type a message - const messageInput = page.getByPlaceholder(/message|ask|type/i) - await expect(messageInput).toBeVisible() - await messageInput.fill('How do I troubleshoot DNS issues?') - } + // After creating a chat, the message input area should appear + // The textarea may use various placeholders + const messageInput = page.locator('textarea').first() + await expect(messageInput).toBeVisible({ timeout: 5000 }) }) // Note: Full AI response tests require ANTHROPIC_API_KEY in the environment. - // The send-and-receive flow is validated by the command palette prefill test - // which navigates here with a prefilled message. })