diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index cd0c6cd..47bc524 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -1,27 +1,54 @@ name: Playwright Tests + on: push: branches: [ main, master ] pull_request: branches: [ main, master ] + jobs: test: timeout-minutes: 60 runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - name: Install dependencies - run: npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - name: Run Playwright tests - run: npx playwright test - - uses: actions/upload-artifact@v3 - if: ${{ !cancelled() }} - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 + # Checkout the repository + - uses: actions/checkout@v4 + + # Set up Node.js + - uses: actions/setup-node@v4 + with: + node-version: lts/* + + # Install project dependencies + - name: Install dependencies + run: npm ci + + # Build the Angular project + - name: Build Angular Project + run: npm run build + + # Start Angular development server + - name: Start Angular Development Server + run: npm start + env: + PORT: 4200 # Ensures the server runs on a predictable port + continue-on-error: true + + # Install Playwright and dependencies + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + # Run Playwright tests + - name: Run Playwright Tests + run: npx playwright test + env: + CI: true # Ensures Playwright runs in CI mode + + # Upload Playwright report + - uses: actions/upload-artifact@v3 + if: ${{ !cancelled() }} + with: + name: playwright-report + path: playwright-report/ + retention-days: 30