diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 016b75af..da7e3585 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,6 +90,13 @@ jobs: permissions: contents: 'read' id-token: 'write' + strategy: + matrix: + # don't run @read and @write scenarios to prevent conflict between them + annotation: + - '@read' + - '@write' + fail-fast: false env: PHP_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/php:latest PWA_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/pwa:latest @@ -168,17 +175,10 @@ jobs: working-directory: pwa run: pnpm exec playwright install - - name: Run Playwright @read - working-directory: pwa - # don't run @read and @write scenarios to prevent conflict between them - run: pnpm exec playwright test --grep @read - - - name: Run Playwright @write + name: Run Playwright working-directory: pwa - # run all e2e tests even if @read ones fail - if: ${{ !cancelled() }} - # use 1 worker to prevent conflict between scenarios - run: pnpm exec playwright test --grep @write --workers=1 + # use 1 worker to prevent conflict between scenarios (longer but safer) + run: pnpm exec playwright test --workers=1 --grep ${{ matrix.annotation }} - name: Debug Services if: failure() diff --git a/pwa/playwright.config.ts b/pwa/playwright.config.ts index 421a9c0c..8081f0e2 100644 --- a/pwa/playwright.config.ts +++ b/pwa/playwright.config.ts @@ -10,6 +10,7 @@ import { defineConfig, devices } from "@playwright/test"; * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ + timeout: 5 * 60 * 1000, testDir: "./tests", /* Run tests in files in parallel */ fullyParallel: true, diff --git a/pwa/tests/BooksList.spec.ts b/pwa/tests/BooksList.spec.ts index 883f2f89..56f0b1a2 100644 --- a/pwa/tests/BooksList.spec.ts +++ b/pwa/tests/BooksList.spec.ts @@ -93,7 +93,7 @@ test.describe("Books list", () => { test("I can filter the list @read", async ({ bookPage, page }) => { // filter by author await bookPage.filter({ author: "Dan Simmons" }); - await expect(page).toHaveURL(/\/books\?author=Dan\+Simmons/); + await expect(page).toHaveURL(/\/books\?author=Dan(?:\+|%20)Simmons/); await expect(page.getByTestId("nb-books")).toHaveText("1 book(s) found"); await expect(page.getByTestId("book").or(page.getByTestId("loading"))).toHaveCount(1); await expect(page.getByTestId("pagination")).toHaveCount(0); @@ -112,7 +112,7 @@ test.describe("Books list", () => { await expect(page.getByTestId("book").or(page.getByTestId("loading"))).toHaveCount(30); await expect(await bookPage.getDefaultBook()).not.toBeVisible(); await bookPage.filter({ author: "Dan Simmons" }); - await expect(page).toHaveURL(/\/books\?author=Dan\+Simmons/); + await expect(page).toHaveURL(/\/books\?author=Dan(?:\+|%20)Simmons/); await expect(page.getByTestId("nb-books")).toHaveText("1 book(s) found"); await expect(page.getByTestId("book").or(page.getByTestId("loading"))).toHaveCount(1); await expect(page.getByTestId("pagination")).toHaveCount(0); @@ -127,7 +127,7 @@ test.describe("Books list", () => { // filter by title, author and condition await bookPage.filter({ author: "Dan Simmons", title: "Hyperion", condition: "Used" }); - await expect(page).toHaveURL(/\/books\?author=Dan\+Simmons&title=Hyperion&condition%5B%5D=https%3A%2F%2Fschema\.org%2FUsedCondition$/); + await expect(page).toHaveURL(/\/books\?author=Dan(?:\+|%20)Simmons&title=Hyperion&condition%5B%5D=https%3A%2F%2Fschema\.org%2FUsedCondition$/); await expect(page.getByTestId("nb-books")).toHaveText("1 book(s) found"); await expect(page.getByTestId("book").or(page.getByTestId("loading"))).toHaveCount(1); await expect(page.getByTestId("pagination")).toHaveCount(0); @@ -138,7 +138,7 @@ test.describe("Books list", () => { await expect(page.getByTestId("filter-author")).toHaveValue("Dan Simmons"); await expect(page.getByTestId("filter-title")).toHaveValue(""); expect(await page.getByTestId("filter-condition-used").isChecked()).toBeFalsy(); - await expect(page).toHaveURL(/\/books\?author=Dan\+Simmons$/); + await expect(page).toHaveURL(/\/books\?author=Dan(?:\+|%20)Simmons$/); await expect(page.getByTestId("nb-books")).toHaveText("1 book(s) found"); await expect(page.getByTestId("book").or(page.getByTestId("loading"))).toHaveCount(1); await expect(page.getByTestId("pagination")).toHaveCount(0);