Skip to content

Playwright Tests

Playwright Tests #20

Workflow file for this run

name: Playwright Tests
on:
workflow_run:
workflows: ['Deploy Analytics Script to Cloudflare Pages']
types: [completed]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Download deployment URL
uses: actions/download-artifact@v4
with:
name: deployment-url
path: .
run-id: ${{ github.event.workflow_run.id }}
continue-on-error: true
- name: Check deployment URL file
run: |
if [ ! -f "deployment_url.txt" ]; then
echo "Error: deployment_url.txt not found"
echo "Workflow run ID: ${{ github.event.workflow_run.id }}"
echo "Workflow run conclusion: ${{ github.event.workflow_run.conclusion }}"
exit 1
fi
echo "Deployment URL file found"
- name: Read and export deployment URL
run: |
echo "DUB_ANALYTICS_SCRIPT_URL=$(cat deployment_url.txt)/analytics/script.site-visit.outbound-domains.js" >> $GITHUB_ENV
- name: Install dependencies
run: |
pnpm install
pnpm install --filter @dub/analytics
- name: Build workspace dependencies
run: pnpm --filter @dub/analytics build
- name: Install Playwright
working-directory: apps/nextjs
run: pnpm add -D @playwright/test
- name: Install Playwright Browsers
working-directory: apps/nextjs
run: pnpm exec playwright install chromium --with-deps
- name: Run Playwright tests
working-directory: apps/nextjs
run: pnpm exec playwright test
env:
DUB_ANALYTICS_SCRIPT_URL: $DUB_ANALYTICS_SCRIPT_URL