Run e2e tests #278
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: | | |
if [ "$RUNNER_OS" = "Linux" ]; then | |
# Mock for pcap slice opening to avoid hanging Actions Runner. | |
# See https://github.com/brimdata/zui/pull/2987 | |
echo "application/vnd.tcpdump.pcap; /usr/bin/true" >> /home/runner/.mailcap | |
/usr/bin/xvfb-run --auto-servernum -s "-screen 0 1280x1024x24" ${{ inputs.run-target }} | |
else | |
${{ inputs.run-target }} | |
fi | |
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 |