Add e2e tests #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Runs builds on GitHub pull requests to test that they should be working fine. | |
## | |
name: Test builds | |
on: | |
pull_request: | |
jobs: | |
test-client: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: client | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
test-server: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: server | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
test-e2e: | |
name: Test E2E | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: e2e | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
cache-dependency-path: ./e2e/package-lock.json | |
- run: npm i | |
- name: get user id | |
run: echo $UID | |
- name: get files | |
run: ls -la | |
- name: Get installed Playwright version | |
id: playwright-version | |
run: echo "version=$(npm ls @playwright/test --json | jq --raw-output '.dependencies["@playwright/test"].version')" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
id: playwright-cache | |
with: | |
path: ~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }} | |
restore-keys: | | |
${{ runner.os }}-playwright- | |
# Install Playwright dependencies unless found from the cache | |
- name: Install Playwright's dependencies | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
run: npx playwright install --with-deps | |
# Start up the stack & wait for all services to be healthy | |
- run: CI=1 docker compose up -d --wait | |
timeout-minutes: 10 | |
# Output container logs if any of the previous steps failed | |
- run: docker compose logs | |
if: failure() | |
# Execute the E2E tests | |
- run: npm test |