Skip to content

WDIO: Single browser #62

WDIO: Single browser

WDIO: Single browser #62

name: 'WDIO: Single browser'
on:
workflow_dispatch:
inputs:
browser-target:
description: 'Which browser(s) and version(s) to target with the wdio test: chrome@latest OR chrome@* are examples'
required: true
type: string
additional-flags:
description: 'Additional flags to pass to the wdio cli'
required: false
type: string
coverage:
description: 'Enable code coverage'
required: false
type: boolean
default: false
concurrency:
description: 'The number of test runner threads to spawn for a run'
required: false
type: number
default: 10
workflow_call:
inputs:
browser-target:
description: 'Which browser(s) and version(s) to target with the wdio test: chrome@latest OR chrome@* are examples'
required: true
type: string
additional-flags:
description: 'Additional flags to pass to the wdio cli'
required: false
type: string
coverage:
description: 'Enable code coverage'
required: false
type: boolean
default: false
ref:
description: 'Github branch ref to checkout and run tests on'
required: false
type: string
concurrency:
description: 'The number of test runner threads to spawn for a run'
required: false
type: number
default: 10
secrets:
LAMBDA_USERNAME:
required: true
LAMBDA_ACCESS_KEY:
required: true
jobs:
wdio:
name: WDIO ${{ contains(inputs.additional-flags, '--webview') && 'WebView' || '' }} Test - '${{ inputs.browser-target }}'
timeout-minutes: 60
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
LAMBDA_USERNAME: ${{ secrets.LAMBDA_USERNAME }}
LAMBDA_ACCESS_KEY: ${{ secrets.LAMBDA_ACCESS_KEY }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- uses: actions/setup-node@v4
with:
node-version: 22.11.0 # See package.json for the stable node version that works with our testing. Do not change this unless you know what you are doing as some node versions do not play nicely with our testing server.
- name: Install dependencies
run: npm ci
- name: Build agent
run: |
${{ inputs.coverage && 'COVERAGE=true' || '' }} \
npm run build:all
- name: Run WDIO Tests
run: |
node --max-old-space-size=8192 ./tools/wdio/bin/cli.js \
-T \
-b '${{ inputs.browser-target }}' \
--concurrent ${{ inputs.concurrency }} \
${{ runner.debug && '-v -L -D -d' || '' }} \
${{ inputs.coverage && '--coverage' || '' }} \
${{ inputs.additional-flags || '' }}
- name: Find pull request
id: pull-request-target
if: ${{ !cancelled() && inputs.coverage }}
uses: ./.github/actions/find-pull-request
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload pr code coverage
if: ${{ !cancelled() && inputs.coverage && steps.pull-request-target.outputs.results }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
override_commit: ${{ fromJSON(steps.pull-request-target.outputs.results).head_sha }}
override_branch: refs/pull/${{ fromJSON(steps.pull-request-target.outputs.results).pr_number }}/merge
override_pr: ${{ fromJSON(steps.pull-request-target.outputs.results).pr_number }}
flags: integration-tests
verbose: true
- name: Upload branch code coverage
if: ${{ !cancelled() && inputs.coverage && !steps.pull-request-target.outputs.results }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: integration-tests
verbose: true
- name: Archive code coverage results
if: ${{ !cancelled() && inputs.coverage }}
uses: actions/upload-artifact@v4
with:
name: integration-code-coverage-report
path: coverage-e2e/
- name: Generate wdio tunnel log archive name
if: ${{ always() }}
id: wdio-tunnel-log-archive-name
run: |
browser=${{ inputs.browser-target }}
echo "results=${browser/\*/all}${{ inputs.coverage && '-coverage' || '' }}${{ contains(inputs.additional-flags, '--webview') && '-webview' || '' }}-wdio-tunnel-logs" >> "$GITHUB_OUTPUT"
- name: Archive wdio tunnel logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.wdio-tunnel-log-archive-name.outputs.results }}
path: .lambdatest