Skip to content

Update e2e-tests.yml #6

Update e2e-tests.yml

Update e2e-tests.yml #6

Workflow file for this run

name: E2E test
on:
push:
branches:
- dev
pull_request:
branches:
- dev
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
docker:
image: docker:20.10.7
options: --privileged
# ports:
# - 5432:5432 # Example port for a service
# - 8080:8080
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.17.0'
- name: Install dependencies
working-directory: './client'
run: npm install
- name: Install browser dependencies
working-directory: './client'
run: |
sudo apt-get update
sudo apt-get install -y \
libnss3 \
libnspr4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libdbus-1-3 \
libxkbcommon0 \
libgbm1 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
libasound2 \
libpango1.0-0 \
libcairo2 \
libatspi2.0-0 \
libwayland-client0 \
libwayland-cursor0 \
libwayland-egl1 \
libpci3
- name: Install Playwright browsers
working-directory: './client'
run: npx playwright install --with-deps
- name: Start Next.js app
working-directory: './client'
run: npm run dev &
env:
NODE_ENV: test
- name: Wait for start up
run: |
sleep 60
- name: Set up Docker Compose
run: |
docker-compose -f ./e2e-docker-compose.yaml up -d
- name: Wait for service initialisation
run: |
sleep 120
- name: Run Playwright tests
working-directory: './client'
run: npx playwright test try.spec.tsx
- name: Upload test report
uses: actions/upload-artifact@v2
with:
name: test-report
path: ./client/playwright-report/
- name: Clean up
run: |
docker-compose -f ./e2e-docker-compose.yaml down
pkill -f 'npm run dev'