[Feat] Bridge UI Test Workflow #302
Workflow file for this run
This file contains hidden or 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: Run Bridge UI E2E Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'bridge-ui/**' | |
- '.github/workflows/bridge-ui-e2e-tests.yml' | |
- '!bridge-ui/**/*.md' | |
push: | |
branches: | |
- main | |
paths: | |
- 'bridge-ui/**' | |
- '.github/workflows/bridge-ui-e2e-tests.yml' | |
- '!bridge-ui/**/*.md' | |
jobs: | |
run-e2e-tests: | |
if: github.event.pull_request.head.repo.fork == false | |
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-med | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Use for testing workflow only | |
- uses: actions/[email protected] | |
with: | |
path: | | |
~/.npm | |
~/.cache/ms-playwright | |
~/_work/.pnpm-store/v3 | |
${{ github.workspace }}/bridge-ui/.next/cache | |
${{ github.workspace }}/bridge-ui/.cache-synpress | |
key: ${{ runner.os }}-bridge-ui-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/bridge-ui/src/**/*.js', '**/bridge-ui/src/**/*.ts', '**/bridge-ui/src/**/*.tsx') }} | |
restore-keys: | | |
${{ runner.os }}-bridge-ui-${{ hashFiles('**/pnpm-lock.yaml') }}- | |
- name: Setup nodejs environment | |
uses: ./.github/actions/setup-nodejs | |
with: | |
node-version: 20.17.0 | |
pnpm-install-options: '--frozen-lockfile --prefer-offline' | |
- name: Install Playwright | |
run: pnpm dlx [email protected] install --with-deps chromium | |
- name: Build Bridge UI | |
run: pnpm run -F bridge-ui build | |
env: | |
NEXT_PUBLIC_WALLET_CONNECT_ID: ${{ secrets.PUBLIC_WALLET_CONNECT_ID }} | |
NEXT_PUBLIC_INFURA_ID: ${{ secrets.PUBLIC_BRIDGE_UI_INFURA_ID }} | |
NEXT_PUBLIC_DYNAMIC_ENVIRONMENT_ID: ${{ secrets.PUBLIC_DYNAMIC_SANDBOX_ENVIRONMENT_ID }} | |
NEXT_PUBLIC_LIFI_API_KEY: ${{ secrets.PUBLIC_LIFI_API_KEY }} | |
- name: Install linux dependencies | |
run: | | |
sudo apt-get install --no-install-recommends -y xvfb | |
- name: Build synpress cache (cache Metamask Fixture setup for UI tests) | |
run: xvfb-run pnpm run -F bridge-ui build:cache | |
env: | |
E2E_TEST_PRIVATE_KEY: ${{ secrets.BRIDGE_UI_E2E_TESTS_PRIVATE_KEY }} | |
E2E_TEST_SEED_PHRASE: "test test test test test test test test test test test junk" | |
E2E_TEST_WALLET_PASSWORD: "TestPassword!" | |
NEXT_PUBLIC_INFURA_ID: ${{ secrets.PUBLIC_BRIDGE_UI_INFURA_ID }} | |
- name: Run unit tests | |
run: DOTENV_CONFIG_PATH=.env.production pnpm run -F bridge-ui test:unit | |
env: | |
# Can run unit tests in parallel | |
CI: "false" | |
NEXT_PUBLIC_LIFI_API_KEY: ${{ secrets.PUBLIC_LIFI_API_KEY }} | |
NEXT_PUBLIC_WALLET_CONNECT_ID: ${{ secrets.PUBLIC_WALLET_CONNECT_ID }} | |
NEXT_PUBLIC_INFURA_ID: ${{ secrets.PUBLIC_BRIDGE_UI_INFURA_ID }} | |
NEXT_PUBLIC_DYNAMIC_ENVIRONMENT_ID: ${{ secrets.PUBLIC_DYNAMIC_SANDBOX_ENVIRONMENT_ID }} | |
- name: Run E2E tests | |
run: xvfb-run pnpm run -F bridge-ui test:e2e:headful | |
env: | |
# Do not run E2E tests in parallel. Especially blockchain tx where nonces can collide. | |
CI: "true" | |
E2E_TEST_PRIVATE_KEY: ${{ secrets.BRIDGE_UI_E2E_TESTS_PRIVATE_KEY }} | |
E2E_TEST_SEED_PHRASE: "test test test test test test test test test test test junk" | |
E2E_TEST_WALLET_PASSWORD: "TestPassword!" | |
NEXT_PUBLIC_INFURA_ID: ${{ secrets.PUBLIC_BRIDGE_UI_INFURA_ID }} | |
- name: Archive Playwright report | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: playwright-report-headful | |
path: | | |
bridge-ui/playwright-report-headful/ | |
if-no-files-found: error |