Files
schedule-planner/.gitea/workflows/test.yml
Hera Zhao 8c69e2db5b
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 3s
PR Preview / deploy-preview (pull_request) Failing after 4s
Test / e2e-test (push) Successful in 52s
Fix CI: clean stale DB before e2e tests, fix reminder selector
- Clean previous run's DB/WAL/SHM files and kill stale processes
  before starting backend, preventing test data contamination
- reminders-flow: use parents('.reminder-card') to find .remove-btn

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 21:41:08 +00:00

70 lines
2.1 KiB
YAML

name: Test
on: [push]
jobs:
build-check:
runs-on: test
steps:
- uses: actions/checkout@v4
- name: Build frontend
run: cd frontend && npm ci && npm run build
e2e-test:
runs-on: test
needs: build-check
steps:
- uses: actions/checkout@v4
- name: Install frontend deps
run: cd frontend && npm ci
- name: Install backend deps
run: python3 -m venv /tmp/ci-venv && /tmp/ci-venv/bin/pip install -q -r backend/requirements.txt
- name: E2E tests
run: |
# Clean stale data from previous runs
rm -f /tmp/ci_planner_test.db /tmp/ci_planner_test.db-wal /tmp/ci_planner_test.db-shm
rm -rf /tmp/ci_planner_data
pkill -f "uvicorn backend" || true
pkill -f "node.*vite" || true
sleep 1
# Start backend with fresh DB
DB_PATH=/tmp/ci_planner_test.db FRONTEND_DIR=/dev/null DATA_DIR=/tmp/ci_planner_data \
/tmp/ci-venv/bin/uvicorn backend.main:app --port 8000 &
# Start frontend
(cd frontend && npx vite --port 5173) &
# Wait for both servers
for i in $(seq 1 30); do
if curl -sf http://localhost:8000/api/backups > /dev/null 2>&1 && \
curl -sf http://localhost:5173/ > /dev/null 2>&1; then
echo "Both servers ready"
break
fi
sleep 1
done
# Run core cypress specs
cd frontend
npx cypress run --spec "\
cypress/e2e/app-load.cy.js,\
cypress/e2e/auth-flow.cy.js,\
cypress/e2e/navigation.cy.js,\
cypress/e2e/api-health.cy.js,\
cypress/e2e/api-crud.cy.js,\
cypress/e2e/notes-flow.cy.js,\
cypress/e2e/tasks-flow.cy.js,\
cypress/e2e/reminders-flow.cy.js\
" --config video=false
EXIT_CODE=$?
# Cleanup
pkill -f "uvicorn backend" || true
pkill -f "node.*vite" || true
rm -f /tmp/ci_planner_test.db
rm -rf /tmp/ci_planner_data
exit $EXIT_CODE