Playwright Tests #3369
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright Tests | |
on: | |
deployment_status: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: "Url to run tests against" | |
type: string | |
required: true | |
jobs: | |
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 | |
defaults: | |
run: | |
working-directory: tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
file: [builderCommon, builderExportTab, builderGatingTab, builderJSONEditor, builderProductsTab, builderStylingTab,builderPaymentTab, widgetConfigurationTests, widgetMetamaskStreamTransactions,widgetMetamaskTokenTransactions, widgetMetamaskUITests, widgetMetamaskValidationErrors , widgetNoWallet] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Setup Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.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 | |
# https://playwright.dev/docs/next/ci#running-headed | |
- name: Run Playwright tests | |
run: xvfb-run pnpm playwright test ${{ matrix.file }}.spec.ts | |
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 |