Compare commits
1 Commits
feat/oil-p
...
feat/inven
| Author | SHA1 | Date | |
|---|---|---|---|
| d458bd05cd |
@@ -12,6 +12,7 @@ jobs:
|
||||
e2e-test:
|
||||
runs-on: test
|
||||
needs: unit-test
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -23,24 +24,41 @@ jobs:
|
||||
|
||||
- name: E2E tests
|
||||
run: |
|
||||
# Dynamic ports to avoid conflicts
|
||||
BE_PORT=$(shuf -i 9000-9999 -n 1)
|
||||
FE_PORT=$(shuf -i 4000-4999 -n 1)
|
||||
DB_FILE="/tmp/ci_oil_test_${BE_PORT}.db"
|
||||
echo "Using backend=$BE_PORT frontend=$FE_PORT db=$DB_FILE"
|
||||
|
||||
# Start backend
|
||||
DB_PATH=/tmp/ci_oil_test.db FRONTEND_DIR=/dev/null \
|
||||
/tmp/ci-venv/bin/uvicorn backend.main:app --port 8000 &
|
||||
DB_PATH="$DB_FILE" FRONTEND_DIR=/dev/null \
|
||||
/tmp/ci-venv/bin/uvicorn backend.main:app --port $BE_PORT &
|
||||
BE_PID=$!
|
||||
|
||||
# Start frontend (in subshell to not change cwd)
|
||||
(cd frontend && npx vite --port 5173) &
|
||||
# Start frontend with proxy to dynamic backend port
|
||||
(cd frontend && VITE_API_PORT=$BE_PORT npx vite --port $FE_PORT) &
|
||||
FE_PID=$!
|
||||
|
||||
# Wait for both servers
|
||||
# Wait for both servers (max 30s, fail fast)
|
||||
READY=0
|
||||
for i in $(seq 1 30); do
|
||||
if curl -sf http://localhost:8000/api/version > /dev/null 2>&1 && \
|
||||
curl -sf http://localhost:5173/ > /dev/null 2>&1; then
|
||||
echo "Both servers ready"
|
||||
if curl -sf http://localhost:$BE_PORT/api/oils > /dev/null 2>&1 && \
|
||||
curl -sf http://localhost:$FE_PORT/ > /dev/null 2>&1; then
|
||||
echo "Both servers ready in ${i}s"
|
||||
READY=1
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Run core cypress specs (proven stable)
|
||||
if [ "$READY" = "0" ]; then
|
||||
echo "ERROR: Servers failed to start within 30s"
|
||||
kill $BE_PID $FE_PID 2>/dev/null
|
||||
rm -f "$DB_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run core cypress specs with timeouts
|
||||
cd frontend
|
||||
npx cypress run --spec "\
|
||||
cypress/e2e/recipe-detail.cy.js,\
|
||||
@@ -50,13 +68,12 @@ jobs:
|
||||
cypress/e2e/category-modules.cy.js,\
|
||||
cypress/e2e/notification-flow.cy.js,\
|
||||
cypress/e2e/registration-flow.cy.js\
|
||||
" --config video=false
|
||||
" --config "video=false,defaultCommandTimeout=5000,pageLoadTimeout=10000,baseUrl=http://localhost:$FE_PORT"
|
||||
EXIT_CODE=$?
|
||||
|
||||
# Cleanup
|
||||
pkill -f "uvicorn backend" || true
|
||||
pkill -f "node.*vite" || true
|
||||
rm -f /tmp/ci_oil_test.db
|
||||
kill $BE_PID $FE_PID 2>/dev/null
|
||||
rm -f "$DB_FILE"
|
||||
exit $EXIT_CODE
|
||||
|
||||
build-check:
|
||||
|
||||
@@ -10,8 +10,8 @@ export default defineConfig({
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': 'http://localhost:8000',
|
||||
'/uploads': 'http://localhost:8000'
|
||||
'/api': `http://localhost:${process.env.VITE_API_PORT || 8000}`,
|
||||
'/uploads': `http://localhost:${process.env.VITE_API_PORT || 8000}`
|
||||
}
|
||||
},
|
||||
build: {
|
||||
|
||||
Reference in New Issue
Block a user