This repository was archived by the owner on Jul 14, 2026. It is now read-only.
Create repo2pdf.ignore #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Suite | |
| on: | |
| push: | |
| branches: [ main] | |
| pull_request: | |
| branches: [ main] | |
| jobs: | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Build event service | |
| run: | | |
| cd event | |
| docker build -t 3lips-event-test . | |
| - name: Run unit tests | |
| run: | | |
| docker run --rm -v $(pwd)/event:/app -v $(pwd)/tests/unit:/app/tests/unit -w /app 3lips-event-test python -m pytest tests/unit/ -v | |
| integration-tests: | |
| name: Puppeteer Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: unit-tests | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Install Puppeteer | |
| run: | | |
| npm install puppeteer | |
| - name: Start test services | |
| run: | | |
| cd tests | |
| docker compose -f docker-compose.ci.yml up -d | |
| # Wait for services to be ready (longer wait for nginx and all services) | |
| sleep 45 | |
| - name: Verify services are running | |
| run: | | |
| chmod +x tests/verify-services.sh | |
| ./tests/verify-services.sh | |
| # Also verify mock services are responding | |
| echo "π Checking mock services..." | |
| for port in 8001 8002 8003; do | |
| if curl -s -f http://localhost:$port > /dev/null; then | |
| echo "β Mock service on port $port is responding" | |
| else | |
| echo "β Mock service on port $port is not responding" | |
| # Show what's actually running | |
| docker ps | |
| exit 1 | |
| fi | |
| done | |
| - name: Run Puppeteer smoke test | |
| run: | | |
| node -e " | |
| const puppeteer = require('puppeteer'); | |
| const fs = require('fs'); | |
| async function runSmokeTest() { | |
| const browser = await puppeteer.launch({ | |
| headless: true, | |
| args: ['--no-sandbox', '--disable-setuid-sandbox'] | |
| }); | |
| const page = await browser.newPage(); | |
| console.log('π Running 3lips smoke test...'); | |
| let passed = 0; | |
| let failed = 0; | |
| function addCheck(name, success, details = '') { | |
| if (success) { | |
| passed++; | |
| console.log(\`β \${name}\`); | |
| } else { | |
| failed++; | |
| console.log(\`β \${name}: \${details}\`); | |
| } | |
| } | |
| try { | |
| console.log('π Test 1: Page loads'); | |
| await page.goto('http://localhost:5000', { waitUntil: 'networkidle0' }); | |
| addCheck('Page loads', true); | |
| console.log('π·οΈ Test 2: Correct title'); | |
| const title = await page.title(); | |
| const hasCorrectTitle = title && title.includes('3lips'); | |
| addCheck('Correct title', hasCorrectTitle, hasCorrectTitle ? title : \`Got: \${title}\`); | |
| console.log('π Test 3: Form exists'); | |
| const hasForm = await page.\$('form') !== null; | |
| addCheck('Form exists', hasForm, hasForm ? 'Found' : 'Missing form element'); | |
| console.log('βΆοΈ Test 4: API button exists'); | |
| const hasApiButton = await page.\$('#buttonApi') !== null; | |
| addCheck('API button exists', hasApiButton, hasApiButton ? 'Found' : 'Missing #buttonApi'); | |
| console.log('πΊοΈ Test 5: Map button exists'); | |
| const hasMapButton = await page.\$('#buttonMap') !== null; | |
| addCheck('Map button exists', hasMapButton, hasMapButton ? 'Found' : 'Missing #buttonMap'); | |
| console.log('πΈ Test 6: Take screenshot'); | |
| await page.screenshot({ path: 'smoke-test-result.png' }); | |
| addCheck('Screenshot captured', true, 'smoke-test-result.png'); | |
| const allPassed = failed === 0; | |
| console.log(\`\\nπ Smoke Test Results:\`); | |
| console.log(\`β Passed: \${passed}\`); | |
| console.log(\`β Failed: \${failed}\`); | |
| console.log(\`π― Overall: \${allPassed ? 'PASS' : 'FAIL'}\`); | |
| if (allPassed) { | |
| console.log('π 3lips is working correctly!'); | |
| } else { | |
| console.log('β οΈ Issues detected - check failed tests above'); | |
| process.exit(1); | |
| } | |
| } catch (error) { | |
| console.error('π₯ Smoke test failed with error:', error.message); | |
| process.exit(1); | |
| } finally { | |
| await browser.close(); | |
| } | |
| } | |
| runSmokeTest(); | |
| " | |
| - name: Test API service homepage | |
| run: | | |
| # Wait a moment for services to be fully ready | |
| sleep 10 | |
| # Test that API service homepage is responding | |
| response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/) | |
| if [ "$response" -eq "200" ]; then | |
| echo "β API service homepage is responding" | |
| # Also test that the page contains expected content | |
| content=$(curl -s http://localhost:5000/) | |
| if echo "$content" | grep -q "3lips"; then | |
| echo "β Homepage contains expected content" | |
| else | |
| echo "β Homepage doesn't contain expected content" | |
| exit 1 | |
| fi | |
| else | |
| echo "β API service returned HTTP $response" | |
| exit 1 | |
| fi | |
| - name: Test Map endpoint | |
| run: | | |
| # Test that Cesium service is accessible | |
| curl -f http://localhost:8080 || exit 1 | |
| - name: Upload test artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-screenshots | |
| path: | | |
| smoke-test-result.png | |
| tests/logs/ | |
| - name: Clean up test services | |
| if: always() | |
| run: | | |
| cd tests | |
| docker compose -f docker-compose.ci.yml down -v |