Playwright - Azure DevOps

Running Playwright test in parallel on Azure DevOps and Currents Dashboard

Currents can use the native Playwright Sharding to split the tests between multiple containers. The results from distributed runs will be collected together with the generated artifacts to provide insights into test suite performance.

The example repository using 3 Azure DevOps containers to allow parallel execution of the test using Currents as a reporting service.

  • Connect a new/existing Azure Pipeline to a repository containing your Playwright tests.

  • Create an organization, get your Record Key and Project Id at

  • Create or modify an existing Variable Group, and add a new secret variable called CURRENTS_RECORD_KEY with your Record Key.

  • Include your Project Id in an env variable called CURRENTS_PROJECT_ID in your pipeline configuration.

  • Ensure the @current/playwright package has been integrated into your tests.

  • Modify your azure-pipelines.yml file to run the tests and use one of the example pipeline files as a reference.

Here's an example pipeline file:

- main

- job: pwcTests
  displayName: Playwright Tests - pwc
        project: chromium
        shard: 1/3
        project: chromium
        shard: 2/3
        project: chromium
        shard: 3/3
    vmImage: ubuntu-latest

  # If you choose to not use the playwright container, you will also need to npx install playwright in your steps
  - name: npm_config_cache
    value: $(Pipeline.Workspace)/.npm

  # You can use a variable group to store the CURRENTS_RECORD_KEY secret
  - group: currents-settings
  - task: NodeTool@0
    displayName: 'Install NodeJS'
      versionSpec: '18'

  # Speed up the execution by caching the dependencies
  - task: Cache@2
      key: 'npm | "$(Agent.OS)" | package-lock.json'
      restoreKeys: |
         npm | "$(Agent.OS)"
      path: $(npm_config_cache)
    displayName: Cache npm

  # Install Node dependencies
  - script: npm ci
    displayName: 'Install Dependencies'

  # Use pwc as the currents wrapper for playwright test
  # Replace the CURRENTS_PROJECT_ID value with your own from
  - script: npx pwc --shard=$(shard)
    workingDirectory: '$(build.sourcesdirectory)/basic'
    displayName: 'Run Basic Tests'
      CI: 'true'

Pipeline executions will be recorded and available in the Currents Dashboard, and test results and artifacts will be automatically uploaded.

Here's an example of how the demo workflow appears in the Currents dashboard

Last updated