39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
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: 'My 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)
|
|
})
|