Test, Frontend Prod, Playwright E2E #98
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
# Test Frontend deployment using Playwright End-to-End tests. | |
# todo: 1. run local: (i) start backend (a) local backend in GH action, or (b) use dev's backend URL (won't always work), (ii) set to on:pr&push | |
# todo: 2. after '1': expose params to workflow_dispatch: so can choose which env we want to test, in case we don't want to run all 3 at once | |
name: Test, Frontend Prod, Playwright E2E | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '30 5 * * *' # every day 5:30am GMT (12:30/1:30am EST/EDT) | |
# push: | |
# branches: [ main, develop ] | |
# pull_request: | |
# branches: [ main, develop ] | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# 2024/12: Due to maintenance mode, we now only have 1 server. And the branch for deployment is basically = to both main and develop now. So we can just let this run on the default branch. | |
# with: | |
# ref: prod | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22.x' | |
cache: 'yarn' | |
cache-dependency-path: 'frontend/yarn.lock' | |
# Yarn Setup | |
# cache: 'yarn' # Enable yarn cache | |
# manual caching steps | |
- name: get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('frontend/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
# run: cd frontend && npm ci # only playwright is necessary to install | |
run: yarn install --frozen-lockfile # Equivalent to npm ci | |
working-directory: frontend | |
# Playwright setup | |
- name: Install Playwright browsers | |
run: yarn playwright install --with-deps # Use yarn to run playwright install | |
working-directory: frontend | |
- name: Re-configure for non-local web server | |
run: | | |
sed -n '/webServer: \[/,/\]/!p' playwright.config.js > tmp && mv tmp playwright.config.js | |
working-directory: frontend | |
# Run tests | |
- name: Run Playwright tests | |
run: make test-frontend-e2e-prod | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: frontend/tests/playwright/playwright-report/ | |
retention-days: 30 | |
#name: Playwright Tests | |
#on: | |
# push: | |
# branches: [ main, master ] | |
# pull_request: | |
# branches: [ main, master ] | |
#jobs: | |
# test: | |
# timeout-minutes: 60 | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - uses: actions/setup-node@v3 | |
# with: | |
# node-version: 18 | |
# cache: 'yarn' # Enable yarn cache | |
# - name: Install dependencies | |
# run: yarn install --frozen-lockfile # Equivalent to npm ci | |
# - name: Install Playwright Browsers | |
# run: yarn playwright install --with-deps # Use yarn to run playwright install | |
# - name: Run Playwright tests | |
# run: yarn playwright test # Use yarn to run playwright test | |
# - uses: actions/upload-artifact@v4 | |
# if: always() | |
# with: | |
# name: playwright-report | |
# path: playwright-report/ | |
# retention-days: 30 |