fix(tests): fix e2e tests, part 2
This commit is contained in:
parent
e71f6dfbd4
commit
47fd28e79a
|
|
@ -72,6 +72,8 @@ jobs:
|
||||||
|
|
||||||
- name: Build backend
|
- name: Build backend
|
||||||
run: cargo build --release
|
run: cargo build --release
|
||||||
|
env:
|
||||||
|
DATABASE_URL: postgres://postgres:postgres@localhost:5432/readur_test
|
||||||
|
|
||||||
- name: Build frontend
|
- name: Build frontend
|
||||||
working-directory: ./frontend
|
working-directory: ./frontend
|
||||||
|
|
@ -106,39 +108,16 @@ jobs:
|
||||||
working-directory: ./frontend
|
working-directory: ./frontend
|
||||||
run: npx playwright install --with-deps
|
run: npx playwright install --with-deps
|
||||||
|
|
||||||
- name: Start frontend dev server
|
|
||||||
working-directory: ./frontend
|
|
||||||
run: |
|
|
||||||
npm run dev &
|
|
||||||
echo $! > frontend.pid
|
|
||||||
env:
|
|
||||||
VITE_API_URL: http://localhost:8000
|
|
||||||
|
|
||||||
- name: Wait for frontend to be ready
|
|
||||||
run: |
|
|
||||||
for i in {1..30}; do
|
|
||||||
if curl -f http://localhost:5173 > /dev/null 2>&1; then
|
|
||||||
echo "Frontend is ready"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
echo "Waiting for frontend... ($i/30)"
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Run frontend E2E tests
|
- name: Run frontend E2E tests
|
||||||
working-directory: ./frontend
|
working-directory: ./frontend
|
||||||
run: npm run test:e2e
|
run: npm run test:e2e
|
||||||
env:
|
env:
|
||||||
VITE_API_URL: http://localhost:8000
|
VITE_API_URL: http://localhost:8000
|
||||||
|
|
||||||
- name: Stop servers
|
- name: Stop backend server
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
if [ -f backend.pid ]; then
|
if [ -f backend.pid ]; then
|
||||||
kill $(cat backend.pid) || true
|
kill $(cat backend.pid) || true
|
||||||
rm backend.pid
|
rm backend.pid
|
||||||
fi
|
fi
|
||||||
if [ -f frontend.pid ]; then
|
|
||||||
kill $(cat frontend.pid) || true
|
|
||||||
rm frontend.pid
|
|
||||||
fi
|
|
||||||
Loading…
Reference in New Issue