Skip to content

Update cypress-test.yml #7

Update cypress-test.yml

Update cypress-test.yml #7

Workflow file for this run

name: Cypress Tests
on:
push:
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 18
- name: Install Frontend Dependencies
run: yarn install
- name: Run Frontend Emulator
run: yarn dev & echo $! > frontend_pid.txt
- name: Wait for Frontend to start
run: |
timeout=160
while ! curl -s http://localhost:3000 > /dev/null; do
echo "Waiting for frontend to start..."
sleep 5
timeout=$((timeout - 5))
if [ $timeout -le 0 ]; then
echo "Frontend did not start in time"
exit 1
fi
done
- name: Run Emulator
run: yarn emulator & echo $! > emulator_pid.txt
- name: Seed Database
run: yarn seed
- name: Check if Frontend is running
run: curl -f http://localhost:3000/ || exit 1
- name: Run Cypress Tests
run: yarn test:cypress
- name: Stop Emulator
run: kill $(cat emulator_pid.txt)
if: always()
- name: Stop Frontend Server
run: kill $(cat frontend_pid.txt)
if: always()