Test - Frontend deployments - End to end #36
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
# 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 deployments - End to end | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 8 * * *' # every day 8am GMT (3-4am EST/EDT) | |
# push: | |
# branches: [ main, develop ] | |
# pull_request: | |
# branches: [ main, develop ] | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
# 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-deployments | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: frontend/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@v3 | |
# if: always() | |
# with: | |
# name: playwright-report | |
# path: playwright-report/ | |
# retention-days: 30 |