Implement property detail and enquiry entry flow

This commit is contained in:
2026-05-26 09:39:10 +00:00
parent d1314f2181
commit 3d334a6b96
11 changed files with 966 additions and 133 deletions

View File

@@ -0,0 +1,36 @@
import { expect, test } from '@playwright/test';
test.describe('property detail flow', () => {
test('opens a property detail page and carries the guest into booking and enquiry entry points', async ({ page }) => {
await page.goto('/');
await page.getByRole('link', { name: 'View property details' }).first().click();
await expect(page).toHaveURL(/\/properties\/coastal-view-cottage$/);
await expect(page.getByRole('heading', { name: 'Coastal View Cottage' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Everything a guest needs before starting the booking flow' })).toBeVisible();
await expect(page.getByRole('link', { name: 'Check availability' })).toHaveAttribute(
'href',
'/bookings/new?propertySlug=coastal-view-cottage',
);
await expect(page.getByRole('link', { name: 'Ask a question first' })).toHaveAttribute(
'href',
'/contact?property=Coastal%20View%20Cottage',
);
await page.getByRole('link', { name: 'Check availability' }).click();
await expect(page).toHaveURL(/\/bookings\/new\?propertySlug=coastal-view-cottage$/);
await expect(page.locator('select[name="propertySlug"]')).toHaveValue('coastal-view-cottage');
await page.goto('/properties/coastal-view-cottage');
await page.getByRole('link', { name: 'Ask a question first' }).click();
await expect(page).toHaveURL(/\/contact\?property=Coastal%20View%20Cottage$/);
await expect(page.locator('input[name="property"]')).toHaveValue('Coastal View Cottage');
});
test('returns a 404 for an unknown property slug', async ({ page }) => {
const response = await page.goto('/properties/not-a-real-property');
expect(response?.status()).toBe(404);
});
});