Part 6 pw #2
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: Install dependencies | |
| run: npm ci | |
| - name: Install Supabase CLI | |
| run: | | |
| # Remove any existing supabase binary | |
| rm -f supabase | |
| # 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/ | |
| # 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 30 | |
| # Wait for app to be ready | |
| timeout 60 bash -c 'until curl -f http://localhost:4200; do sleep 2; 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 |