Skip to content

changes to mentor image and connection to BE #441

changes to mentor image and connection to BE

changes to mentor image and connection to BE #441

Workflow file for this run

name: Unit and E2E Tests
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
run: npm install -g pnpm@9
- name: Install dependencies
run: pnpm install
- name: Run unit tests
run: pnpm test
- name: Execute Playwright tests in Docker
if: ${{ always() }}
env:
API_BASE_URL: https://wcc-backend-dev.fly.dev/api/cms/v1
API_KEY: ${{ secrets.API_KEY }}
run: |
# Saving .env.local so that docker compose can access it
# (If you're using a fork, you'll not have secrets.API_KEY and things may fail)
echo "API_BASE_URL=$API_BASE_URL" >> .env.local
echo "API_KEY=$API_KEY" >> .env.local
# Passing UID/GID variables to allow our container user to be the same as the host
echo "DOCKER_UID=$(id -u)" >> $GITHUB_ENV
echo "DOCKER_GID=$(id -g)" >> $GITHUB_ENV
# Output directories created here will be owned by GH-runner
# If we let docker compose create them as volumes instead, they'll be not writable
mkdir -p ./playwright-report
mkdir -p ./playwright-tests/screenshots
mkdir -p ./test-results
# Finally, run it
pnpm test:e2e:docker
- name: Cleanup and capture logs
if: always()
run: |
docker compose logs nextjs > ./playwright-report/nextjs.docker.log 2>&1
docker compose logs playwright > ./playwright-report/playwright.docker.log 2>&1
docker compose down
- name: Upload playwright artifacts
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30