Playwright Tests #111
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: Playwright Tests | |
| on: | |
| deployment_status: | |
| permissions: | |
| contents: read | |
| issues: write # ✅ Required for issue comments | |
| jobs: | |
| run-e2es: | |
| if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Preview' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Print environment | |
| run: echo ${{ github.event.deployment_status.environment }} | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: npm ci && npx playwright install --with-deps | |
| - name: Run Playwright tests | |
| env: | |
| BASE_URL: ${{ github.event.deployment_status.environment_url }} | |
| run: npx playwright test | |
| - name: Upload Playwright Report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 7 | |
| - name: GitHub Notification | |
| if: failure() | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} # ✅ Fix GitHub API auth | |
| script: | | |
| github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: 1, | |
| body: "🚨 Playwright tests failed after deployment!" | |
| }); |