Skip to content

Playwright Tests

Playwright Tests #166

Workflow file for this run

name: Playwright Tests
on:
workflow_dispatch:
inputs:
vercel_url:
description: 'Optional Vercel preview URL (skip Vercel deployment if provided)'
required: false
type: string
jobs:
Build:
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
outputs:
preview_url: ${{ steps.preview-url.outputs.url }}
steps:
- name: Checkout repo
uses: actions/checkout@v7
- name: Setup pnpm
uses: pnpm/action-setup@v6
- name: Setting up Node.js
uses: actions/setup-node@v7
with:
node-version: '24'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Pull environment variables
run: pnpm vercel env pull .env --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Preview (Vercel)
if: ${{ !inputs.vercel_url }}
uses: amondnet/vercel-action@v42
id: vercel-action
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}}
github-comment: false
- name: Set preview URL
id: preview-url
env:
VERCEL_INPUT: ${{ inputs.vercel_url }}
VERCEL_OUTPUT: ${{ steps.vercel-action.outputs.preview-url }}
run: echo "url=${VERCEL_INPUT:-$VERCEL_OUTPUT}" >> "$GITHUB_OUTPUT"
- name: Point extension at the preview deployment
run: sed -i "s#^NEXT_PUBLIC_HOST_NAME=.*#NEXT_PUBLIC_HOST_NAME=${{ steps.preview-url.outputs.url }}#" .env
- name: Building extension
run: pnpm build --filter=@bypass/extension
- name: Uploading Chrome extension
uses: actions/upload-artifact@v7
with:
name: chrome-extension-folder
path: ./apps/extension/.output/chrome-mv3
Playwright:
needs: [Build]
timeout-minutes: 10
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
steps:
- name: Checkout repo
uses: actions/checkout@v7
- name: Setup pnpm
uses: pnpm/action-setup@v6
- name: Setting up Node.js
uses: actions/setup-node@v7
with:
node-version: '24'
cache: 'pnpm'
- name: Cache playwright binaries
uses: actions/cache@v6
id: playwright-cache
with:
path: |
~/Library/Caches/ms-playwright
~/.cache/ms-playwright
${{ github.workspace }}/node_modules/playwright
key: cache-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: cache-playwright-
- name: Download Chrome extension
uses: actions/download-artifact@v8
with:
name: chrome-extension-folder
path: ./apps/extension/.output/chrome-mv3/
- name: Install dependencies
run: pnpm install
- name: Pull environment variables
run: pnpm vercel env pull .env --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Install Playwright Browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: pnpm playwright install --with-deps
- name: Run Playwright tests
run: pnpm e2e
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ needs.Build.outputs.preview_url }}
- uses: actions/upload-artifact@v7
if: always()
with:
name: playwright-report
path: |
.playwright/playwright-report/
.playwright/test-results/
include-hidden-files: true
if-no-files-found: ignore