Skip to content

Commit f760b29

Browse files
fix: e2e ci
1 parent d0abf8b commit f760b29

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ jobs:
9090
permissions:
9191
contents: 'read'
9292
id-token: 'write'
93+
strategy:
94+
matrix:
95+
# don't run @read and @write scenarios to prevent conflict between them
96+
annotation:
97+
- '@read'
98+
- '@write'
99+
fail-fast: false
93100
env:
94101
PHP_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/php:latest
95102
PWA_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/pwa:latest
@@ -170,17 +177,10 @@ jobs:
170177
working-directory: pwa
171178
run: pnpm exec playwright install
172179
-
173-
name: Run Playwright @read
174-
working-directory: pwa
175-
# don't run @read and @write scenarios to prevent conflict between them
176-
run: pnpm exec playwright test --grep @read
177-
-
178-
name: Run Playwright @write
180+
name: Run Playwright
179181
working-directory: pwa
180-
# run all e2e tests even if @read ones fail
181-
if: ${{ !cancelled() }}
182-
# use 1 worker to prevent conflict between scenarios
183-
run: pnpm exec playwright test --grep @write --workers=1
182+
# use 1 worker to prevent conflict between scenarios (longer but safer)
183+
run: pnpm exec playwright test --workers=1 --grep ${{ matrix.annotation }}
184184
-
185185
name: Debug Services
186186
if: failure()

pwa/playwright.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { defineConfig, devices } from "@playwright/test";
1010
* See https://playwright.dev/docs/test-configuration.
1111
*/
1212
export default defineConfig({
13+
timeout: 5 * 60 * 1000,
1314
testDir: "./tests",
1415
/* Run tests in files in parallel */
1516
fullyParallel: true,

pwa/tests/BooksList.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ test.describe("Books list", () => {
9393
test("I can filter the list @read", async ({ bookPage, page }) => {
9494
// filter by author
9595
await bookPage.filter({ author: "Dan Simmons" });
96-
await expect(page).toHaveURL(/\/books\?author=Dan\+Simmons/);
96+
await expect(page).toHaveURL(/\/books\?author=Dan(?:\+|%20)Simmons/);
9797
await expect(page.getByTestId("nb-books")).toHaveText("1 book(s) found");
9898
await expect(page.getByTestId("book").or(page.getByTestId("loading"))).toHaveCount(1);
9999
await expect(page.getByTestId("pagination")).toHaveCount(0);
@@ -112,7 +112,7 @@ test.describe("Books list", () => {
112112
await expect(page.getByTestId("book").or(page.getByTestId("loading"))).toHaveCount(30);
113113
await expect(await bookPage.getDefaultBook()).not.toBeVisible();
114114
await bookPage.filter({ author: "Dan Simmons" });
115-
await expect(page).toHaveURL(/\/books\?author=Dan\+Simmons/);
115+
await expect(page).toHaveURL(/\/books\?author=Dan(?:\+|%20)Simmons/);
116116
await expect(page.getByTestId("nb-books")).toHaveText("1 book(s) found");
117117
await expect(page.getByTestId("book").or(page.getByTestId("loading"))).toHaveCount(1);
118118
await expect(page.getByTestId("pagination")).toHaveCount(0);
@@ -127,7 +127,7 @@ test.describe("Books list", () => {
127127

128128
// filter by title, author and condition
129129
await bookPage.filter({ author: "Dan Simmons", title: "Hyperion", condition: "Used" });
130-
await expect(page).toHaveURL(/\/books\?author=Dan\+Simmons&title=Hyperion&condition%5B%5D=https%3A%2F%2Fschema\.org%2FUsedCondition$/);
130+
await expect(page).toHaveURL(/\/books\?author=Dan(?:\+|%20)Simmons&title=Hyperion&condition%5B%5D=https%3A%2F%2Fschema\.org%2FUsedCondition$/);
131131
await expect(page.getByTestId("nb-books")).toHaveText("1 book(s) found");
132132
await expect(page.getByTestId("book").or(page.getByTestId("loading"))).toHaveCount(1);
133133
await expect(page.getByTestId("pagination")).toHaveCount(0);
@@ -138,7 +138,7 @@ test.describe("Books list", () => {
138138
await expect(page.getByTestId("filter-author")).toHaveValue("Dan Simmons");
139139
await expect(page.getByTestId("filter-title")).toHaveValue("");
140140
expect(await page.getByTestId("filter-condition-used").isChecked()).toBeFalsy();
141-
await expect(page).toHaveURL(/\/books\?author=Dan\+Simmons$/);
141+
await expect(page).toHaveURL(/\/books\?author=Dan(?:\+|%20)Simmons$/);
142142
await expect(page.getByTestId("nb-books")).toHaveText("1 book(s) found");
143143
await expect(page.getByTestId("book").or(page.getByTestId("loading"))).toHaveCount(1);
144144
await expect(page.getByTestId("pagination")).toHaveCount(0);

0 commit comments

Comments
 (0)