From 4f09d33c74cc256f83e7561f54520fb4b8d32b95 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Feb 2026 22:01:03 +0000 Subject: [PATCH 1/2] Initial plan From 90b6dd27eb01b56085c3453279a574242da15354 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Feb 2026 22:04:20 +0000 Subject: [PATCH 2/2] fix(e2e): add missing multi-select fixtures and correct README API note Co-authored-by: makuchpatryk <19875907+makuchpatryk@users.noreply.github.com> --- tests/e2e/README.md | 2 +- tests/e2e/fixtures.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/e2e/README.md b/tests/e2e/README.md index 22d7874..1f12405 100644 --- a/tests/e2e/README.md +++ b/tests/e2e/README.md @@ -371,7 +371,7 @@ Tests automatically: ## 📝 Notes - Tests require dev server running on `http://localhost:3000` -- Tests use real Pexels API (ensure API key is valid) +- Tests use a mocked Pexels API via Playwright route interception (no real API key required) - Tests are idempotent and can run multiple times - Screenshots and traces are stored in `test-results/` directory diff --git a/tests/e2e/fixtures.ts b/tests/e2e/fixtures.ts index de30e80..c8426b7 100644 --- a/tests/e2e/fixtures.ts +++ b/tests/e2e/fixtures.ts @@ -63,6 +63,9 @@ export async function mockApiRoutes(page: Page) { type Fixtures = { homePage: Page; gamePage: Page; + navigateToHome: () => Promise; + selectDifficulty9x13: () => Promise; + startGame: () => Promise; }; export const test = base.extend({ @@ -87,6 +90,33 @@ export const test = base.extend({ await page.waitForSelector("[draggable='true']", { timeout: 15_000 }); await use(page); }, + + navigateToHome: async ({ page }, use) => { + await use(async () => { + await mockApiRoutes(page); + const getImagesResponse = page.waitForResponse("**/api/get-images**", { + timeout: 30_000, + }); + await page.goto("/"); + await getImagesResponse; + await page.waitForSelector("img.w-full", { timeout: 15_000 }); + }); + }, + + selectDifficulty9x13: async ({ page }, use) => { + await use(async () => { + // 9x13 is the default; explicitly click the label to ensure it is selected + await page.locator("label[for='9x13']").click(); + }); + }, + + startGame: async ({ page }, use) => { + await use(async () => { + await page.getByRole("button", { name: /Play/i }).click(); + // Wait for puzzle pieces to be rendered on the game page + await page.waitForSelector("[draggable='true']", { timeout: 15_000 }); + }); + }, }); export { expect } from "@playwright/test";