Playwright + Argos Tests #25
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: Playwright + Argos Tests | |
on: | |
# Trigger on deployment event | |
deployment_status: | |
workflow_dispatch: | |
# Trigger when a label is added to a PR | |
pull_request: | |
types: | |
- labeled | |
jobs: | |
test: | |
# Run tests only if the deployment is successful | |
if: | | |
( | |
github.event_name == 'deployment_status' && | |
github.event.deployment_status.state == 'success' | |
) || ( | |
github.event_name == 'pull_request' && | |
github.event.action == 'labeled' && | |
github.event.label.name == 'visual-test' | |
) | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Check out docs repo | |
uses: actions/checkout@v4 | |
with: | |
repository: ClickHouse/clickhouse-docs | |
path: ./ | |
# Step 2: Log url | |
- name: Log BASE_URL | |
run: echo "BASE_URL=${{ github.event.deployment_status.environment_url }}" | |
env: | |
BASE_URL: ${{ github.event.deployment_status.environment_url }} | |
- name: Configure Git safe.directory | |
run: | | |
git config --global --add safe.directory /workspace | |
# Step 3: Run Playwright tests in Docker | |
- name: Run Playwright tests | |
run: | | |
docker run --rm \ | |
-v ${{ github.workspace }}:/workspace \ | |
-w /workspace \ | |
-e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \ | |
-e BASE_URL=${{ github.event.deployment_status.environment_url }} \ | |
-e ARGOS_BRANCH="${{ github.event.deployment_status.environment == 'Production' && 'main' || github.ref_name }}" \ | |
-e CI=true \ | |
-e ARGOS_TOKEN=${{ secrets.ARGOS_TOKEN }} \ | |
mcr.microsoft.com/playwright:v1.49.1-noble \ | |
npm exec -- playwright test |