Skip to content

End-to-End Confidence in the Cloud A Walkthrough of Azure Playwright Testing (Preview)

If you’ve been using Playwright for your end-to-end testing, you know how powerful it is for browser automation. But running large test suites locally or in CI can be slow, flaky, and resource-hungry. That’s where Azure Playwright Testing (Preview) — also called Microsoft Playwright Testing — comes in.

This walkthrough will show you how to go from a plain Playwright project to running tests at scale in the Azure cloud, complete with reporting, debugging, and parallel execution.

What is Azure Playwright Testing?

Azure Playwright Testing is a managed cloud service built on top of Playwright. It takes care of the infrastructure — scaling browsers, balancing workloads, storing artifacts — so you can focus on writing tests. Key benefits include:

  • Run Playwright tests in the cloud with high parallelism.
  • Access multiple operating systems and browsers without managing environments.
  • Capture and view traces, screenshots, logs, and videos in a dedicated portal.
  • Integrate seamlessly with CI/CD pipelines for automated quality checks.

Prerequisites

Before diving in, make sure you have:

  • An Azure account with an active subscription.
  • Azure CLI installed locally or in your CI runner.
  • A Playwright project set up with tests (@playwright/test for Node.js).

Step 1: Create a Workspace in Azure

In the Azure portal, create a Playwright Testing workspace.

  • Give it a unique name.
  • Choose a subscription and region.
  • Once created, note the region-specific endpoint URL — you’ll need it later.

This workspace is your team’s entry point to the service.

Step 2: Add the Service Package to Your Project

In your Playwright project, run:

npm init @azure/microsoft-playwright-testing@latest

This sets up a playwright.service.config.ts file, which links your tests to Azure.

Step 3: Configure the Endpoint

Set the workspace endpoint URL as an environment variable. For example, in a .env file:

PLAYWRIGHT_SERVICE_URL=wss://<region>.api.playwright.microsoft.com/accounts/<workspace-id>/browsers

Step 4: Authenticate

You have two main options:

  • Azure Entra ID (recommended): Sign in with az login, and your CLI credentials will be used.
  • Access Tokens: Generate a token in the portal, then export it as an environment variable.

For local development and CI pipelines, Entra ID is typically easier and more secure.

Step 5: Tune the Service Configuration

The generated playwright.service.config.ts can be customized. Example:

import { defineConfig } from '@playwright/test';
import { getServiceConfig, ServiceOS } from '@azure/microsoft-playwright-testing';
import { AzureCliCredential } from '@azure/identity';
import baseConfig from './playwright.config';

export default defineConfig(
  baseConfig,
  getServiceConfig(baseConfig, {
    serviceAuthType: 'ENTRA_ID',
    os: ServiceOS.LINUX,
    useCloudHostedBrowsers: true,
    exposeNetwork: '<loopback>',
    timeout: 30000,
    credential: new AzureCliCredential(),
  }),
  {
    reporter: [
      ['list'],
      ['@azure/microsoft-playwright-testing/reporter', { enableGitHubSummary: true }],
    ],
  }
);

Here you can specify the OS, authentication type, timeouts, and reporters.

Step 6: Enable Artifacts

Configure Playwright to capture artifacts like traces, videos, and screenshots:

use: {
  trace: 'on-first-retry',
  video: 'retain-on-failure',
  screenshot: 'on',
}

These will show up in the Azure Playwright Testing portal after runs.

Step 7: Run Tests in the Cloud

Run your tests through the service:

npx playwright test --config=playwright.service.config.ts --workers=20

Your results will appear in the console and in the portal with detailed logs and artifacts.

Step 8: Automate in CI/CD

In GitHub Actions, Azure Pipelines, or your CI system of choice:

  1. Set environment variables (PLAYWRIGHT_SERVICE_URL, and optionally authentication tokens).
  2. Log in to Azure with federated identity or service principal.
  3. Run tests just like locally, but at cloud scale.

This ensures every pull request gets validated by real browser tests.

Step 9: Optimize & Debug

  • Adjust parallel workers for speed vs. resource usage.
  • Use the portal to debug failing tests with traces and logs.
  • Toggle features like cloud-hosted browsers or reporting in your config.

With Azure Playwright Testing, you can scale your end-to-end test suites, speed up feedback cycles, and gain rich debugging capabilities — all without managing browser infrastructure yourself.

Even though the service is currently in preview, it’s a powerful way to supercharge Playwright testing and integrate cloud-scale confidence into your development workflow.