- Moves E2E test user to dedicated env variables - Fixes playwright test redirect issue --------- Co-authored-by: Emma Segal-Grossman <hi@emma.cafe>
89 lines
2.5 KiB
YAML
89 lines
2.5 KiB
YAML
name: Playwright Tests
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'frontend/src/**'
|
|
- 'frontend/*.json'
|
|
- 'frontend/*.js'
|
|
- 'frontend/*.ts'
|
|
- '.github/workflows/ui-tests-playwright.yml'
|
|
|
|
jobs:
|
|
test:
|
|
timeout-minutes: 60
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
E2E_USER_EMAIL: ${{ secrets.E2E_USER_EMAIL }}
|
|
E2E_USER_PASSWORD: ${{ secrets.E2E_USER_PASSWORD }}
|
|
API_BASE_URL: ${{ secrets.API_BASE_URL }}
|
|
working-directory: ./frontend
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'yarn'
|
|
cache-dependency-path: frontend/yarn.lock
|
|
|
|
- name: Get installed Playwright version
|
|
working-directory: frontend
|
|
id: playwright-version
|
|
run: |
|
|
yarn add @yarnpkg/lockfile
|
|
echo "PLAYWRIGHT_VERSION=$(node scripts/get-resolved-playwright-version.js)" >> $GITHUB_ENV
|
|
|
|
- name: Cache playwright binaries
|
|
uses: actions/cache@v4
|
|
id: playwright-cache
|
|
with:
|
|
path: |
|
|
~/.cache/ms-playwright
|
|
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
|
|
|
|
- name: Install dependencies
|
|
working-directory: frontend
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Install Playwright Browsers
|
|
working-directory: frontend
|
|
env:
|
|
HUSKY: 0
|
|
run: yarn playwright install --with-deps
|
|
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
|
|
|
- name: Install Playwright Deps
|
|
working-directory: frontend
|
|
env:
|
|
HUSKY: 0
|
|
run: yarn playwright install-deps
|
|
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
|
|
|
- name: Create env file
|
|
run: |
|
|
cd frontend
|
|
touch .env
|
|
echo E2E_USER_EMAIL="${{ secrets.E2E_USER_EMAIL }}" >> .env
|
|
echo E2E_USER_PASSWORD="${{ secrets.E2E_USER_PASSWORD }}" >> .env
|
|
echo API_BASE_URL=${{ secrets.API_BASE_URL }} >> .env
|
|
cat .env
|
|
|
|
- name: Build frontend
|
|
working-directory: frontend
|
|
run: yarn build
|
|
id: build-frontend
|
|
|
|
- name: Run Playwright tests
|
|
working-directory: frontend
|
|
run: yarn playwright test
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: playwright-report
|
|
path: frontend/playwright-report/
|
|
retention-days: 30
|