feat: enhance UI, fix backend routes, and add E2E quality gates
- UI: Polish PlanView toggles, buttons, and fix missing icons (running/activity). - Backend: Fix route shadowing in main.py, add startup route check, and improve API test coverage. - Tests: Add Playwright E2E smoke test, eslint-plugin-import, and integrate all into 'make check'.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { test, expect } from '@playwright/test'
|
||||
|
||||
test('smoke test - app loads and editor opens', async ({ page }) => {
|
||||
// Mock the backend API to ensure frontend can be tested in isolation
|
||||
await page.route('**/api/workouts', async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify([])
|
||||
})
|
||||
})
|
||||
|
||||
// 1. Visit Home
|
||||
await page.goto('/')
|
||||
|
||||
// 2. Verify Title
|
||||
await expect(page).toHaveTitle(/FitMop/)
|
||||
|
||||
// 3. Verify Main Content
|
||||
// Depending on default view, might need to click nav.
|
||||
// Assuming default is Dashboard or Plans.
|
||||
// Let's interact with the specific elements we know exist.
|
||||
const navButton = page.getByRole('button', { name: 'Workout Plans' })
|
||||
if (await navButton.isVisible()) {
|
||||
await navButton.click()
|
||||
}
|
||||
|
||||
await expect(page.getByRole('heading', { name: 'Workout Plans' })).toBeVisible()
|
||||
|
||||
// 4. Navigate to Editor
|
||||
await page.getByRole('button', { name: 'New Plan' }).click()
|
||||
|
||||
// 5. Verify Editor
|
||||
await expect(page.getByPlaceholder('Workout Name').first()).toBeVisible()
|
||||
await expect(page.getByText('Add Step')).toBeVisible()
|
||||
|
||||
// 6. Check for console errors (implicit in Playwright if configured, but let's be explicit if needed)
|
||||
})
|
||||
Reference in New Issue
Block a user