diff --git a/.github/workflows/drive-frontend.yml b/.github/workflows/drive-frontend.yml index e32e7ce3..480a64ae 100644 --- a/.github/workflows/drive-frontend.yml +++ b/.github/workflows/drive-frontend.yml @@ -66,11 +66,16 @@ jobs: runs-on: ubuntu-latest needs: [install-front, build-mails] strategy: + fail-fast: false matrix: browser: - chromium - webkit - firefox + shard: + - "1/3" + - "2/3" + - "3/3" steps: - name: Checkout repository uses: actions/checkout@v6 @@ -93,6 +98,13 @@ jobs: path: "src/backend/core/templates/mail" key: mail-templates-${{ hashFiles('src/mail/mjml') }} + - name: Cache Playwright browsers + id: playwright-cache + uses: actions/cache@v4 + with: + path: ~/.cache/ms-playwright + key: playwright-${{ matrix.browser }}-${{ hashFiles('src/frontend/**/yarn.lock') }} + - name: Install Playwright Browsers run: | cd src/frontend/apps/e2e @@ -113,11 +125,11 @@ jobs: - name: Run e2e tests run: | cd src/frontend/apps/e2e - yarn test --project=${{ matrix.browser }} + yarn test --project=${{ matrix.browser }} --shard=${{ matrix.shard }} - uses: actions/upload-artifact@v4 if: always() with: - name: report-${{ matrix.browser }} + name: report-${{ matrix.browser }}-shard-${{ strategy.job-index }} path: src/frontend/apps/e2e/report/ retention-days: 7 diff --git a/CHANGELOG.md b/CHANGELOG.md index 180a5e9c..9ad2e2e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to - 🔒️(frontend) prevent search engine indexing - ✨(backend) allow ordering items by creator full name - ✨(frontend) add item duplication with polling and visual feedback +- ⚡(ci) shard e2e tests and cache playwright browsers ### Changed diff --git a/src/frontend/apps/e2e/__tests__/app-drive/redirect-401.spec.ts b/src/frontend/apps/e2e/__tests__/app-drive/redirect-401.spec.ts index a2f104ac..6ddcb349 100644 --- a/src/frontend/apps/e2e/__tests__/app-drive/redirect-401.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-drive/redirect-401.spec.ts @@ -31,5 +31,5 @@ test("Redirects to /401 when session cookies are cleared then re-login and get r await keyCloakSignIn(page, "drive", "drive", false); - await expect(page).toHaveURL(folderUrl); + await expect(page).toHaveURL(folderUrl, { timeout: 10000 }); }); diff --git a/src/frontend/apps/e2e/__tests__/app-drive/search.spec.ts b/src/frontend/apps/e2e/__tests__/app-drive/search.spec.ts index 1784e0ef..b2f55d3a 100644 --- a/src/frontend/apps/e2e/__tests__/app-drive/search.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-drive/search.spec.ts @@ -19,13 +19,13 @@ test("Search somes items and shows them in the search modal", async ({ // Expect no results before typing. let searchItems = page.getByTestId("search-item"); - expect(searchItems).toHaveCount(0); + await expect(searchItems).toHaveCount(0); await input.fill("me"); // Expect 3 results after typing "me". searchItems = page.getByTestId("search-item"); - expect(searchItems).toHaveCount(3); + await expect(searchItems).toHaveCount(3); let searchItem = page.getByRole("option", { name: "Meetings Dev Team" }); await expect(searchItem).toContainText("Dev Team"); @@ -43,7 +43,7 @@ test("Search somes items and shows them in the search modal", async ({ await page.getByRole("combobox", { name: "Quick search input" }).fill("sale"); searchItems = page.getByTestId("search-item"); - expect(searchItems).toHaveCount(1); + await expect(searchItems).toHaveCount(1); searchItem = page.getByRole("option", { name: "Sales report", @@ -97,7 +97,7 @@ test("Search folder from trash and cannot navigate to it", async ({ page }) => { await page.getByRole("button", { name: "Search" }).click(); let searchItems = page.getByTestId("search-item"); - expect(searchItems).toHaveCount(0); + await expect(searchItems).toHaveCount(0); const input = page.getByRole("combobox", { name: "Quick search input" }); await expect(input).toBeVisible(); @@ -108,7 +108,7 @@ test("Search folder from trash and cannot navigate to it", async ({ page }) => { await page.getByRole("option", { name: "Recycle bin" }).click(); searchItems = page.getByTestId("search-item"); - expect(searchItems).toHaveCount(1); + await expect(searchItems).toHaveCount(1); const button = page.getByRole("option", { name: "I am deleted" }); await button.click(); @@ -145,7 +145,7 @@ test("Search a deleted file and click on it", async ({ page }) => { await page.getByRole("option", { name: "Recycle bin" }).click(); let searchItems = page.getByTestId("search-item"); - expect(searchItems).toHaveCount(1); + await expect(searchItems).toHaveCount(1); const button = page.getByRole("option", { name: "Resume" }); await button.click();