fix: update Playwright test selectors to match actual UI

- Use Control+k instead of Meta+k (Linux/CI compatibility)
- Use 'AI Assistant' group label instead of 'FlowPilot AI'
- Match actual FlowPilot chat page elements (Start a Conversation, New Chat, textarea)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-16 09:54:42 -04:00
parent 1e6ab34a8a
commit e9c24cbbf7
2 changed files with 38 additions and 46 deletions

View File

@@ -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.
})