azure-microsoft-playwright-testing-ts – DevOps & Infrastructure skill for AI agents
Run Playwright tests at scale with cloud-hosted browsers and integrated Azure portal reporting.
Install the azure-microsoft-playwright-testing-ts skill with one command
Pick the tool you use, copy the command and paste it in your terminal. The skill lands in that tool's skills folder and is ready in your next session.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-microsoft-playwright-testing-ts-52034.tgz | tar xz -C ~/.claude/skills
Call it in Claude Code: /azure-microsoft-playwright-testing-ts – then describe the task you want done.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-microsoft-playwright-testing-ts-52034.tgz | tar xz -C ~/.codex/skills
Call it in Codex: $azure-microsoft-playwright-testing-ts – then describe the task you want done.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-microsoft-playwright-testing-ts-52034.tgz | tar xz -C ~/.hermes/skills
Call it in Hermes Agent: /azure-microsoft-playwright-testing-ts – then describe the task you want done.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-microsoft-playwright-testing-ts-52034.tgz | tar xz -C ~/.deepcode/skills
Call it in DeepSeek: /azure-microsoft-playwright-testing-ts – then describe the task you want done.
SKILL.md content
Azure Playwright Workspaces SDK for TypeScript
Run Playwright tests at scale with cloud-hosted browsers and integrated Azure portal reporting.
> Migration Notice: @azure/microsoft-playwright-testing is retired on March 8, 2026. Use @azure/playwright instead. See [migration guide](https://aka.ms/mpt/migration-guidance).
Installation
# Recommended: Auto-generates config
npm init @azure/playwright@latest
# Manual installation
npm install @azure/playwright --save-dev
npm install @playwright/test@^1.47 --save-dev
npm install @azure/identity --save-devRequirements:
- Playwright version 1.47+ (basic usage)
- Playwright version 1.57+ (Azure reporter features)
Environment Variables
PLAYWRIGHT_SERVICE_URL=wss://eastus.api.playwright.microsoft.com/playwrightworkspaces/{workspace-id}/browsersAuthentication
Microsoft Entra ID (Recommended)
# Sign in with Azure CLI
az login// playwright.service.config.ts
import { defineConfig } from "@playwright/test";
import { createAzurePlaywrightConfig, ServiceOS } from "@azure/playwright";
import { DefaultAzureCredential } from "@azure/identity";
import config from "./playwright.config";
export default defineConfig(
config,
createAzurePlaywrightConfig(config, {
os: ServiceOS.LINUX,
credential: new DefaultAzureCredential(),
})
);Custom Credential
import { ManagedIdentityCredential } from "@azure/identity";
import { createAzurePlaywrightConfig } from "@azure/playwright";
export default defineConfig(
config,
createAzurePlaywrightConfig(config, {
credential: new ManagedIdentityCredential(),
})
);Core Workflow
Service Configuration
// playwright.service.config.ts
import { defineConfig } from "@playwright/test";
import { createAzurePlaywrightConfig, ServiceOS } from "@azure/playwright";
import { DefaultAzureCredential } from "@azure/identity";
import config from "./playwright.config";
export default defineConfig(
config,
createAzurePlaywrightConfig(config, {
os: ServiceOS.LINUX,
connectTimeout: 30000,
exposeNetwork: "<loopback>",
credential: new DefaultAzureCredential(),
})
);Run Tests
npx playwright test --config=playwright.service.config.ts --workers=20With Azure Reporter
import { defineConfig } from "@playwright/test";
import { createAzurePlaywrightConfig, ServiceOS } from "@azure/playwright";
import { DefaultAzureCredential } from "@azure/identity";
import config from "./playwright.config";
export default defineConfig(
config,
createAzurePlaywrightConfig(config, {
os: ServiceOS.LINUX,
credential: new DefaultAzureCredential(),
}),
{
reporter: [
["html", { open: "never" }],
["@azure/playwright/reporter"],
],
}
);Manual Browser Connection
import playwright, { test, expect, BrowserType } from "@playwright/test";
import { getConnectOptions } from "@azure/playwright";
test("manual connection", async ({ browserName }) => {
const { wsEndpoint, options } = await getConnectOptions();
const browser = await (playwright[browserName] as BrowserType).connect(wsEndpoint, options);
const context = await browser.newContext();
const page = await context.newPage();
await page.goto("https://example.com");
await expect(page).toHaveTitle(/Example/);
await browser.close();
});Configuration Options
type PlaywrightServiceAdditionalOptions = {
serviceAuthType?: "ENTRA_ID" | "ACCESS_TOKEN"; // Default: ENTRA_ID
os?: "linux" | "windows"; // Default: linux
runName?: string; // Custom run name for portal
connectTimeout?: number; // Default: 30000ms
exposeNetwork?: string; // Default: <loopback>
credential?: TokenCredential; // REQUIRED for Entra ID
};ServiceOS Enum
import { ServiceOS } from "@azure/playwright";
// Available values
ServiceOS.LINUX // "linux" - default
ServiceOS.WINDOWS // "windows"ServiceAuth Enum
import { ServiceAuth } from "@azure/playwright";
// Available values
ServiceAuth.ENTRA_ID // Recommended - uses credential
ServiceAuth.ACCESS_TOKEN // Use PLAYWRIGHT_SERVICE_ACCESS_TOKEN env varCI/CD Integration
GitHub Actions
name: playwright-ts
on: [push, pull_request]
permissions:
id-token: write
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- run: npm ci
- name: Run Tests
env:
PLAYWRIGHT_SERVICE_URL: ${{ secrets.PLAYWRIGHT_SERVICE_URL }}
run: npx playwright test -c playwright.service.config.ts --workers=20Azure Pipelines
- task: AzureCLI@2
displayName: Run Playwright Tests
env:
PLAYWRIGHT_SERVICE_URL: $(PLAYWRIGHT_SERVICE_URL)
inputs:
azureSubscription: My_Service_Connection
scriptType: pscore
inlineScript: |
npx playwright test -c playwright.service.config.ts --workers=20
addSpnToEnvironment: trueKey Types
import {
createAzurePlaywrightConfig,
getConnectOptions,
ServiceOS,
ServiceAuth,
ServiceEnvironmentVariable,
} from "@azure/playwright";
import type {
OsType,
AuthenticationType,
BrowserConnectOptions,
PlaywrightServiceAdditionalOptions,
} from "@azure/playwright";Migration from Old Package
| Old (@azure/microsoft-playwright-testing) | New (@azure/playwright) |
|---------------------------------------------|---------------------------|
| getServiceConfig() | createAzurePlaywrightConfig() |
| timeout option | connectTimeout option |
| runId option | runName option |
| useCloudHostedBrowsers option | Removed (always enabled) |
| @azure/microsoft-playwright-testing/reporter | @azure/playwright/reporter |
| Implicit credential | Explicit credential parameter |
Before (Old)
import { getServiceConfig, ServiceOS } from "@azure/microsoft-playwright-testing";
export default defineConfig(
config,
getServiceConfig(config, {
os: ServiceOS.LINUX,
timeout: 30000,
useCloudHostedBrowsers: true,
}),
{
reporter: [["@azure/microsoft-playwright-testing/reporter"]],
}
);After (New)
import { createAzurePlaywrightConfig, ServiceOS } from "@azure/playwright";
import { DefaultAzureCredential } from "@azure/identity";
export default defineConfig(
config,
createAzurePlaywrightConfig(config, {
os: ServiceOS.LINUX,
connectTimeout: 30000,
credential: new DefaultAzureCredential(),
}),
{
reporter: [
["html", { open: "never" }],
["@azure/playwright/reporter"],
],
}
);Best Practices
1. Use Entra ID auth — More secure than access tokens
2. Provide explicit credential — Always pass credential: new DefaultAzureCredential()
3. Enable artifacts — Set trace: "on-first-retry", video: "retain-on-failure" in config
4. Scale workers — Use --workers=20 or higher for parallel execution
5. Region selection — Choose region closest to your test targets
6. HTML reporter first — When using Azure reporter, list HTML reporter before Azure reporter
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Remote browsers may reach endpoints exposed through exposeNetwork and can upload traces/screenshots containing secrets. Scope the staging hosts, test credentials, artifact retention and worker/cost budget before connecting; loopback access is a network capability, not isolation. Never expose cloud credentials to untrusted fork code or run production writes from these tests.
Related skills
- azure-monitor-audit – Configure Azure Monitor and Activity Log for auditing. Set up diagnostic settings and…
- azure-monitor-ingestion-java – Azure Monitor Ingestion SDK for Java. Send custom logs to Azure Monitor via Data…
- azure-monitor-ingestion-py – Azure Monitor Ingestion SDK for Python. Use for sending custom logs to Log Analytics…
- azure-monitor-opentelemetry-exporter-java – Azure Monitor OpenTelemetry Exporter for Java. Export OpenTelemetry traces, metrics, and…
- azure-monitor-opentelemetry-exporter-py – Azure Monitor OpenTelemetry Exporter for Python. Use for low-level OpenTelemetry export…
- azure-monitor-opentelemetry-py – Azure Monitor OpenTelemetry Distro for Python. Use for one-line Application Insights…
- azure-monitor-opentelemetry-ts – Auto-instrument Node.js applications with distributed tracing, metrics, and logs.
- azure-monitor-query-java – Azure Monitor Query SDK for Java. Execute Kusto queries against Log Analytics workspaces…