I have some automation using Playwright Node where I need the video to load/play. I read that the typical Chromium does not have the right media codec to play a video so you need real Chrome. I changed my playwright config to now pull the executable path for real Chrome and got it all working locally but when I run it in Github Servers for a pipeline, it isn’t working. I am using a mac server in Github macos-latest-xlarge
I tried various installation tactics in my github YML:
- run: |
npx playwright install
npx playwright install chrome
- run: |
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install
npx playwright install chrome
Also tried a setup-chrome github actions
- uses: browser-actions/setup-chrome@v1
- run: chrome --version
Here is my full YML:
name: Run Automation On Demand
on:
workflow_dispatch:
inputs:
URL:
description: 'Which dashboard url do you want to run this on?'
required: true
default: 'xxxx'
APIURL:
description: 'Which API url do you want to run this on?'
required: true
default: 'xxxx'
choice:
type: choice
description: Which suite do you want to run?
options:
- ' '
- All Tests
- All UI
- All API
- APIKeys
- Auth
- BotLibrary
- Bots
- Config
- CustomFields
- DELETE
- Export
- Filter
- FNOL
- GET
- HIL
- HumanInTheLoop
- Impersonate
- InspectionAnalyst
- Login
- Notes
- OrganizationGroups
- Organizations
- PATCH
- pin
- POST
- ReportDetails
- Reports
- Roles
- Search
- 'SystemAdministrator'
- Upload
DeleteOldData:
description: 'Clean automation organization in the stage env? (DO NOT CHECK IF: Automation is being ran by PRs or on-demand)'
type: boolean
required: false
default: false
jobs:
job-delete-data:
if: ${{ github.event.inputs.DeleteOldData == 'true' }}
runs-on: macos-latest-xlarge
strategy:
matrix:
node-version: [21.7.3]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- run: npx playwright install chromium
- name: GCP Authentication
id: GCPAuth
uses: 'google-github-actions/auth@v2'
with:
project_id: 'xxxx'
service_account: 'xxxxxx'
credentials_json: '${{ secrets.KEY_PIPELINE_JSON }}'
- name: If Prod URL, Cannot Run
if: ${{contains(github.event.inputs.URL, 'xxxx') }}
run: |
echo "Cannot run on Prod currently"
exit 1
- name: Delete old data
if: ${{ github.event.inputs.DeleteOldData == 'true' }}
run: npx playwright test delete.teardown.spec.ts
job-run-all:
if: ${{ always() && github.event.inputs.choice == 'All Tests' }}
needs: job-delete-data
runs-on: macos-latest-xlarge
strategy:
matrix:
node-version: [21.7.3]
automation-type: [{"name": "UI", "command": "URL=${{ github.event.inputs.URL }} npx playwright test playwright/dashboard --workers=8"}, {"name": "API", "command": "npx playwright test playwright/api --workers=20"}]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- run: |
npx playwright install
npx playwright install chrome
- name: GCP Authentication
id: GCPAuth
uses: 'google-github-actions/auth@v2'
with:
project_id: 'xxxx'
service_account: 'xxxxx'
credentials_json: '${{ secrets.KEY_PIPELINE_JSON }}'
- name: If Prod URL, Cannot Run
if: ${{contains(github.event.inputs.URL, 'xxxxx') }}
run: |
echo "Cannot run on Prod currently"
exit 1
- name: If All Tests, Run All Playwright Tests in Parallel
if: ${{ github.event.inputs.choice == 'All Tests' }}
run: ${{ matrix.automation-type.command }}
- name: Run Slack Notification
if: always()
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }} # required
notify_when: 'failure'
message_format: '{emoji} {workflow} {status_message} | <{run_url}|View Failed Run From Stage>'
env:
SLACK_WEBHOOK_URL: '${{secrets.SLACK_WEBHOOK}}'
- name: Upload report
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report-${{matrix.automation-type.name}}
path: 'playwright-report/'
retention-days: 30
- uses: actions/upload-artifact@v3
if: always()
with:
name: failed-videos
path: test-results/**/video.webm
retention-days: 30
job-run-suite:
needs: job-delete-data
if: ${{ always() && github.event.inputs.choice != 'All Tests' }}
runs-on: macos-latest-xlarge
strategy:
matrix:
node-version: [21.7.3]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- run: |
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install
npx playwright install chrome
- name: GCP Authentication
id: GCPAuth
uses: 'google-github-actions/auth@v2'
with:
project_id: 'xxxx'
service_account: 'xxxxx'
credentials_json: '${{ secrets.KEY_PIPELINE_JSON }}'
- name: If Prod URL, Cannot Run
if: ${{contains(github.event.inputs.URL, 'xxxx') }}
run: |
echo "Cannot run on Prod currently"
exit 1
- name: If DEV URL, Can Only Run APIS
if: ${{contains(github.event.inputs.URL, 'xxxx') && github.event.inputs.choice != 'All API' }}
run: |
echo "Cannot run on DEV on anything besides APIs, you inputted ${{github.event.inputs.choice}}"
exit 1
- name: If Suite Specific, Run Just Selected Suite
if: ${{ github.event.inputs.choice != 'All Tests' && github.event.inputs.choice != 'All UI' && github.event.inputs.choice != 'All API' && github.event.inputs.choice != ' ' }}
run: URL=${{ github.event.inputs.URL }} npx playwright test --workers=8 --grep @${{ github.event.inputs.choice }}
- name: If All UI, Run All Playwright UI Tests
if: ${{ github.event.inputs.choice == 'All UI' }}
run: URL=${{ github.event.inputs.URL }} npx playwright test playwright/dashboard --workers=8
- name: If All API, Run All Playwright API Tests
if: ${{ github.event.inputs.choice == 'All API' }}
run: APIURL=${{ github.event.inputs.APIURL }} npx playwright test playwright/api --workers=20
- name: Upload report
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: 'playwright-report/'
retention-days: 30
- uses: actions/upload-artifact@v3
if: always()
with:
name: failed-videos
path: test-results/**/video.webm
retention-days: 30
And nothing seems to work. What can I do?