Skip to content

Playwright Tests

Playwright Tests #3544

Workflow file for this run

name: Playwright Tests
on:
deployment_status:
workflow_dispatch:
inputs:
environment:
description: "Url to run tests against"
type: string
required: true
jobs:
test-setup:
runs-on: ubuntu-latest
defaults:
run:
working-directory: tests
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate matrix
id: set-matrix
run: |
MATRIX=$(bash helpers/listSpecFiles.sh)
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
test:
if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Preview – widget-builder' || github.event_name == 'workflow_dispatch '
timeout-minutes: 60
needs: test-setup
defaults:
run:
working-directory: tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
file: ${{ fromJson(needs.test-setup.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 8
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
run: pnpm i
- name: Install Playwright browsers
run: pnpm playwright install --with-deps
- name: Install virtual display
run: |
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
- name: Set url the tests should run on
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "BASE_URL=${{ github.event.inputs.environment }}" >> $GITHUB_ENV
elif [[ "${{ github.event_name }}" == "deployment_status" ]]; then
echo "BASE_URL=${{ github.event.deployment_status.environment_url }}" >> $GITHUB_ENV
fi
- name: Setup metamask cache
run: xvfb-run pnpm synpress wallet-setup --force
env:
WIDGET_WALLET_PRIVATE_KEY: ${{ secrets.WIDGET_WALLET_PRIVATE_KEY}}
WIDGET_WALLET_PUBLIC_KEY: "0x7c5de59A1b31e3D00279A825Cb95fAEDb09eA9FD"
# https://playwright.dev/docs/next/ci#running-headed
- name: Run Playwright tests
run: xvfb-run pnpm playwright test ${{ matrix.file }}
env:
BASE_URL: ${{ env.BASE_URL }}
WIDGET_WALLET_PUBLIC_KEY: "0x7c5de59A1b31e3D00279A825Cb95fAEDb09eA9FD"
CURRENTS_PROJECT_ID: 3TQU8o
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
CURRENTS_CI_BUILD_ID: ${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt}}
WIDGET_WALLET_PRIVATE_KEY: ${{ secrets.WIDGET_WALLET_PRIVATE_KEY}}
CI: true