Skip to content

deleted .net & java #20

deleted .net & java

deleted .net & java #20

Workflow file for this run

name: Playwright E2E Tests
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
workflow_dispatch: # Allow manual trigger
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout playwright tests
uses: actions/checkout@v4
- name: Checkout confac
uses: actions/checkout@v4
with:
repository: itenium-be/confac
path: confac
# Use the same branch if it exists, otherwise master
ref: ${{ github.head_ref || github.ref_name || 'master' }}
continue-on-error: true
- name: Fallback to confac master
if: failure()
uses: actions/checkout@v4
with:
repository: itenium-be/confac
path: confac
ref: master
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install Playwright dependencies
run: |
npm ci
npx playwright install --with-deps chromium
- name: Install confac backend dependencies
working-directory: ./confac/backend
run: |
# Use npm install instead of npm ci to ensure all transitive deps are resolved
rm -f package-lock.json
npm install
- name: Install confac frontend dependencies
working-directory: ./confac/frontend
run: npm ci
- name: Start infrastructure (MongoDB + mocks)
run: |
docker compose -f docker-compose.test.yml up -d --build
# Wait for MongoDB to be ready
sleep 10
docker compose -f docker-compose.test.yml ps
- name: Setup backend environment
working-directory: ./confac/backend
run: |
cp ../../.env.test .env
cp -r templates-example templates || true
- name: Build backend
working-directory: ./confac/backend
run: |
# Install TypeScript 5.x to handle newer type syntax in dependencies
npm install typescript@5 --save-dev
# Build with skipLibCheck to avoid library type checking issues
npx tsc -p . --skipLibCheck
- name: Start backend
working-directory: ./confac/backend
run: |
npm run start:build > backend.log 2>&1 &
echo $! > backend.pid
echo "Backend PID: $(cat backend.pid)"
env:
NODE_ENV: test
- name: Start frontend
working-directory: ./confac/frontend
run: |
npm start > frontend.log 2>&1 &
echo $! > frontend.pid
echo "Frontend PID: $(cat frontend.pid)"
env:
CI: true
BROWSER: none
- name: Wait for services
run: |
echo "Waiting for backend on port 9000..."
for i in {1..30}; do
if curl -s http://localhost:9000/api/config > /dev/null 2>&1; then
echo "Backend is ready!"
break
fi
echo "Attempt $i: Backend not ready yet..."
sleep 2
done
echo "Checking backend status..."
curl -v http://localhost:9000/api/config 2>&1 || true
echo ""
echo "Backend log (last 50 lines):"
tail -50 ./confac/backend/backend.log || true
echo ""
echo "Waiting for frontend on port 3000..."
timeout 120 bash -c 'until curl -s http://localhost:3000 > /dev/null 2>&1; do sleep 2; done'
echo "Frontend is ready!"
- name: Seed database
run: npm run seed
- name: Run Playwright tests
run: npx playwright test --project=chromium --reporter=html
env:
CI: true
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Upload test artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results
path: test-results/
retention-days: 30
- name: Show backend logs on failure
if: failure()
run: |
echo "=== Backend Log ==="
cat ./confac/backend/backend.log || echo "No backend log found"
- name: Show frontend logs on failure
if: failure()
run: |
echo "=== Frontend Log ==="
cat ./confac/frontend/frontend.log || echo "No frontend log found"
- name: Show docker logs on failure
if: failure()
run: docker compose -f docker-compose.test.yml logs
- name: Cleanup
if: always()
run: docker compose -f docker-compose.test.yml down -v