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

Endpunktoptionen für den Dienst.

OsType

Betriebssystemtypen, die von Azure Playwright unterstützt werden.

PlaywrightServiceAdditionalOptions

Zusätzliche Optionen für den Dienst.

Functions

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();
});
getServiceConfig(PlaywrightTestConfig<{}, {}>, PlaywrightServiceAdditionalOptions)

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

Beispiel

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

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

Beispiel

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

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

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 Dienst

Gibt zurück

BrowserConnectOptionen

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

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

Beispiel

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

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

Beispiel

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<{}, {}>

Parameter

config

PlaywrightTestConfig<{}, {}>

Grundlegende Playwright-Konfiguration

options
PlaywrightServiceAdditionalOptions

zusätzliche Optionen für den Dienst

Gibt zurück

PlaywrightTestConfig<{}, {}>

PlaywrightConfig

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" }