azure-microsoft-playwright-testing-ts
Run Playwright tests at scale with cloud-hosted browsers and integrated Azure portal reporting.
About this skill
This skill empowers AI agents to manage and execute Playwright end-to-end browser tests efficiently and at scale. Leveraging cloud-hosted browsers within Azure, it facilitates parallel test execution, significantly reducing testing time. The integration also streamlines the reporting process by funneling detailed test results directly into the Azure portal, offering centralized analysis, monitoring, and comprehensive reporting capabilities. Designed for TypeScript environments, this skill enables agents to interact with web applications, automate complex user flows, and ensure application quality through a robust, cloud-powered testing infrastructure. Note that the original `@azure/microsoft-playwright-testing` SDK is being retired, with `@azure/playwright` as its recommended successor.
Best use case
Automating the setup and execution of large-scale end-to-end (E2E) web application tests within a CI/CD pipeline, monitoring web application functionality and performance across diverse browser environments, or generating comprehensive, cloud-integrated test reports within the Azure ecosystem.
Run Playwright tests at scale with cloud-hosted browsers and integrated Azure portal reporting.
Successful execution of automated Playwright test runs on cloud-hosted browsers, resulting in detailed test results and comprehensive reports automatically accessible within the Azure portal, providing clear insights into the stability and functionality of the tested web application.
Practical example
Example input
A request to 'Set up and run end-to-end Playwright tests for the new feature on the web application, ensuring results are reported to the Azure portal for review,' potentially including specific test file paths or desired browser configurations.
Example output
To run end-to-end tests with Azure Playwright, first ensure Node.js is installed. Then, use the following commands to set up your project:
```bash
npm init @azure/playwright@latest
# ...or manually install:
npm install @azure/playwright --save-dev
npm install @playwright/test@^1.47 --save-dev
npm install @azure/identity --save-
```
[Generated example Playwright test code in TypeScript]
Test run initiated successfully. Detailed reports will be available in the Azure portal shortly at: `https://portal.azure.com/#resource/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Playwright/Workspaces/{workspaceName}/runs/{runId}`When to use this skill
- When your project requires extensive, reliable end-to-end testing for web applications; when your test suite demands scalable, cloud-based browser infrastructure for parallel execution; when seamless integration with Azure services for centralized reporting and monitoring is beneficial; or when developing applications primarily with TypeScript.
When not to use this skill
- If your testing requirements are minimal and do not necessitate cloud scalability or deep Azure integration; if your development stack is not based on TypeScript or JavaScript; or if you are seeking a skill that provides direct, pre-packaged API calls without requiring code generation or a Node.js execution environment setup. Additionally, given the migration notice, avoid direct usage of `@azure/microsoft-playwright-testing` and instead opt for `@azure/playwright`.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/azure-microsoft-playwright-testing-ts/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How azure-microsoft-playwright-testing-ts Compares
| Feature / Agent | azure-microsoft-playwright-testing-ts | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | medium | N/A |
Frequently Asked Questions
What does this skill do?
Run Playwright tests at scale with cloud-hosted browsers and integrated Azure portal reporting.
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as medium. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
AI Agents for Marketing
Discover AI agents for marketing workflows, from SEO and content production to campaign research, outreach, and analytics.
SKILL.md Source
# 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
```bash
# 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-dev
```
**Requirements:**
- Playwright version 1.47+ (basic usage)
- Playwright version 1.57+ (Azure reporter features)
## Environment Variables
```bash
PLAYWRIGHT_SERVICE_URL=wss://eastus.api.playwright.microsoft.com/playwrightworkspaces/{workspace-id}/browsers
```
## Authentication
### Microsoft Entra ID (Recommended)
```bash
# Sign in with Azure CLI
az login
```
```typescript
// 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
```typescript
import { ManagedIdentityCredential } from "@azure/identity";
import { createAzurePlaywrightConfig } from "@azure/playwright";
export default defineConfig(
config,
createAzurePlaywrightConfig(config, {
credential: new ManagedIdentityCredential(),
})
);
```
## Core Workflow
### Service Configuration
```typescript
// 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
```bash
npx playwright test --config=playwright.service.config.ts --workers=20
```
### With Azure Reporter
```typescript
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
```typescript
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
```typescript
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
```typescript
import { ServiceOS } from "@azure/playwright";
// Available values
ServiceOS.LINUX // "linux" - default
ServiceOS.WINDOWS // "windows"
```
### ServiceAuth Enum
```typescript
import { ServiceAuth } from "@azure/playwright";
// Available values
ServiceAuth.ENTRA_ID // Recommended - uses credential
ServiceAuth.ACCESS_TOKEN // Use PLAYWRIGHT_SERVICE_ACCESS_TOKEN env var
```
## CI/CD Integration
### GitHub Actions
```yaml
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=20
```
### Azure Pipelines
```yaml
- 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: true
```
## Key Types
```typescript
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)
```typescript
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)
```typescript
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.Related Skills
k6-load-testing
Comprehensive k6 load testing skill for API, browser, and scalability testing. Write realistic load scenarios, analyze results, and integrate with CI/CD.
ai-regression-testing
AI辅助开发的回归测试策略。沙盒模式API测试,无需依赖数据库,自动化的缺陷检查工作流程,以及捕捉AI盲点的模式,其中同一模型编写和审查代码。
e2e-testing
Playwright E2E testing patterns, Page Object Model, configuration, CI/CD integration, artifact management, and flaky test strategies.
microsoft-teams-automation
Automate Microsoft Teams tasks via Rube MCP (Composio): send messages, manage channels, create meetings, handle chats, and search messages. Always search tools first for current schemas.
microsoft-azure-webjobs-extensions-authentication-events-dotnet
Microsoft Entra Authentication Events SDK for .NET. Azure Functions triggers for custom authentication extensions.
idor-testing
Provide systematic methodologies for identifying and exploiting Insecure Direct Object Reference (IDOR) vulnerabilities in web applications.
html-injection-testing
Identify and exploit HTML injection vulnerabilities that allow attackers to inject malicious HTML content into web applications. This vulnerability enables attackers to modify page appearance, create phishing pages, and steal user credentials through injected forms.
e2e-testing
End-to-end testing workflow with Playwright for browser automation, visual regression, cross-browser testing, and CI/CD integration.
cloud-penetration-testing
Conduct comprehensive security assessments of cloud infrastructure across Microsoft Azure, Amazon Web Services (AWS), and Google Cloud Platform (GCP).
burp-suite-testing
Execute comprehensive web application security testing using Burp Suite's integrated toolset, including HTTP traffic interception and modification, request analysis and replay, automated vulnerability scanning, and manual testing workflows.
bats-testing-patterns
Master Bash Automated Testing System (Bats) for comprehensive shell script testing. Use when writing tests for shell scripts, CI/CD pipelines, or requiring test-driven development of shell utilities.
azure-web-pubsub-ts
Real-time messaging with WebSocket connections and pub/sub patterns.