it-tools/.github/workflows/e2e-tests.yml
2025-09-04 09:38:46 +02:00

57 lines
1.7 KiB
YAML

name: E2E tests
on:
pull_request:
push:
branches:
- main
jobs:
test:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1/3, 2/3, 3/3]
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
- name: Get Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(jq -r '.devDependencies["@playwright/test"]' package.json)" >> "$GITHUB_OUTPUT"
- name: Start Playwright container
run: |
CONTAINER_ID=$(docker create \
--network host \
-it \
--rm \
--init \
--workdir /home/pwuser \
--user pwuser \
mcr.microsoft.com/playwright:v$PLAYWRIGHT_VERSION-noble \
npx -y playwright@$PLAYWRIGHT_VERSION run-server --port 3000 --host 0.0.0.0 \
)
docker start $CONTAINER_ID
echo "CONTAINER_ID=$CONTAINER_ID" >> "$GITHUB_ENV"
env:
PLAYWRIGHT_VERSION: ${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }}
- name: Install dependencies
run: pnpm install
- name: Build app
run: pnpm build
- name: Run Playwright tests
run: pnpm run test:e2e --shard=${{ matrix.shard }}
env:
PW_TEST_CONNECT_WS_ENDPOINT: "ws://127.0.0.1:3000/"
- name: Stop Playwright container
run: |
docker stop $CONTAINER_ID