diff --git a/e2e/smoke.spec.ts b/e2e/smoke.spec.ts index 6b2ba23..cd60a87 100644 --- a/e2e/smoke.spec.ts +++ b/e2e/smoke.spec.ts @@ -248,6 +248,22 @@ test('icons stay within their controls on desktop and mobile', async ({ } }); +test('clicking anywhere on a recipe card, including its image, opens the recipe', async ({ + page, +}) => { + // The title link's ::after overlay (RecipeCard.css) covers the whole card. + // jsdom cannot hit-test CSS, so this is checked in a real browser. + await page.goto('.'); + const image = page.locator('.recipe-card__image').first(); + await expect(image).toBeVisible(); + const box = (await image.boundingBox())!; + await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2); + await expect(page).toHaveURL(/recipes\/11111111-1111-4111-8111-111111111111/); + await expect( + page.getByRole('heading', { name: 'Creamy salmon pasta' }), + ).toBeVisible(); +}); + test('renders each core route through the shared shell', async ({ page }) => { for (const [path, title] of coreRoutes) { await page.goto(path === '/' ? '.' : path.slice(1));