Files
resolutionflow/frontend/e2e/procedural-session.spec.ts
chihlasm 8eea2348b0 fix: resolve all Playwright test failures — 16/16 passing
- Fix procedural session tests: sessions auto-start, no Start button
- Fix strict mode violations: use getByRole('heading') for step titles
- Fix FlowPilot chat: use button role selector for New Chat
- Fix command palette page nav: scope Analytics click to palette modal
- Fix fallback runner: remove non-existent Start button click
- Update playwright.config to port 5433 for local Docker

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 13:34:44 -04:00

74 lines
2.5 KiB
TypeScript

import { expect, test } from '@playwright/test'
import {
createAuthenticatedApiContext,
createProceduralTree,
disposeApiContext,
uniqueName,
} from './helpers/api'
test.describe('procedural session smoke tests', () => {
test('auto-starts a procedural session and shows first step', async ({ page }) => {
const api = await createAuthenticatedApiContext()
const tree = await createProceduralTree(api, {
name: uniqueName('PW Procedural Session Flow'),
})
try {
// Procedural sessions auto-start on page load — no intake form screen or Start button
await page.goto(`/flows/${tree.id}/navigate`)
// Should see the first step immediately (session auto-creates)
await expect(page.getByRole('heading', { name: 'Verify the server is reachable' })).toBeVisible({ timeout: 15000 })
// Should see the Mark Complete & Next button
await expect(page.getByRole('button', { name: 'Mark Complete & Next' })).toBeVisible()
// Should show step checklist in sidebar
await expect(page.getByText('Check the service status')).toBeVisible()
await expect(page.getByText('Restart the service if needed')).toBeVisible()
} finally {
await disposeApiContext(api)
}
})
test('can advance through steps with Mark Complete & Next', async ({ page }) => {
const api = await createAuthenticatedApiContext()
const tree = await createProceduralTree(api, {
name: uniqueName('PW Step Advance Flow'),
steps: [
{
id: 'step-1',
type: 'procedure_step',
title: 'First step to complete',
description: 'Do the first thing.',
content_type: 'action',
},
{
id: 'step-2',
type: 'procedure_step',
title: 'Second step to verify',
description: 'Now verify it worked.',
content_type: 'verification',
},
{ id: 'step-end', type: 'procedure_end', title: 'End' },
],
intake_form: [],
})
try {
await page.goto(`/flows/${tree.id}/navigate`)
// First step should be visible (auto-started)
await expect(page.getByRole('heading', { name: 'First step to complete' })).toBeVisible({ timeout: 15000 })
// Complete the first step
await page.getByRole('button', { name: 'Mark Complete & Next' }).click()
// Should advance to second step
await expect(page.getByRole('heading', { name: 'Second step to verify' })).toBeVisible({ timeout: 5000 })
} finally {
await disposeApiContext(api)
}
})
})