Run e2e tests #232
Workflow file for this run
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: Run e2e tests | |
on: | |
workflow_dispatch: | |
inputs: | |
run-target: | |
description: Command line for running e2e tests | |
default: 'yarn e2e:ci' | |
required: true | |
platforms: | |
description: OS platforms to test on (list of strings in JSON format)" | |
default: '["ubuntu-20.04"]' | |
required: true | |
video: | |
description: Whether to record videos of Playwright test runs | |
type: choice | |
default: 'true' | |
options: | |
- 'true' | |
- 'false' | |
required: true | |
debug: | |
description: Playwright debug logging | |
type: choice | |
options: | |
- 'pw:api' | |
- '' | |
always-upload: | |
description: Always upload artifacts even if tests don't fail? | |
type: boolean | |
required: false | |
jobs: | |
run-e2e-tests: | |
name: Run e2e tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ${{ fromJSON(inputs.platforms) }} | |
steps: | |
- name: Output inputs | |
run: echo "${{ toJSON(inputs) }}" | |
shell: sh | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/setup-zui | |
- name: Install dependencies (Linux) | |
if: startsWith(matrix.os, 'ubuntu-') | |
run: sudo apt-get -y install whois | |
- name: Install dependencies (Windows) | |
if: startsWith(matrix.os, 'windows-') | |
run: choco install -y --no-progress whois | |
- run: yarn lint | |
- run: yarn test | |
- run: yarn build | |
- name: End to end tests | |
id: playwright | |
run: | | |
num=1 | |
success=0 | |
fail=0 | |
while [ $num -le 100 ]; do | |
if [ "$RUNNER_OS" = "Linux" ]; then | |
command='/usr/bin/xvfb-run --auto-servernum -s "-screen 0 1280x1024x24" ${{ inputs.run-target }}' | |
else | |
command='${{ inputs.run-target }}' | |
fi | |
echo "Command = $command" | |
$command || case $? in | |
1) | |
fail=$(expr $fail + 1) | |
;; | |
*) | |
success=$(expr $success + 1) | |
;; | |
esac | |
num=$(expr $num + 1) | |
echo "success=$success fail=$fail" | |
done | |
env: | |
VIDEO: ${{ inputs.video }} | |
DEBUG: ${{ inputs.debug }} | |
shell: sh | |
- name: Put system logs alongside other artifacts | |
run: | | |
mkdir -p packages/zui-player/run/var_log | |
cp /var/log/sys*log* /var/log/kern.log* packages/zui-player/run/var_log || true | |
shell: sh | |
- uses: actions/upload-artifact@v2 | |
if: (failure() && steps.playwright.outcome == 'failure') || inputs.always-upload | |
with: | |
name: artifacts-${{ matrix.os }} | |
path: | | |
packages/zui-player/run/** | |
packages/zui-player/test-results |