fix(tests): add back the playwright test, and banish the searchpage test to an integration test
This commit is contained in:
parent
4b0f4ed226
commit
62bb17fb84
|
|
@ -102,16 +102,43 @@ jobs:
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Run frontend E2E tests
|
- name: Install Playwright browsers
|
||||||
working-directory: ./frontend
|
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:
|
env:
|
||||||
VITE_API_URL: http://localhost:8000
|
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()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
if [ -f backend.pid ]; then
|
if [ -f backend.pid ]; then
|
||||||
kill $(cat backend.pid) || true
|
kill $(cat backend.pid) || true
|
||||||
rm backend.pid
|
rm backend.pid
|
||||||
fi
|
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