Skip to content

feat(advanced): PER-8195 — advanced example for @percy/selenium-webdriver #28

feat(advanced): PER-8195 — advanced example for @percy/selenium-webdriver

feat(advanced): PER-8195 — advanced example for @percy/selenium-webdriver #28

Workflow file for this run

name: Tests
# PER-8195: explicitly use `pull_request` only. `pull_request_target` is
# forbidden — it checks out attacker-controlled code with full secret access.
on: [push, pull_request]
jobs:
basic:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v1
with:
node-version: 14
- uses: actions/cache@v3
with:
path: ~/.npm
key: v1/${{ runner.os }}/node-14/${{ hashFiles('**/package-lock.lock') }}
restore-keys: v1/${{ runner.os }}/node-14/
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
advanced:
# PER-8195 advanced example. Runs in --testing mode so PR builds (including
# forks and Dependabot) don't require a real PERCY_TOKEN. The `--testing`
# flag is only valid on `percy exec` (not `exec:start`).
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: advanced
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install jq + yq
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq jq
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
- name: Install advanced/ dependencies
run: npm install
- name: Fetch shared advanced-snapshot assertion helper
# TODO(PER-8195 D8): pin to a tagged commit once percy-public-repos-parent
# publishes the scripts/ dir to a stable URL or to an npm package.
run: |
curl -fsSL -o /tmp/assert-advanced-snapshots.sh \
https://raw.githubusercontent.com/percy/percy-public-repos-parent/main/scripts/assert-advanced-snapshots.sh
chmod +x /tmp/assert-advanced-snapshots.sh
- name: Run mocha advanced tests (--testing) + capture /test/requests
env:
PERCY_TOKEN: fake_token
run: |
npx --no-install percy exec --testing -- bash -c '
npx --no-install mocha tests/ --exit
ec=$?
curl -fsS http://localhost:5338/test/requests > advanced-requests.json || true
exit $ec
'
- name: Assert matrix-row coverage
env:
PERCY_REQUESTS_FILE: ${{ github.workspace }}/advanced/advanced-requests.json
run: /tmp/assert-advanced-snapshots.sh ./matrix.yml