Merge pull request #1 from FractionEstate/copilot/fix-demo-wallet-issues #115
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: E2E Tests | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| workflow_dispatch: | |
| jobs: | |
| e2e-tests: | |
| name: End-to-End Tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: demo-wallet/package-lock.json | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r core/api/api_requirements.txt | |
| pip install -e sdk/ | |
| - name: Install demo-wallet dependencies | |
| working-directory: ./demo-wallet | |
| run: npm ci | |
| - name: Install Playwright browsers | |
| working-directory: ./demo-wallet | |
| run: npx playwright install --with-deps chromium | |
| - name: Generate test secrets | |
| working-directory: ./core/api | |
| run: | | |
| echo "API_SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_urlsafe(32))')" >> .env | |
| echo "JWT_SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_urlsafe(32))')" >> .env | |
| echo "CORS_ORIGINS=http://localhost:3003,http://localhost:3000" >> .env | |
| echo "DOMAIN=localhost" >> .env | |
| echo "API_URL=http://localhost:8000" >> .env | |
| echo "HTTPS_ONLY=false" >> .env | |
| chmod 600 .env | |
| - name: Start backend API | |
| working-directory: ./core/api | |
| run: | | |
| mkdir -p ../../logs ../../data | |
| python3 api_server_secure.py &> ../../logs/api_server.log & | |
| echo $! > ../../logs/api_server.pid | |
| # Wait for API to be ready | |
| for i in {1..30}; do | |
| if curl -s http://localhost:8000/health > /dev/null; then | |
| echo "API is ready" | |
| break | |
| fi | |
| echo "Waiting for API... ($i/30)" | |
| sleep 1 | |
| done | |
| - name: Run E2E tests | |
| working-directory: ./demo-wallet | |
| run: | | |
| npx playwright test --reporter=list,html | |
| env: | |
| API_URL: http://localhost:8000 | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: demo-wallet/playwright-report/ | |
| retention-days: 30 | |
| - name: Upload API logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: api-logs | |
| path: logs/ | |
| retention-days: 7 | |
| - name: Stop backend API | |
| if: always() | |
| run: | | |
| if [ -f ../../logs/api_server.pid ]; then | |
| kill $(cat ../../logs/api_server.pid) || true | |
| fi | |
| working-directory: ./core/api |