@azure/playwright package
Type Aliases
| AuthenticationType |
Authentication types supported by Azure Playwright. |
| BrowserConnectOptions |
Browser connect options for the service. This includes endpoint options and connect options. Example
|
| EndpointOptions |
Endpoint options for the service. |
| OsType |
OS Types supported by Azure Playwright. |
| PlaywrightServiceAdditionalOptions |
Additional options for the service. |
Functions
| get |
Get connect options required to connect to Azure Playwright's cloud hosted browsers. Example
|
| get |
Generate playwright configuration integrated with Azure Playwright. Example
Example
|
Variables
| Service |
Authentication types supported on Azure Playwright |
| Service |
Environment variables used by Azure Playwright |
| ServiceOS | OS types supported on Azure Playwright cloud hosted browsers |
Function Details
getConnectOptions(PlaywrightServiceAdditionalOptions)
Get connect options required to connect to Azure Playwright's cloud hosted browsers.
Example
import playwright, { test, expect, BrowserType } from "@playwright/test";
import { getConnectOptions } from "@azure/playwright";
test('has title', 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://playwright.dev/');
await expect(page).toHaveTitle(/Playwright/);
await page.close();
await context.close();
await browser.close();
});
function getConnectOptions(options?: PlaywrightServiceAdditionalOptions): Promise<BrowserConnectOptions>
Parameters
additional options for the service
Returns
Promise<BrowserConnectOptions>
BrowserConnectOptions
getServiceConfig(PlaywrightTestConfig<{}, {}>, PlaywrightServiceAdditionalOptions)
Generate playwright configuration integrated with Azure Playwright.
Example
import { defineConfig } from "playwright/test";
import { getServiceConfig } from "@azure/playwright";
import playwrightConfig from "./playwright.config";
export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig));
Example
import { defineConfig } from "playwright/test";
import { getServiceConfig, ServiceOS } from "@azure/playwright";
import playwrightConfig from "./playwright.config";
export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig, {
runId: "custom run id",
os: ServiceOS.WINDOWS
}));
function getServiceConfig(config: PlaywrightTestConfig<{}, {}>, options?: PlaywrightServiceAdditionalOptions): PlaywrightTestConfig<{}, {}>
Parameters
- config
-
PlaywrightTestConfig<{}, {}>
base playwright configuration
additional options for the service
Returns
PlaywrightTestConfig<{}, {}>
PlaywrightConfig
Variable Details
ServiceAuth
Authentication types supported on Azure Playwright
ServiceAuth: { ACCESS_TOKEN: "ACCESS_TOKEN", ENTRA_ID: "ENTRA_ID" }
Type
{ ACCESS_TOKEN: "ACCESS_TOKEN", ENTRA_ID: "ENTRA_ID" }
ServiceEnvironmentVariable
Environment variables used by Azure Playwright
ServiceEnvironmentVariable: { PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_URL: string }
Type
{ PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_URL: string }
ServiceOS
OS types supported on Azure Playwright cloud hosted browsers
ServiceOS: { LINUX: "linux", WINDOWS: "windows" }
Type
{ LINUX: "linux", WINDOWS: "windows" }