Skip to content

Commit

Permalink
GH actions for testing
Browse files Browse the repository at this point in the history
- renamed: tests_and_qc_frontend.yml -> test_frontend_e2e_live.yml - and reorganized it
- add: test_frontend_unit_and_qc.yml
  • Loading branch information
joeflack4 committed Feb 14, 2024
1 parent e608a55 commit 82c3ce8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 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: Tests and QC - Frontend
name: Test - Frontend deployments - End to end
on:
workflow_dispatch:
schedule:
Expand All @@ -20,30 +20,33 @@ jobs:
with:
node-version: 18

# cache: 'yarn' # Enable yarn cache
# 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: 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-deployments
- uses: actions/upload-artifact@v3
Expand All @@ -53,7 +56,6 @@ jobs:
path: frontend/playwright-report/
retention-days: 30


#name: Playwright Tests
#on:
# push:
Expand Down Expand Up @@ -81,4 +83,4 @@ jobs:
# with:
# name: playwright-report
# path: playwright-report/
# retention-days: 30
# retention-days: 30
37 changes: 37 additions & 0 deletions .github/workflows/test_frontend_unit_and_qc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test - Frontend - Unit tests and QC
on:
workflow_dispatch:
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

# Run tests
- name: Run tests
run: echo todo - make tests

0 comments on commit 82c3ce8

Please sign in to comment.