Skip to content

Commit

Permalink
Build frontend before running playwright tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Oct 2, 2024
1 parent e1a7972 commit 1075936
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ jobs:
export $(grep -v '^#' .env | xargs)
python manage.py createsuperuser --noinput
nohup python manage.py runserver &
- name: Build frontend
working-directory: ${{ env.frontend-directory }}
run: pnpm run build
- name: Run tests with browser ${{ matrix.playwright-browser }}
working-directory: ${{ env.frontend-directory }}
run: pnpx playwright test --project=${{ matrix.playwright-browser }}
Expand Down Expand Up @@ -196,6 +199,9 @@ jobs:
export $(grep -v '^#' .env | xargs)
poetry run python manage.py createsuperuser --noinput
nohup poetry run python manage.py runserver --settings=${{ env.enterprise-backend-settings-module }} &
- name: Build frontend
working-directory: ${{ env.frontend-directory }}
run: pnpm run build
- name: Run tests with browser ${{ matrix.playwright-browser }}
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: pnpx playwright test --project=${{ matrix.playwright-browser }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/startup-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ jobs:
export $(grep -v '^#' .env | xargs)
poetry run python manage.py createsuperuser --noinput
nohup poetry run python manage.py runserver &
- name: Build frontend
working-directory: ${{ env.frontend-directory }}
run: pnpm run build
- name: Run tests
working-directory: ${{ env.frontend-directory }}
run: pnpx playwright test tests/functional/startup.test.ts
Expand Down Expand Up @@ -214,6 +217,9 @@ jobs:
export $(grep -v '^#' .env | xargs)
poetry run python manage.py createsuperuser --noinput
nohup poetry run python manage.py runserver --settings=${{ env.enterprise-backend-settings-module }} &
- name: Build frontend
working-directory: ${{ env.frontend-directory }}
run: pnpm run build
- name: Run tests
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: pnpx playwright test tests/functional/startup.test.ts
Expand Down
3 changes: 1 addition & 2 deletions frontend/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { devices } from '@playwright/test';

const config: PlaywrightTestConfig = {
webServer: {
timeout: 2 * 60 * 1000,
command: process.env.COMPOSE_TEST
? 'echo "The docker compose frontend server didn\'t start correctly"'
: 'npm install -g pnpm && pnpm install && pnpm run build && pnpm run preview',
: 'pnpm run preview',
url: `http://localhost:${process.env.COMPOSE_TEST ? 3000 : 4173}`,
reuseExistingServer: !process.env.CI
},
Expand Down

0 comments on commit 1075936

Please sign in to comment.