@azure/playwright package

Aliasy typu

AuthenticationType

Typy uwierzytelniania obsługiwane przez usługę Azure Playwright.

BrowserConnectOptions

Opcje połączenia z przeglądarką dla usługi. Obejmuje to opcje punktu końcowego i opcje połączenia.

Przykład

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

Wartości identyfikatorów źródłowych akceptowane przez Azure Playwright dla opcji sourceType.

EndpointOptions

Opcje punktu końcowego dla usługi.

OsType

Typy systemów operacyjnych obsługiwane przez usługę Azure Playwright.

PlaywrightServiceAdditionalOptions

Dodatkowe opcje dla usługi.

Funkcje

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

Generowanie konfiguracji dramaturga zintegrowanej z usługą Azure Playwright.

Przykład

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

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

Przykład

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)

Uzyskaj opcje połączenia wymagane do nawiązania połączenia z przeglądarkami hostowanymi w chmurze usługi Azure Playwright.

Przykład

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

Zmienne

ServiceAuth

Typy uwierzytelniania obsługiwane w Azure Playwright

ServiceEnvironmentVariable

Zmienne środowiskowe używane przez Azure Playwright

ServiceOS

Typy systemów operacyjnych obsługiwane w przeglądarkach hostowanych w chmurze Azure Playwright

Szczegóły funkcji

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

Generowanie konfiguracji dramaturga zintegrowanej z usługą Azure Playwright.

Przykład

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

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

Przykład

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

Parametry

baseConfig

PlaywrightTestConfig<{}, {}>

Podstawowa konfiguracja dramaturga

options
PlaywrightServiceAdditionalOptions

Dodatkowe opcje dla usługi

Zwraca

PlaywrightTestConfig<{}, {}>

DramaturgConfig

getConnectOptions(PlaywrightServiceAdditionalOptions)

Uzyskaj opcje połączenia wymagane do nawiązania połączenia z przeglądarkami hostowanymi w chmurze usługi Azure Playwright.

Przykład

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>

Parametry

options
PlaywrightServiceAdditionalOptions

Dodatkowe opcje dla usługi

Zwraca

Opcje BrowserConnectOptions

Szczegóły zmiennej

ServiceAuth

Typy uwierzytelniania obsługiwane w Azure Playwright

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

Typ

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

ServiceEnvironmentVariable

Zmienne środowiskowe używane przez Azure Playwright

ServiceEnvironmentVariable: { PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_URL: string }

Typ

{ PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_URL: string }

ServiceOS

Typy systemów operacyjnych obsługiwane w przeglądarkach hostowanych w chmurze Azure Playwright

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

Typ

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