test: add Playwright e2e tests for new features and uncovered workflows (#109)
High priority (new PR #108 features): - Command palette: open/close, search flows, page navigation, FlowPilot handoff - Fallback branches: add in editor, execute in session runner - Session-to-flow: verify button appears on completed session detail Medium priority (existing features without coverage): - Procedural session: intake form, step-through, completion - Tree editor: troubleshooting and procedural editor load/edit/save - FlowPilot chat: page load, new chat creation - Admin panel: dashboard, user management, settings access Also adds API helpers: createProceduralTree(), createProceduralTreeWithFallbacks() Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit was merged in pull request #109.
This commit is contained in:
78
frontend/e2e/procedural-session.spec.ts
Normal file
78
frontend/e2e/procedural-session.spec.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
import {
|
||||
createAuthenticatedApiContext,
|
||||
createProceduralTree,
|
||||
disposeApiContext,
|
||||
uniqueName,
|
||||
} from './helpers/api'
|
||||
|
||||
test.describe('procedural session smoke tests', () => {
|
||||
test('can start and step through a procedural session with intake form', async ({ page }) => {
|
||||
const api = await createAuthenticatedApiContext()
|
||||
const tree = await createProceduralTree(api, {
|
||||
name: uniqueName('PW Procedural Session Flow'),
|
||||
})
|
||||
|
||||
try {
|
||||
await page.goto(`/flows/${tree.id}/navigate`)
|
||||
await expect(page.getByRole('heading', { name: tree.name })).toBeVisible({ timeout: 10000 })
|
||||
|
||||
// Fill intake form
|
||||
await page.getByLabel('Server IP Address').fill('10.1.50.22')
|
||||
await page.getByLabel('Service Name').fill('nginx')
|
||||
|
||||
// Start the session
|
||||
await page.getByRole('button', { name: /Start/ }).click()
|
||||
|
||||
// Should see the first step
|
||||
await expect(page.getByText('Verify the server is reachable')).toBeVisible({ timeout: 5000 })
|
||||
|
||||
// Mark first step complete and advance
|
||||
const completeButton = page.getByRole('button', { name: /Complete|Next|Mark/ }).first()
|
||||
await completeButton.click()
|
||||
|
||||
// Should advance to second step
|
||||
await expect(page.getByText('Check the service status')).toBeVisible({ timeout: 5000 })
|
||||
} finally {
|
||||
await disposeApiContext(api)
|
||||
}
|
||||
})
|
||||
|
||||
test('can complete a full procedural session end to end', async ({ page }) => {
|
||||
const api = await createAuthenticatedApiContext()
|
||||
const tree = await createProceduralTree(api, {
|
||||
name: uniqueName('PW Full Procedural Flow'),
|
||||
steps: [
|
||||
{
|
||||
id: 'step-1',
|
||||
type: 'procedure_step',
|
||||
title: 'Single step procedure',
|
||||
description: 'Just one step to complete.',
|
||||
content_type: 'action',
|
||||
},
|
||||
{ id: 'step-end', type: 'procedure_end', title: 'End' },
|
||||
],
|
||||
intake_form: [],
|
||||
})
|
||||
|
||||
try {
|
||||
await page.goto(`/flows/${tree.id}/navigate`)
|
||||
await expect(page.getByRole('heading', { name: tree.name })).toBeVisible({ timeout: 10000 })
|
||||
|
||||
// Start session (no intake form)
|
||||
await page.getByRole('button', { name: /Start/ }).click()
|
||||
|
||||
// Should see the single step
|
||||
await expect(page.getByText('Single step procedure')).toBeVisible({ timeout: 5000 })
|
||||
|
||||
// Complete the step
|
||||
const completeButton = page.getByRole('button', { name: /Complete|Next|Mark/ }).first()
|
||||
await completeButton.click()
|
||||
|
||||
// Should reach completion — look for completion indicators
|
||||
await expect(page.getByText(/Complete|Finished|Summary/i)).toBeVisible({ timeout: 5000 })
|
||||
} finally {
|
||||
await disposeApiContext(api)
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user