GCast 210:
Incorporating Playwright Tests into a GitHub Action
Learn how to call Playwright automated UI tests from a GitHub Action
Here is the YAML used in this demo:
name: Playwright Tests Demo
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions: # Required when using Microsoft Entra ID to authenticate
id-token: write
contents: read
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Azure with AzPowershell (enableAzPSSession true)
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
enable-AzPSSession: true
- name: Install dependencies
run: npm ci
- name: Run Playwright tests
env:
PLAYWRIGHT_SERVICE_URL: ${{ secrets.PLAYWRIGHT_SERVICE_URL }}
run: npx playwright test -c playwright.service.config.js --workers=20 --reporter=list,html
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 10