Fix CI: cd to frontend before cypress, use subshell for vite
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Failing after 6m15s

This commit is contained in:
2026-04-06 22:20:47 +00:00
parent c115c47e61
commit f88521c9be
3 changed files with 14 additions and 12 deletions

View File

@@ -23,15 +23,14 @@ jobs:
- name: E2E tests
run: |
# Start backend + frontend in background, run cypress, then cleanup
# Start backend
DB_PATH=/tmp/ci_oil_test.db FRONTEND_DIR=/dev/null \
/tmp/ci-venv/bin/uvicorn backend.main:app --port 8000 &
BACKEND_PID=$!
cd frontend && npx vite --port 5173 &
FRONTEND_PID=$!
# Start frontend (in subshell to not change cwd)
(cd frontend && npx vite --port 5173) &
# Wait for servers
# Wait for both servers
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
@@ -41,13 +40,17 @@ jobs:
sleep 1
done
# Run cypress
# Run cypress from frontend dir
cd frontend
SPECS=$(ls cypress/e2e/*.cy.js | grep -v demo | grep -v visual | grep -v check | tr '\n' ',')
npx cypress run --spec "$SPECS" --config video=false || true
npx cypress run --spec "$SPECS" --config video=false
EXIT_CODE=$?
# Cleanup
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null || true
pkill -f "uvicorn backend" || true
pkill -f "node.*vite" || true
rm -f /tmp/ci_oil_test.db
exit $EXIT_CODE
build-check:
runs-on: test

View File

@@ -2,7 +2,6 @@
<div class="my-diary">
<!-- Sub Tabs -->
<div class="sub-tabs">
<button class="sub-tab" :class="{ active: activeTab === 'diary' }" @click="activeTab = 'diary'">📖 配方日记</button>
<button class="sub-tab" :class="{ active: activeTab === 'brand' }" @click="activeTab = 'brand'">🏷 Brand</button>
<button class="sub-tab" :class="{ active: activeTab === 'account' }" @click="activeTab = 'account'">👤 Account</button>
</div>
@@ -216,7 +215,7 @@ const oils = useOilsStore()
const diaryStore = useDiaryStore()
const ui = useUiStore()
const activeTab = ref('diary')
const activeTab = ref('brand')
const pasteText = ref('')
const selectedDiaryId = ref(null)
const selectedDiary = ref(null)

View File

@@ -90,8 +90,8 @@
</div>
</div>
<!-- Public Recipes Section -->
<div class="recipe-section">
<!-- Public Recipes Section (admin/senior_editor only) -->
<div v-if="auth.isAdmin || auth.user.role === 'senior_editor'" class="recipe-section">
<h3 class="section-title">🌿 公共配方库 ({{ publicRecipes.length }})</h3>
<div class="recipe-list">
<div