@azure/playwright package

Aliasy typu

AuthenticationType

Typy ověřování podporované službou Azure Playwright.

BrowserConnectOptions

Možnosti připojení prohlížeče pro službu. To zahrnuje možnosti koncových bodů a možnosti připojení.

Příklad

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

Možnosti koncových bodů pro službu.

OsType

Typy operačních systémů podporované službou Azure Playwright.

PlaywrightServiceAdditionalOptions

Další možnosti služby.

Funkce

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

Vygenerujte konfiguraci dramatika integrovanou s Azure Playwright.

Příklad

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

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

Příklad

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)

Získejte možnosti připojení potřebné pro připojení k prohlížečům hostovaným v cloudu služby Azure Playwright.

Příklad

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

Proměnné

ServiceAuth

Podporované typy autentizace v Azure Playwright

ServiceEnvironmentVariable

Proměnné prostředí používané Azure Playwright

ServiceOS

Typy operačních systémů podporované v cloudových prohlížečích Azure Playwright

Podrobnosti funkce

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

Vygenerujte konfiguraci dramatika integrovanou s Azure Playwright.

Příklad

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

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

Příklad

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

Základní konfigurace dramatika

options
PlaywrightServiceAdditionalOptions

Další možnosti služby

Návraty

PlaywrightTestConfig<{}, {}>

PlaywrightConfig

getConnectOptions(PlaywrightServiceAdditionalOptions)

Získejte možnosti připojení potřebné pro připojení k prohlížečům hostovaným v cloudu služby Azure Playwright.

Příklad

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

Další možnosti služby

Návraty

Možnosti připojení k prohlížeči

Podrobnosti proměnné

ServiceAuth

Podporované typy autentizace v Azure Playwright

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

Typ

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

ServiceEnvironmentVariable

Proměnné prostředí používané Azure Playwright

ServiceEnvironmentVariable: { PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_URL: string }

Typ

{ PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_URL: string }

ServiceOS

Typy operačních systémů podporované v cloudových prohlížečích Azure Playwright

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

Typ

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