fix(tests): add back the playwright test, and banish the searchpage test to an integration test
This commit is contained in:
parent
2479fe4736
commit
539f7cda79
|
|
@ -102,16 +102,43 @@ jobs:
|
|||
sleep 2
|
||||
done
|
||||
|
||||
- name: Run frontend E2E tests
|
||||
- name: Install Playwright browsers
|
||||
working-directory: ./frontend
|
||||
run: npm test -- SearchPage.e2e.test
|
||||
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: Stop backend server
|
||||
- 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
|
||||
working-directory: ./frontend
|
||||
run: npm run test:e2e
|
||||
env:
|
||||
VITE_API_URL: http://localhost:8000
|
||||
|
||||
- name: Stop servers
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f backend.pid ]; then
|
||||
kill $(cat backend.pid) || true
|
||||
rm backend.pid
|
||||
fi
|
||||
if [ -f frontend.pid ]; then
|
||||
kill $(cat frontend.pid) || true
|
||||
rm frontend.pid
|
||||
fi
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { defineConfig } from 'vitest/config'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
test: {
|
||||
globals: true,
|
||||
environment: 'jsdom',
|
||||
setupFiles: './src/test/setup.ts',
|
||||
mockReset: true,
|
||||
clearMocks: true,
|
||||
restoreMocks: true,
|
||||
include: [
|
||||
'**/*.e2e.test.{js,jsx,ts,tsx}',
|
||||
'**/*.integration.test.{js,jsx,ts,tsx}'
|
||||
],
|
||||
exclude: [
|
||||
'**/node_modules/**',
|
||||
'**/dist/**',
|
||||
'**/cypress/**',
|
||||
'**/.{idea,git,cache,output,temp}/**',
|
||||
'**/e2e/**'
|
||||
],
|
||||
},
|
||||
})
|
||||
Loading…
Reference in New Issue