@azure/playwright package

Typaliase

AuthenticationType

Authentifizierungstypen, die von Azure Playwright unterstützt werden.

BrowserConnectOptions

Browserverbindungsoptionen für den Dienst. Dazu gehören Endpunktoptionen und Verbindungsoptionen.

Beispiel

import playwright, { test, expect, BrowserType } from "@playwright/test";
import { getConnectOptions, BrowserConnectOptions } from "@azure/playwright";

test("has title", async ({ browserName }) => {
 const { wsEndpoint, options } : BrowserConnectOptions = 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();
});
BrowserSessionSourceTypeValue

Quellidentifikationswerte, die von Azure Playwright für die Option sourceType akzeptiert werden.

EndpointOptions

Endpunktoptionen für den Dienst.

OsType

Betriebssystemtypen, die von Azure Playwright unterstützt werden.

PlaywrightServiceAdditionalOptions

Zusätzliche Optionen für den Service.

Functions

createAzurePlaywrightConfig(PlaywrightTestConfig<{}, {}>, PlaywrightServiceAdditionalOptions)

Generieren Sie eine Playwright-Konfiguration, die in Azure Playwright integriert ist.

Beispiel

import { defineConfig } from "playwright/test";
import { createAzurePlaywrightConfig } from "@azure/playwright";
import playwrightConfig from "./playwright.config";

export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig));

Beispiel

import { defineConfig } from "playwright/test";
import { createAzurePlaywrightConfig, ServiceOS, ServiceAuth } from "@azure/playwright";
import playwrightConfig from "./playwright.config";
import { DefaultAzureCredential } from '@azure/identity';

export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig, {
 credential: new DefaultAzureCredential(),
 serviceAuthType: ServiceAuth.ENTRA_ID,
 os: ServiceOS.WINDOWS
}));
getConnectOptions(PlaywrightServiceAdditionalOptions)

Hier finden Sie die Verbindungsoptionen, die zum Herstellen einer Verbindung mit den in der Cloud gehosteten Browsern von Azure Playwright erforderlich sind.

Beispiel

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();
});

Variablen

ServiceAuth

Authentifizierungstypen, die in Azure Playwright unterstützt werden

ServiceEnvironmentVariable

Umgebungsvariablen, die von Azure Playwright verwendet werden

ServiceOS

Betriebssystemtypen, die in Azure Playwright cloud-gehosteten Browsern unterstützt werden

Details zur Funktion

createAzurePlaywrightConfig(PlaywrightTestConfig<{}, {}>, PlaywrightServiceAdditionalOptions)

Generieren Sie eine Playwright-Konfiguration, die in Azure Playwright integriert ist.

Beispiel

import { defineConfig } from "playwright/test";
import { createAzurePlaywrightConfig } from "@azure/playwright";
import playwrightConfig from "./playwright.config";

export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig));

Beispiel

import { defineConfig } from "playwright/test";
import { createAzurePlaywrightConfig, ServiceOS, ServiceAuth } from "@azure/playwright";
import playwrightConfig from "./playwright.config";
import { DefaultAzureCredential } from '@azure/identity';

export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig, {
 credential: new DefaultAzureCredential(),
 serviceAuthType: ServiceAuth.ENTRA_ID,
 os: ServiceOS.WINDOWS
}));
function createAzurePlaywrightConfig(baseConfig: PlaywrightTestConfig<{}, {}>, options?: PlaywrightServiceAdditionalOptions): PlaywrightTestConfig<{}, {}>

Parameter

baseConfig

PlaywrightTestConfig<{}, {}>

Grundlegende Playwright-Konfiguration

options
PlaywrightServiceAdditionalOptions

Zusätzliche Optionen für den Service

Gibt zurück

PlaywrightTestConfig<{}, {}>

PlaywrightConfig

getConnectOptions(PlaywrightServiceAdditionalOptions)

Hier finden Sie die Verbindungsoptionen, die zum Herstellen einer Verbindung mit den in der Cloud gehosteten Browsern von Azure Playwright erforderlich sind.

Beispiel

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>

Parameter

options
PlaywrightServiceAdditionalOptions

Zusätzliche Optionen für den Service

Gibt zurück

BrowserConnectOptionen

Details zu Variablen

ServiceAuth

Authentifizierungstypen, die in Azure Playwright unterstützt werden

ServiceAuth: { ACCESS_TOKEN: "ACCESS_TOKEN", ENTRA_ID: "ENTRA_ID" }

Typ

{ ACCESS_TOKEN: "ACCESS_TOKEN", ENTRA_ID: "ENTRA_ID" }

ServiceEnvironmentVariable

Umgebungsvariablen, die von Azure Playwright verwendet werden

ServiceEnvironmentVariable: { PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_URL: string }

Typ

{ PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_URL: string }

ServiceOS

Betriebssystemtypen, die in Azure Playwright cloud-gehosteten Browsern unterstützt werden

ServiceOS: { LINUX: "linux", WINDOWS: "windows" }

Typ

{ LINUX: "linux", WINDOWS: "windows" }