Part 6 pw #4
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 with Local Supabase | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| e2e-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Clean and install dependencies | |
| run: | | |
| # Clean npm cache and remove lock file to fix Rollup issue | |
| npm cache clean --force | |
| rm -f package-lock.json | |
| rm -rf node_modules | |
| # Fresh install | |
| npm install | |
| # Verify installation | |
| npm ls @rollup/rollup-linux-x64-gnu || echo "Rollup native dependency not found, continuing..." | |
| - name: Install Supabase CLI | |
| run: | | |
| # Create a temporary directory for extraction | |
| mkdir -p /tmp/supabase-cli | |
| cd /tmp/supabase-cli | |
| # Download and extract | |
| curl -fsSL https://github.com/supabase/cli/releases/download/v1.123.4/supabase_linux_amd64.tar.gz | tar -xz | |
| # Make executable and move to system path | |
| chmod +x supabase | |
| sudo mv supabase /usr/local/bin/ | |
| # Clean up | |
| cd / | |
| rm -rf /tmp/supabase-cli | |
| # Verify installation | |
| supabase --version | |
| - name: Start Docker | |
| run: | | |
| sudo systemctl start docker | |
| sudo usermod -aG docker $USER | |
| - name: Start Supabase local instance | |
| run: | | |
| # Start Supabase with existing config | |
| supabase start | |
| # Wait for services to be ready | |
| sleep 15 | |
| # Verify services are running | |
| supabase status | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps | |
| - name: Start Angular app | |
| run: | | |
| # Start Angular with local configuration | |
| npm run start:local & | |
| # Wait for app to start | |
| sleep 45 | |
| # Wait for app to be ready with longer timeout | |
| timeout 120 bash -c 'until curl -f http://localhost:4200; do sleep 3; done' | |
| env: | |
| # Set environment variables for local Supabase | |
| SUPABASE_URL: http://127.0.0.1:54321 | |
| SUPABASE_ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 | |
| - name: Run E2E tests | |
| run: npm run e2e:local | |
| env: | |
| # Ensure E2E tests use local Supabase | |
| SUPABASE_URL: http://127.0.0.1:54321 | |
| SUPABASE_ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 30 | |
| - name: Stop services | |
| if: always() | |
| run: | | |
| # Kill Angular dev server | |
| pkill -f "ng serve" || true | |
| # Stop Supabase | |
| supabase stop || true |