DEV Community

Shell QA
Shell QA

Posted on

Setting Up Playwright & Cucumber UI Tests in Azure DevOps with LambdaTest

Here is a step-by-step guide to configuring your Playwright/Cucumber test suite to run on LambdaTest Cloud via Azure DevOps pipelines, returning test results directly to Azure.

1. Prerequisites

  • A GitHub repository containing your Playwright, Cucumber, and JavaScript automation code.

  • An active Azure DevOps account with a project created.

  • A LambdaTest account (you will need your username and access key).

2. Connect GitHub to Azure DevOps

  • In Azure DevOps, navigate to Pipelines > New Pipeline.

  • Select GitHub as the source and authenticate your account.

  • Choose your repository and target branch (e.g., main).

3. Create LambdaTest Credentials Variable Group

  • Go to Pipelines > Library in Azure DevOps.

  • Click + Variable group and name it LambdaTest-Credentials.

  • Add the following key-value pairs:

    • LAMBDATEST_USERNAME = your_lambdatest_username
    • LAMBDATEST_ACCESS_KEY = your_lambdatest_access_key (toggle "Keep this value secret")
  • Save the group.

4. Add/Update Your azure-pipelines.yml

Place this configuration file in your repository root directory:

trigger:
- main

pool:
  vmImage: 'windows-latest'

variables:
- group: LambdaTest-Credentials
- name: BASE_URL
  value: 'https://your-app-url.com'
- name: LT_BROWSER
  value: 'chrome'
- name: ENABLE_LAMBDATEST
  value: 'true'

stages:
- stage: Test
  jobs:
  - job: UITestsLambdaTest
    displayName: 'UI Tests (LambdaTest Cloud)'
    steps:
    - task: NodeTool@0
      inputs:
        versionSpec: '20.x'
      displayName: 'Install Node.js 20.x'

    - script: npm ci
      displayName: 'Install Dependencies'

    - script: npm run test:ui:smoke
      displayName: 'Run UI Smoke Tests on LambdaTest'
      env:
        ENABLE_LAMBDATEST: 'true'
        LT_USERNAME: $(LAMBDATEST_USERNAME)
        LT_ACCESS_KEY: $(LAMBDATEST_ACCESS_KEY)
        LT_BROWSER: $(LT_BROWSER)
        BASE_URL: $(BASE_URL)

    - task: PublishTestResults@2
      condition: always()
      inputs:
        testResultsFormat: 'JUnit'
        testResultsFiles: 'reports/junit-report.xml'
        testRunTitle: 'UI Tests - LambdaTest Cloud'
Enter fullscreen mode Exit fullscreen mode

5. Update Your Test Code

Ensure your test runner reads LT_USERNAME, LT_ACCESS_KEY, and ENABLE_LAMBDATEST from environment variables. Use these parameters to connect your runner to LambdaTest's WebSocket endpoint for remote browser execution.

6. Execution and Verification

  • Commit and push your changes to GitHub.

  • The push triggers your Azure DevOps pipeline automatically.

  • View execution logs and published JUnit reports in Azure DevOps under the pipeline run, or check live and historical video logs on your LambdaTest dashboard

Top comments (0)