Skip to content

Github Action

This example will show you how to use our pre-built Github Action to upload a test report to Gaffer.

Prerequisites

Example Code

This is a simple example of how to upload a Playwright test report to Gaffer.

gaffer-upload-action.yaml
name: Run Playwright Tests and Upload Report to Gaffer
on: push
jobs:
run-smoke-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
name: Install pnpm
- name: Install playwright deps
run: pnpm exec playwright install
- name: Run Playwright tests
run: pnpm run test
- name: Upload Playwright Report To Gaffer
# Important; be sure to check for most up-to-date version!
uses: gaffer-sh/[email protected]
# Important; we use always here to ensure that
# the report is uploaded even if the tests fail.
if: always()
with:
gaffer_api_key: ${{ secrets.GAFFER_API_KEY }}
report_path: ./playwright-report
commit_sha: ${{ commit.sha }}
branch: main
test_framework: playwright
test_suite: integration
  • Be sure to check for the most up-to-date version of the action in the Github Marketplace
  • The always() keyword is used to ensure that the report is uploaded even if the tests fail. This is useful if you want to ensure that a report is uploaded for every commit.