Skip to content

test: add end-to-end tests with Playwright #25

test: add end-to-end tests with Playwright

test: add end-to-end tests with Playwright #25

Workflow file for this run

---
name: Acceptance Test
on:
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [cpp]
steps:
- uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v9.0.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 20
- run: npm ci
- run: npx playwright install --with-deps
# Create a GitHub Codespace and communicate the image version via a Codespace secret (should be a Codespace environment variable).
# This secret is used by devcontainer.json, as such it is a resource that should not be used concurrently.
- run: |
set -Eeuo pipefail
gh secret set -a codespaces IMAGE_VERSION --body "pr-${{ github.event.pull_request.number }}"
echo CODESPACE_NAME="$(gh codespace create -R "${{ github.repository }}" -b "$HEAD_REF" -m basicLinux32gb --devcontainer-path ".devcontainer/${{ matrix.flavor }}-test/devcontainer.json" --idle-timeout 10m --retention-period 1h)" >> "$GITHUB_ENV"
env:
GH_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }}
HEAD_REF: ${{ github.head_ref }}
- run: cd .devcontainer/${{ matrix.flavor }}/e2e && npm test
env:
GITHUB_USER: ${{ secrets.TEST_GITHUB_USER }}
GITHUB_PASSWORD: ${{ secrets.TEST_GITHUB_PASSWORD }}
GITHUB_TOTP_SECRET: ${{ secrets.TEST_GITHUB_TOTP_SECRET }}
- run: gh codespace delete --force --codespace "$CODESPACE_NAME"
if: always()
env:
GH_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }}