feat: add playwright e2e workflow
This commit is contained in:
23
tests/e2e/README.md
Normal file
23
tests/e2e/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Playwright Coverage
|
||||
|
||||
This suite is the browser-level guardrail for the holiday booking app.
|
||||
|
||||
## Current Coverage
|
||||
|
||||
- Homepage shell and content structure
|
||||
- Health endpoint
|
||||
|
||||
## Planned Coverage
|
||||
|
||||
- Property listing and detail flows
|
||||
- Availability search and date handling
|
||||
- Booking form validation and summary
|
||||
- Stripe checkout handoff and return states
|
||||
- Confirmation and failure states
|
||||
- Admin management flows
|
||||
- SEO, accessibility, and responsive behavior
|
||||
|
||||
## Rule
|
||||
|
||||
Update this suite as each user-facing flow lands. The workflow is separate from deploy and only runs against `develop` and `qa`.
|
||||
|
||||
14
tests/e2e/health.spec.ts
Normal file
14
tests/e2e/health.spec.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test.describe('health endpoint', () => {
|
||||
test('returns a ready JSON payload', async ({ request }) => {
|
||||
const response = await request.get('/api/health');
|
||||
|
||||
expect(response.ok()).toBeTruthy();
|
||||
const payload = await response.json();
|
||||
expect(payload).toMatchObject({
|
||||
status: 'ok',
|
||||
service: 'holiday-property-booking',
|
||||
});
|
||||
});
|
||||
});
|
||||
23
tests/e2e/home.spec.ts
Normal file
23
tests/e2e/home.spec.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test.describe('homepage', () => {
|
||||
test('renders the phase 1 scaffold and primary navigation', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
await expect(page.getByRole('heading', { name: 'Holiday Property Booking' })).toBeVisible();
|
||||
await expect(page.getByText('Phase 1 foundation')).toBeVisible();
|
||||
await expect(page.getByRole('navigation', { name: 'Primary' })).toBeVisible();
|
||||
await expect(page.getByRole('link', { name: 'Review foundation' })).toHaveAttribute('href', '#foundation');
|
||||
await expect(page.getByRole('link', { name: 'Check health' })).toHaveAttribute('href', '/api/health');
|
||||
});
|
||||
|
||||
test('shows the core planning sections', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
await expect(page.getByRole('heading', { name: 'Foundation work starts here' })).toBeVisible();
|
||||
await expect(page.getByRole('heading', { name: 'The implementation stack is locked' })).toBeVisible();
|
||||
await expect(page.getByRole('heading', { name: 'The first schema pass is ready' })).toBeVisible();
|
||||
await expect(page.getByRole('heading', { name: 'Ready for the first implementation slice' })).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
13
tests/e2e/responsive.spec.ts
Normal file
13
tests/e2e/responsive.spec.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test.describe('responsive shell', () => {
|
||||
test('keeps the core content visible on mobile widths', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.goto('/');
|
||||
|
||||
await expect(page.getByRole('heading', { name: 'Holiday Property Booking' })).toBeVisible();
|
||||
await expect(page.getByRole('heading', { name: 'Foundation work starts here' })).toBeVisible();
|
||||
await expect(page.getByRole('link', { name: 'Review foundation' })).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user