Skip to content

Commit

Permalink
frontend SERVER tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benhammondmusic committed May 15, 2024
1 parent 9000776 commit fe5f8f3
Showing 1 changed file with 7 additions and 75 deletions.
82 changes: 7 additions & 75 deletions .github/workflows/runFrontendServerTests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: RUN Frontend Tests
name: RUN Frontend Server Tests

env:
## Sets environment variables
Expand All @@ -13,91 +13,23 @@ on:
pull_request:
branches: [main]
paths:
- 'frontend/**' # Run when changes occur in the frontend subfolder
- 'frontend_server/**' # Run when changes occur in the frontend subfolder
defaults:
run:
working-directory: frontend
working-directory: frontend_server

jobs:
build_frontend:
name: Builds frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: frontend/package.json
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build React frontend
env:
NODE_OPTIONS: '--max_old_space_size=4096'
run: npm run build:deploy_preview

frontend_unit_tests:
name: Runs frontend unit tests
name: Runs frontend server unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: frontend/package.json
node-version-file: frontend_server/package.json
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
cache-dependency-path: frontend_server/package-lock.json
- name: Install dependencies
run: npm ci
- name: Run Vitest unit tests
run: npm test

# If it's a PR creation or update, we'll run the e2e test here on Netlify
# if it's a merge to main, the E2E will run in e2eStaging.yml

tests_e2e_netlify_prepare:
name: Wait for Netlify deploy
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
# - name: Waiting for Netlify Preview
# uses: josephduffy/wait-for-netlify-action@v1
# id: wait-for-netlify-preview
# with:
# site_name: ${{env.NETLIFY_SITE_NAME}}
# max_timeout: 90
- name: Waiting for "Success" from Netlify Preview
uses: jakepartusch/wait-for-netlify-action@v1.4
id: waitFor200
with:
site_name: ${{env.NETLIFY_SITE_NAME}}
max_timeout: 90

tests_e2e_netlify:
needs: tests_e2e_netlify_prepare
name: Run E2E tests on deploy preview
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: frontend/package.json
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Install playwright deps
run: npx playwright install --with-deps chromium
- name: run quicker E2E on DEPLOY_PREVIEW
run: npx playwright test --project=E2E_CI --workers 4
# base url based on the GITHUB_PR_NUMBER + NETLIFY_SITE_NAME
env:
E2E_BASE_URL: 'https://deploy-preview-${{env.GITHUB_PR_NUMBER}}--${{env.NETLIFY_SITE_NAME}}.netlify.app'
# store test run reports if they fail
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 30
run: npm test

0 comments on commit fe5f8f3

Please sign in to comment.