Skip to content

Application E2E Tests #8

Application E2E Tests

Application E2E Tests #8

name: Application E2E Tests
on:
workflow_run:
workflows:
- "Application Build"
types:
- completed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e_test:
name: Run E2E tests
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-22.04
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Dashboard hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
# Run 10 copies of the current job in parallel
containers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
CYPRESS_PROJECT_ID: ${{ secrets.PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUPPETEER_SKIP_DOWNLOAD: "true"
VITE_CYPRESS_PORT: 8880
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set version and environment profile
uses: ./.github/actions/set-version-and-environment-profile
- name: Set MONITORFISH_VERSION environment variable
run: echo "MONITORFISH_VERSION=${VERSION}" >> $GITHUB_ENV
- name: Download image
uses: ishworkh/[email protected]
with:
image: monitorfish-app:${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
workflow: "Application Build"
- name: Run docker images
run: make docker-compose-up
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: ./frontend/package-lock.json
node-version: 20
- name: Setup Firefox
uses: browser-actions/setup-firefox@latest
with:
firefox-version: 119.0.1
- name: Check versions
run: |
cat /etc/lsb-release
node -v
npm -v
docker -v
docker compose version
firefox -v
which firefox
- uses: cypress-io/github-action@v6
with:
browser: firefox
config-file: config/cypress.config.ts
env: PORT=8880
install: true
install-command: npm ci
parallel: true
record: true
wait-on: "http://localhost:8880"
working-directory: ./frontend
- uses: LouisBrunner/[email protected]
if: ${{ always() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Application Cypress E2E tests
conclusion: ${{ job.status }}
e2e_multi_windows_test:
name: Run E2E multi windows tests
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-22.04
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUPPETEER_SKIP_DOWNLOAD: "true"
VITE_CYPRESS_PORT: 8880
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set version and environment profile
uses: ./.github/actions/set-version-and-environment-profile
- name: Set MONITORFISH_VERSION environment variable
run: echo "MONITORFISH_VERSION=${VERSION}" >> $GITHUB_ENV
- name: Download image
uses: ishworkh/[email protected]
with:
image: monitorfish-app:${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
workflow: "Application Build"
- name: Docker login
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: ./frontend/package-lock.json
node-version: 20
- name: Install Node.js dependencies
run: npm ci
working-directory: ./frontend
- name: Run docker images
run: make docker-compose-puppeteer-up
- name: Install Firefox
run: npx puppeteer browsers install firefox
- name: Run multi-windows tests
run: npm run test:multi-windows:run
working-directory: ./frontend
- uses: LouisBrunner/[email protected]
if: ${{ always() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Application Puppeteer E2E tests
conclusion: ${{ job.status }}