Skip to content

web ui: test with playwright #6969

web ui: test with playwright

web ui: test with playwright #6969

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Test
# Controls when the action will run. Triggers the workflow push is only on main branch and PR on any branch.
on:
push:
branches:
- main
tags:
- "*"
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test-web-ui:
name: 'Test on ${{ matrix.project }} (${{ matrix.shardIndex }}/${{ matrix.shardTotal }})'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.44.0-jammy
strategy:
fail-fast: false
matrix:
project: [chromium, firefox, webkit]
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
timeout-minutes: 60
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Prefer IPv4
run: echo "precedence ::ffff:0:0/96 100" | tee -a /etc/gai.conf
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Run mock hub API
uses: JarvusInnovations/background-action@v1
with:
run: |
npm install -g husky
npm install
npm start &> mock-hub-api.log &
working-directory: ./http-gateway/web/packages/mock-server
wait-on: tcp:localhost:8181
wait-for: 30s
- name: Run UI server
uses: JarvusInnovations/background-action@v1
with:
run: |
npm install
npm run :generate:theme
REACT_APP_MOCK_BASE_URL=http://localhost:8181 REACT_APP_MOCK_API="true" npm run start &> ui.log &
working-directory: ./http-gateway/web
wait-for: 5m
wait-on: |
http://localhost:3000
tcp:localhost:8181
- name: Run playwright tests
run: |
cd ./http-gateway/web/playwright
npm install
npx playwright install ${{ matrix.project }} --with-deps ${{ matrix.project }}
echo "starting test"
REACT_APP_HTTP_WELL_KNOW_CONFIGURATION_ADDRESS=https://try.plgd.cloud REACT_APP_TEST_LOGIN_USERNAME="$PLAYWRIGHT_USERNAME" REACT_APP_TEST_LOGIN_PASSWORD="$PLAYWRIGHT_PASSWORD" xvfb-run npx playwright test --project=${{ matrix.project }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} dev.spec.ts
cd ../../../
- name: OnFailure
if: failure()
run: |
echo "--- mock-hub-api.log ---"
cat ./http-gateway/web/packages/mock-server/mock-hub-api.log
echo "--- ui.log ---"
cat ./http-gateway/web/ui.log
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-${{ matrix.project }}-${{ matrix.shardIndex }}
path: http-gateway/web/playwright/playwright-report
retention-days: 5