Skip to content

Init

Init #19

Workflow file for this run

name: e2e tests
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
WASP_TELEMETRY_DISABLE: 1
WASP_VERSION: 0.15.2
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Docker setup
uses: docker/setup-buildx-action@v3
- name: Install Wasp
run: |
curl -sSL https://get.wasp-lang.dev/installer.sh | sh -s -- -v ${{ env.WASP_VERSION }}
- name: Cache global node modules
uses: actions/cache@v4
with:
path: ~/.npm
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}-${{ hashFiles('e2e-tests/package-lock.json') }}-wasp${{ env.WASP_VERSION }}-node${{ steps.setup-node.outputs.node-version }}
restore-keys: |
node-modules-${{ runner.os }}-
# In order for the app to run in the dev mode we need to set the required env vars even if
# they aren't actually used by the app. This step sets mock env vars in order to pass the
# validation steps so the app can run in the CI environment. For env vars that are actually
# used in tests and therefore need real values, we set them in the GitHub secrets settings and
# access them in a step below.
- name: Set required wasp app env vars to mock values
run: |
cp .env.server.example .env.server && cp .env.client.example .env.client
- name: "[e2e-tests] Install Node.js dependencies for Playwright tests"
if: steps.cache-e2e-tests.outputs.cache-hit != 'true'
run: |
cd e2e-tests
npm ci
- name: "[e2e-tests] Store Playwright's Version"
run: |
cd e2e-tests
PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//')
echo "Playwright's Version: $PLAYWRIGHT_VERSION"
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: "[e2e-tests] Cache Playwright Browsers for Playwright's Version"
id: cache-playwright-browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}-${{ runner.os }}
- name: "[e2e-tests] Set up Playwright"
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
run: |
cd e2e-tests
npx playwright install --with-deps
- name: "[e2e-tests] Run Playwright tests"
env:
# The e2e tests are testing parts of the app that need certain env vars, so we need to access them here.
# These secretes can be set in your GitHub repo settings, e.g. https://github.com/<account>/<repo>/settings/secrets/actions
# Server-side env vars
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# Client-side env vars
# REACT_APP_GOOGLE_ANALYTICS_ID: G-H3LSJCK95H
# Test specific env vars
SKIP_EMAIL_VERIFICATION_IN_DEV: true
run: |
cd e2e-tests
npm run e2e:playwright
# UNCOMMENT this if you want to upload the test results so you can download them from the GitHub Actions UI
# - name: "[e2e-tests] Upload Playwright test results"
# - uses: actions/upload-artifact@v4
# if: ${{ !cancelled() }}
# with:
# include-hidden-files: true
# name: playwright-report
# path: ./e2e-tests/test-results
# retention-days: 30