87 / 168 · 01 Agent Skills for Browser Automation · CI/CD Integration for AI-Driven Browser Tests← prev⊞ allnext →☰ Read as one page
12.2GitHub Actions Configuration
Basic Setup
name: Browser Tests
on: [push, pull_request]
jobs:
browser-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24'
- name: Install Playwright CLI
run: |
npm install -g @playwright/cli@latest
playwright-cli install # initialize the .playwright-cli/ workspace
- name: Install browsers + system dependencies
run: npx playwright install --with-deps chromium
- name: Smoke test
run: |
playwright-cli open https://staging.example.com
playwright-cli eval "document.querySelector('h1').textContent" | grep -q "Welcome"
playwright-cli close
- name: Upload failure artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-failures
path: failures/
Two things changed from the 2025-era setups worth noticing: browser and system dependencies come from Playwright's own installer (npx playwright install --with-deps) instead of a hand-maintained apt-get list of Chrome libraries, and there are no tool-specific environment variables — session lifecycle is explicit in the commands.
Full Test Suite
name: Full Test Suite
on:
push:
branches: [main]
pull_request:
jobs:
browser-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
test-group: [auth, dashboard, checkout, settings]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24'
- name: Install dependencies
run: |
npm install -g @playwright/cli@latest
playwright-cli install
npx playwright install --with-deps chromium
- name: Run ${{ matrix.test-group }} tests
env:
TEST_BASE_URL: ${{ secrets.STAGING_URL }}
run: ./run-tests.sh ${{ matrix.test-group }}
- name: Upload screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: screenshots-${{ matrix.test-group }}
path: screenshots/
- name: Upload failure details
if: failure()
uses: actions/upload-artifact@v4
with:
name: failures-${{ matrix.test-group }}
path: failures/