TopFlow uses Playwright for end-to-end testing to verify complete user workflows in real browser environments.
Smoke Tests: ✅ 5/5 passing Detailed Tests: 📋 44 tests created, need UI selector tuning
# Run all E2E tests
pnpm test:e2e
# Run only smoke tests
pnpm test:e2e e2e/smoke.spec.ts
# Run with UI mode (interactive)
pnpm test:e2e:ui
# Run in headed mode (see the browser)
pnpm test:e2e:headed
# Run specific browser
pnpm test:e2e:chromium # Chromium onlyBasic sanity checks that verify the application loads and functions:
- Homepage loads successfully
- Main content renders
- No console errors
- No network failures
- Responsive design works
Status: All passing
These tests are fully written but need selectors adjusted to match the actual UI:
-
workflow-creation.spec.ts (11 tests)
- Node palette display
- Canvas initialization
- Toolbar buttons
- Undo/redo functionality
- Keyboard shortcuts
-
template-gallery.spec.ts (10 tests)
- Template gallery dialog
- Template cards display
- Category filtering
- Template loading
- Security templates
-
demo-mode.spec.ts (8 tests)
- Demo mode execution
- Execution status updates
- Completion handling
- Timing simulation
-
api-settings.spec.ts (8 tests)
- API settings dialog
- Provider options
- API key inputs
- BYOK model explanation
- Security notices
-
validation.spec.ts (7 tests)
- Validation errors
- Validation scoring
- Issue categorization
- Panel interactions
# Install Playwright
pnpm add -D @playwright/test playwright
# Install browsers
pnpm exec playwright install chromium
pnpm exec playwright install firefox
pnpm exec playwright install webkitPlaywright configuration is in playwright.config.ts:
- Test Directory:
./e2e - Base URL:
http://localhost:3000 - Browsers: Chromium, Firefox, WebKit
- Auto-start dev server: Yes
- Screenshots: On failure
- Trace: On first retry
import { test, expect } from '@playwright/test'
test.describe('Feature Name', () => {
test('should do something', async ({ page }) => {
await page.goto('/')
// Interact with elements
await page.getByRole('button', { name: /Click Me/i }).click()
// Assert expectations
await expect(page.getByText('Success')).toBeVisible()
})
})- Use semantic selectors: Prefer
getByRole,getByLabel,getByTextover CSS selectors - Wait for states: Use
waitForLoadState('networkidle')for dynamic content - Set timeouts: Use
{ timeout: 5000 }for elements that may take time - Isolate tests: Each test should be independent
- Clean up: Close dialogs, reset state between tests
Opening a dialog:
await page.getByRole('button', { name: /Templates/i }).click()
await expect(page.getByRole('dialog')).toBeVisible()Loading a template:
await page.getByRole('button', { name: /Templates/i }).click()
await page.getByRole('button', { name: /Use Template/i }).first().click()
await page.waitForTimeout(1000) // Allow template to loadExecuting a workflow:
await page.getByRole('button', { name: /Execute/i }).click()
await expect(page.getByText(/Execution/i)).toBeVisible({ timeout: 5000 })# Screenshots are saved to test-results/ folder
ls test-results/pnpm test:e2e:uipnpm test:e2e:headedpnpm exec playwright show-reportE2E tests run automatically in CI:
# .github/workflows/e2e.yml
- name: Install Playwright
run: pnpm exec playwright install --with-deps chromium
- name: Run E2E tests
run: pnpm test:e2e- Complete UI selector tuning for detailed test suites
- Add accessibility tests using Playwright's accessibility API
- Add visual regression tests using Playwright's screenshot comparison
- Add mobile device tests using device emulation
- Add authentication tests when auth is implemented
- Add workflow save/load tests
- Add code export tests