|
| 1 | +name: Playwright Tests |
| 2 | + |
| 3 | +on: |
| 4 | + deployment_status: |
| 5 | + |
| 6 | +defaults: |
| 7 | + run: |
| 8 | + working-directory: ./ |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read # for checkout repository |
| 12 | + |
| 13 | +jobs: |
| 14 | + run-e2es: |
| 15 | + if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' && github.ref != 'refs/heads/main' |
| 16 | + runs-on: ubuntu-latest |
| 17 | + name: Run E2E tests |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Install Node.js |
| 23 | + uses: actions/setup-node@v4 |
| 24 | + with: |
| 25 | + node-version: 20 |
| 26 | + |
| 27 | + - name: Install pnpm |
| 28 | + uses: pnpm/action-setup@v4 |
| 29 | + with: |
| 30 | + version: latest |
| 31 | + |
| 32 | + - name: Install packages |
| 33 | + run: pnpm install --frozen-lockfile |
| 34 | + |
| 35 | + - name: Install Playwright dependencies |
| 36 | + run: pnpm exec playwright install-deps |
| 37 | + |
| 38 | + - name: Install Playwright |
| 39 | + run: pnpm exec playwright install |
| 40 | + |
| 41 | + - name: Configure PandaDoc Webhook |
| 42 | + run: | |
| 43 | + curl -X POST https://api.pandadoc.com/public/v1/webhooks \ |
| 44 | + -H "Authorization: Bearer ${{ secrets.PANDADOC_API_KEY }}" \ |
| 45 | + -H "Content-Type: application/json" \ |
| 46 | + -d '{ |
| 47 | + "url": "${{ github.event.deployment_status.environment_url }}/api/webhook/pandadoc", |
| 48 | + "events": ["document.completed"], |
| 49 | + "shared_key": "${{ secrets.PANDADOC_WEBHOOK_SHARED_KEY }}" |
| 50 | + }' |
| 51 | +
|
| 52 | + - name: Set Vercel Environment Variable |
| 53 | + run: | |
| 54 | + curl -X PATCH https://api.vercel.com/v9/projects/${{ secrets.VERCEL_PROJECT_ID }}/env \ |
| 55 | + -H "Authorization: Bearer ${{ secrets.VERCEL_API_TOKEN }}" \ |
| 56 | + -H "Content-Type: application/json" \ |
| 57 | + -d '{ |
| 58 | + "key": "PANDADOC_WEBHOOK_SHARED_KEY", |
| 59 | + "value": "${{ secrets.PANDADOC_WEBHOOK_SHARED_KEY }}", |
| 60 | + "target": ["staging"] |
| 61 | + }' |
| 62 | +
|
| 63 | + - name: Run E2E tests |
| 64 | + env: |
| 65 | + NEXT_PUBLIC_URL: ${{ github.event.deployment_status.environment_url }} |
| 66 | + run: pnpm test:e2e |
| 67 | + |
| 68 | + - name: Upload Playwright Report |
| 69 | + if: always() |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: reports |
| 73 | + path: playwright/reports/ |
0 commit comments