{
  "schema": "https://ai-atoms.com/schemas/skill-v1.json",
  "type": "skill",
  "id": "skill/azure-microsoft-playwright-testing-ts",
  "version": "1.0.0",
  "name": "Azure Microsoft Playwright Testing Ts",
  "description": "Run Playwright tests at scale using Azure Playwright Workspaces (formerly Microsoft Playwright Testing). Use when scaling browser tests across cloud-hosted browsers, integrating with CI/CD pipeline...",
  "system_prompt_fragment": "# Azure Playwright Workspaces SDK for TypeScript\n\nRun Playwright tests at scale with cloud-hosted browsers and integrated Azure portal reporting.\n\n> **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).\n\n## Installation\n\n```bash\n# Recommended: Auto-generates config\nnpm init @azure/playwright@latest\n\n# Manual installation\nnpm install @azure/playwright --save-dev\nnpm install @playwright/test@^1.47 --save-dev\nnpm install @azure/identity --save-dev\n```\n\n**Requirements:**\n- Playwright version 1.47+ (basic usage)\n- Playwright version 1.57+ (Azure reporter features)\n\n## Environment Variables\n\n```bash\nPLAYWRIGHT_SERVICE_URL=wss://eastus.api.playwright.microsoft.com/playwrightworkspaces/{workspace-id}/browsers\n```\n\n## Authentication\n\n### Microsoft Entra ID (Recommended)\n\n```bash\n# Sign in with Azure CLI\naz login\n```\n\n```typescript\n// playwright.service.config.ts\nimport { defineConfig } from \"@playwright/test\";\nimport { createAzurePlaywrightConfig, ServiceOS } from \"@azure/playwright\";\nimport { DefaultAzureCredential } from \"@azure/identity\";\nimport config from \"./playwright.config\";\n\nexport default defineConfig(\n  config,\n  createAzurePlaywrightConfig(config, {\n    os: ServiceOS.LINUX,\n    credential: new DefaultAzureCredential(),\n  })\n);\n```\n\n### Custom Credential\n\n```typescript\nimport { ManagedIdentityCredential } from \"@azure/identity\";\nimport { createAzurePlaywrightConfig } from \"@azure/playwright\";\n\nexport default defineConfig(\n  config,\n  createAzurePlaywrightConfig(config, {\n    credential: new ManagedIdentityCredential(),\n  })\n);\n```\n\n## Core Workflow\n\n### Service Configuration\n\n```typescript\n// playwright.service.config.ts\nimport { defineConfig } from \"@playwright/test\";\nimport { createAzurePlaywrightConfig, ServiceOS } from \"@azure/playwright\";\nimport { DefaultAzureCredential } from \"@azure/identity\";\nimport config from \"./playwright.config\";\n\nexport default defineConfig(\n  config,\n  createAzurePlaywrightConfig(config, {\n    os: ServiceOS.LINUX,\n    connectTimeout: 30000,\n    exposeNetwork: \"<loopback>\",\n    credential: new DefaultAzureCredential(),\n  })\n);\n```\n\n### Run Tests\n\n```bash\nnpx playwright test --config=playwright.service.config.ts --workers=20\n```\n\n### With Azure Reporter\n\n```typescript\nimport { defineConfig } from \"@playwright/test\";\nimport { createAzurePlaywrightConfig, ServiceOS } from \"@azure/playwright\";\nimport { DefaultAzureCredential } from \"@azure/identity\";\nimport config from \"./playwright.config\";\n\nexport default defineConfig(\n  config,\n  createAzurePlaywrightConfig(config, {\n    os: ServiceOS.LINUX,\n    credential: new DefaultAzureCredential(),\n  }),\n  {\n    reporter: [\n      [\"html\", { open: \"never\" }],\n      [\"@azure/playwright/reporter\"],\n    ],\n  }\n);\n```\n\n### Manual Browser Connection\n\n```typescript\nimport playwright, { test, expect, BrowserType } from \"@playwright/test\";\nimport { getConnectOptions } from \"@azure/playwright\";\n\ntest(\"manual connection\", async ({ browserName }) => {\n  const { wsEndpoint, options } = await getConnectOptions();\n  const browser = await (playwright[browserName] as BrowserType).connect(wsEndpoint, options);\n  const context = await browser.newContext();\n  const page = await context.newPage();\n\n  await page.goto(\"https://example.com\");\n  await expect(page).toHaveTitle(/Example/);\n\n  await browser.close();\n});\n```\n\n## Configuration Options\n\n```typescript\ntype PlaywrightServiceAdditionalOptions = {\n  serviceAuthType?: \"ENTRA_ID\" | \"ACCESS_TOKEN\";  // Default: ENTRA_ID\n  os?: \"linux\" | \"windows\";                        // Default: linux\n  runName?: string;                                // Custom run name for portal\n  connectTimeout?: number;                         // Default: 30000ms\n  exposeNetwork?: string;                          // Default: <loopback>\n  credential?: TokenCredential;                    // REQUIRED for Entra ID\n};\n```\n\n### ServiceOS Enum\n\n```typescript\nimport { ServiceOS } from \"@azure/playwright\";\n\n// Available values\nServiceOS.LINUX   // \"linux\" - default\nServiceOS.WINDOWS // \"windows\"\n```\n\n### ServiceAuth Enum\n\n```typescript\nimport { ServiceAuth } from \"@azure/playwright\";\n\n// Available values\nServiceAuth.ENTRA_ID      // Recommended - uses credential\nServiceAuth.ACCESS_TOKEN  // Use PLAYWRIGHT_SERVICE_ACCESS_TOKEN env var\n```\n\n## CI/CD Integration\n\n### GitHub Actions\n\n```yaml\nname: playwright-ts\non: [push, pull_request]\n\npermissions:\n  id-token: write\n  contents: read\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Azure Login\n        uses: azure/login@v2\n        with:\n          client-id: ${{ secrets.AZURE_CLIENT_ID }}\n          tenant-id: ${{ secrets.AZURE_TENANT_ID }}\n          subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}\n\n      - run: npm ci\n      \n      - name: Run Tests\n        env:\n          PLAYWRIGHT_SERVICE_URL: ${{ secrets.PLAYWRIGHT_SERVICE_URL }}\n        run: npx playwright test -c playwright.service.config.ts --workers=20\n```\n\n### Azure Pipelines\n\n```yaml\n- task: AzureCLI@2\n  displayName: Run Playwright Tests\n  env:\n    PLAYWRIGHT_SERVICE_URL: $(PLAYWRIGHT_SERVICE_URL)\n  inputs:\n    azureSubscription: My_Service_Connection\n    scriptType: pscore\n    inlineScript: |\n      npx playwright test -c playwright.service.config.ts --workers=20\n    addSpnToEnvironment: true\n```\n\n## Key Types\n\n```typescript\nimport {\n  createAzurePlaywrightConfig,\n  getConnectOptions,\n  ServiceOS,\n  ServiceAuth,\n  ServiceEnvironmentVariable,\n} from \"@azure/playwright\";\n\nimport type {\n  OsType,\n  AuthenticationType,\n  BrowserConnectOptions,\n  PlaywrightServiceAdditionalOptions,\n} from \"@azure/playwright\";\n```\n\n## Migration from Old Package\n\n| Old (`@azure/microsoft-playwright-testing`) | New (`@azure/playwright`) |\n|---------------------------------------------|---------------------------|\n| `getServiceConfig()` | `createAzurePlaywrightConfig()` |\n| `timeout` option | `connectTimeout` option |\n| `runId` option | `runName` option |\n| `useCloudHostedBrowsers` option | Removed (always enabled) |\n| `@azure/microsoft-playwright-testing/reporter` | `@azure/playwright/reporter` |\n| Implicit credential | Explicit `credential` parameter |\n\n### Before (Old)\n\n```typescript\nimport { getServiceConfig, ServiceOS } from \"@azure/microsoft-playwright-testing\";\n\nexport default defineConfig(\n  config,\n  getServiceConfig(config, {\n    os: ServiceOS.LINUX,\n    timeout: 30000,\n    useCloudHostedBrowsers: true,\n  }),\n  {\n    reporter: [[\"@azure/microsoft-playwright-testing/reporter\"]],\n  }\n);\n```\n\n### After (New)\n\n```typescript\nimport { createAzurePlaywrightConfig, ServiceOS } from \"@azure/playwright\";\nimport { DefaultAzureCredential } from \"@azure/identity\";\n\nexport default defineConfig(\n  config,\n  createAzurePlaywrightConfig(config, {\n    os: ServiceOS.LINUX,\n    connectTimeout: 30000,\n    credential: new DefaultAzureCredential(),\n  }),\n  {\n    reporter: [\n      [\"html\", { open: \"never\" }],\n      [\"@azure/playwright/reporter\"],\n    ],\n  }\n);\n```\n\n## Best Practices\n\n1. **Use Entra ID auth** — More secure than access tokens\n2. **Provide explicit credential** — Always pass `credential: new DefaultAzureCredential()`\n3. **Enable artifacts** — Set `trace: \"on-first-retry\"`, `video: \"retain-on-failure\"` in config\n4. **Scale workers** — Use `--workers=20` or higher for parallel execution\n5. **Region selection** — Choose region closest to your test targets\n6. **HTML reporter first** — When using Azure reporter, list HTML reporter before Azure reporter\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.",
  "applicable_domains": [
    "devops"
  ],
  "category": "devops",
  "invocation": [
    "/azure-microsoft-playwright-testing-ts"
  ],
  "authored_by": "claudeskills.in community",
  "source_url": "https://claudeskills.in/skill/azure-microsoft-playwright-testing-ts",
  "provenance": {
    "source": "claudeskills.in",
    "source_url": "https://claudeskills.in/skill/azure-microsoft-playwright-testing-ts",
    "license": "unknown",
    "imported_at": "2026-09-03",
    "notes": "Aggregated by claudeskills.in from community GitHub lists."
  },
  "tags": [
    "claudeskills",
    "devops"
  ],
  "lifecycle": "draft"
}