Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mrc-5445 Make e2e tests run in parallel #42

Merged
merged 13 commits into from
Jun 11, 2024
40 changes: 40 additions & 0 deletions .github/actions/run-e2e-shard/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run E2E shard

inputs:
shard:
description: "What shard to run, out of 6"
required: true

runs:
using: "composite"
steps:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
run: npm ci
shell: bash

- name: Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').packages['node_modules/@playwright/test'].version)")" >> $GITHUB_ENV
shell: bash

- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}

- run: npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
shell: bash

- name: Run e2e tests
shell: bash
run: npm run test:e2e -- --shard=${{ inputs.shard }}/6
66 changes: 55 additions & 11 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,63 @@ on:
- main
- "mrc-*"
jobs:
e2e:
part-1:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4

- name: Run E2E shard
uses: ./.github/actions/run-e2e-shard
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install playwright
run: npx playwright install --with-deps
- name: Run e2e tests
run: npm run test:e2e
shard: 1
part-2:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run E2E shard
uses: ./.github/actions/run-e2e-shard
with:
shard: 2
part-3:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run E2E shard
uses: ./.github/actions/run-e2e-shard
with:
shard: 3
part-4:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run E2E shard
uses: ./.github/actions/run-e2e-shard
with:
shard: 4
part-5:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run E2E shard
uses: ./.github/actions/run-e2e-shard
with:
shard: 5
part-6:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run E2E shard
uses: ./.github/actions/run-e2e-shard
with:
shard: 6
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dengue-map",
"version": "0.6.0",
"version": "0.7.0",
"type": "module",
"engines": {
"node": "^20.0.0"
Expand Down
3 changes: 2 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { defineConfig, devices } from "@playwright/test";

export default defineConfig({
testDir: "./tests/e2e",
fullyParallel: true,
/* Maximum time one test can run for. */
timeout: process.env.CI ? 60 * 1000 : 30 * 1000,
timeout: process.env.CI ? 30 * 1000 : 15 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
Expand Down
Loading