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
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:
@@ -23,15 +23,14 @@ jobs:
|
|||||||
|
|
||||||
- name: E2E tests
|
- name: E2E tests
|
||||||
run: |
|
run: |
|
||||||
# Start backend + frontend in background, run cypress, then cleanup
|
# Start backend
|
||||||
DB_PATH=/tmp/ci_oil_test.db FRONTEND_DIR=/dev/null \
|
DB_PATH=/tmp/ci_oil_test.db FRONTEND_DIR=/dev/null \
|
||||||
/tmp/ci-venv/bin/uvicorn backend.main:app --port 8000 &
|
/tmp/ci-venv/bin/uvicorn backend.main:app --port 8000 &
|
||||||
BACKEND_PID=$!
|
|
||||||
|
|
||||||
cd frontend && npx vite --port 5173 &
|
# Start frontend (in subshell to not change cwd)
|
||||||
FRONTEND_PID=$!
|
(cd frontend && npx vite --port 5173) &
|
||||||
|
|
||||||
# Wait for servers
|
# Wait for both servers
|
||||||
for i in $(seq 1 30); do
|
for i in $(seq 1 30); do
|
||||||
if curl -sf http://localhost:8000/api/version > /dev/null 2>&1 && \
|
if curl -sf http://localhost:8000/api/version > /dev/null 2>&1 && \
|
||||||
curl -sf http://localhost:5173/ > /dev/null 2>&1; then
|
curl -sf http://localhost:5173/ > /dev/null 2>&1; then
|
||||||
@@ -41,13 +40,17 @@ jobs:
|
|||||||
sleep 1
|
sleep 1
|
||||||
done
|
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' ',')
|
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
|
# 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
|
rm -f /tmp/ci_oil_test.db
|
||||||
|
exit $EXIT_CODE
|
||||||
|
|
||||||
build-check:
|
build-check:
|
||||||
runs-on: test
|
runs-on: test
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<div class="my-diary">
|
<div class="my-diary">
|
||||||
<!-- Sub Tabs -->
|
<!-- Sub Tabs -->
|
||||||
<div class="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 === 'brand' }" @click="activeTab = 'brand'">🏷️ Brand</button>
|
||||||
<button class="sub-tab" :class="{ active: activeTab === 'account' }" @click="activeTab = 'account'">👤 Account</button>
|
<button class="sub-tab" :class="{ active: activeTab === 'account' }" @click="activeTab = 'account'">👤 Account</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -216,7 +215,7 @@ const oils = useOilsStore()
|
|||||||
const diaryStore = useDiaryStore()
|
const diaryStore = useDiaryStore()
|
||||||
const ui = useUiStore()
|
const ui = useUiStore()
|
||||||
|
|
||||||
const activeTab = ref('diary')
|
const activeTab = ref('brand')
|
||||||
const pasteText = ref('')
|
const pasteText = ref('')
|
||||||
const selectedDiaryId = ref(null)
|
const selectedDiaryId = ref(null)
|
||||||
const selectedDiary = ref(null)
|
const selectedDiary = ref(null)
|
||||||
|
|||||||
@@ -90,8 +90,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Public Recipes Section -->
|
<!-- Public Recipes Section (admin/senior_editor only) -->
|
||||||
<div class="recipe-section">
|
<div v-if="auth.isAdmin || auth.user.role === 'senior_editor'" class="recipe-section">
|
||||||
<h3 class="section-title">🌿 公共配方库 ({{ publicRecipes.length }})</h3>
|
<h3 class="section-title">🌿 公共配方库 ({{ publicRecipes.length }})</h3>
|
||||||
<div class="recipe-list">
|
<div class="recipe-list">
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user