Skip to content

feat(test): add playwright tests #2

feat(test): add playwright tests

feat(test): add playwright tests #2

Workflow file for this run

# Security Notes
# Only selected Actions are allowed within this repository. Please refer to (https://github.com/nodejs/nodejs.org/settings/actions)
# for the full list of available actions. If you want to add a new one, please reach out a maintainer with Admin permissions.
# REVIEWERS, please always double-check security practices before merging a PR that contains Workflow changes!!
# AUTHORS, please only use actions with explicit SHA references, and avoid using `@master` or `@main` references or `@version` tags.
# MERGE QUEUE NOTE: This Workflow does not run on `merge_group` trigger, as this Workflow is not required for Merge Queue's
name: Playwright Tests
on:
pull_request:
branches:
- main
defaults:
run:
# This ensures that the working directory is the root of the repository
working-directory: ./
permissions:
contents: read
actions: read
jobs:
get-vercel-preview:
name: Get Vercel Preview
runs-on: ubuntu-latest
outputs:
deployment_found: ${{ steps.set_outputs.outputs.deployment_found }}
url: ${{ steps.set_outputs.outputs.url }}
steps:
- name: Capture Vercel Preview
id: check_deployment
uses: patrickedqvist/wait-for-vercel-preview@06c79330064b0e6ef7a2574603b62d3c98789125 # v1.3.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_timeout: 300 # timeout after 5 minutes
check_interval: 10 # check every 10 seconds
continue-on-error: true
- name: Set Outputs
if: always()
id: set_outputs
run: |
if [[ -z "${{ steps.check_deployment.outputs.url }}" ]]; then
echo "deployment_found=false" >> $GITHUB_OUTPUT
else
echo "deployment_found=true" >> $GITHUB_OUTPUT
echo "url=${{ steps.check_deployment.outputs.url }}" >> $GITHUB_OUTPUT
fi
playwright:
needs: get-vercel-preview
if: needs.get-vercel-preview.outputs.deployment_found == 'true'
name: Playwright Tests
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
with:
egress-policy: audit
- name: Git Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up pnpm
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
with:
cache: true
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
# We want to ensure that the Node.js version running here respects our supported versions
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install packages
run: pnpm install --frozen-lockfile
- name: Run Playwright tests
working-directory: apps/site
run: pnpm playwright
env:
VERCEL_PREVIEW_URL: ${{ needs.get-vercel-preview.outputs.url }}