Skip to content

How to integrate Captain with Playwright

License

Notifications You must be signed in to change notification settings

captain-examples/playwright

Repository files navigation

Getting Captain working with Playwright

Starting from a simple workflow that runs Playwright, we want to

  1. 🧪 Ensure Playwright produces JSON output

npx playwright test --reporter=json will produce Captain-compatible JSON output. In addition, we tell playwright where to generate the results by setting the PLAYWRIGHT_JSON_OUTPUT_NAME environment variable.

PLAYWRIGHT_JSON_OUTPUT_NAME=tmp/results.json npx playwright test --reporter=json
  1. 🔐 Create an Access Token

Create an Access Token for your organization within Captain (more documentation here).

Add the new token as an action secret to your repository. Conventionally, we call this secret RWX_ACCESS_TOKEN.

  1. 💌 Install the Captain CLI, and then call it when running tests

See the full documentation on test suite integration.

  - name: Run Playwright tests
    run: |
      captain run \
        --suite-id captain-examples-playwright \
        --test-results $PLAYWRIGHT_JSON_OUTPUT_NAME \
        -- \
        npx playwright test --reporter=json
    env:
      PLAYWRIGHT_JSON_OUTPUT_NAME: tmp/results.json
      RWX_ACCESS_TOKEN: ${{ secrets.RWX_ACCESS_TOKEN }}
  1. 🎉 See your test results in Captain!

Take a look at the final workflow!

About

How to integrate Captain with Playwright

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •