Skip to content

Commit

Permalink
fix: e2e ci
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentchalamon committed Mar 7, 2024
1 parent 491fe4e commit 602d3cd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions pwa/playwright.config.ts
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions pwa/tests/BooksList.spec.ts
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 602d3cd

Please sign in to comment.