@azure/playwright package
Aliases de tipo
| AuthenticationType |
Tipos de autenticação compatíveis com o Azure Playwright. |
| BrowserConnectOptions |
Opções de conexão do navegador para o serviço. Isso inclui opções de endpoint e opções de conexão. Exemplo
|
| BrowserSessionSourceTypeValue |
Valores identificadores de origem aceitos por Azure dramaturgo para a opção |
| EndpointOptions |
Opções de ponto de extremidade para o serviço. |
| OsType |
Tipos de sistema operacional compatíveis com o Azure Playwright. |
| PlaywrightServiceAdditionalOptions |
Opções adicionais para o serviço. |
Funções
| create |
Gere a configuração do dramaturgo integrada ao Azure Playwright. Exemplo
Exemplo
|
| get |
Obtenha as opções de conexão necessárias para se conectar aos navegadores hospedados na nuvem do Azure Playwright. Exemplo
|
Variáveis
| Service |
Tipos de autenticação suportados no Azure Playwright |
| Service |
Variáveis de ambiente usadas pelo Azure Playwright |
| ServiceOS | Tipos de sistemas operacionais suportados em navegadores hospedados na nuvem pelo Azure Playwright |
Detalhes da função
createAzurePlaywrightConfig(PlaywrightTestConfig<{}, {}>, PlaywrightServiceAdditionalOptions)
Gere a configuração do dramaturgo integrada ao Azure Playwright.
Exemplo
import { defineConfig } from "playwright/test";
import { createAzurePlaywrightConfig } from "@azure/playwright";
import playwrightConfig from "./playwright.config";
export default defineConfig(playwrightConfig, createAzurePlaywrightConfig(playwrightConfig));
Exemplo
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<{}, {}>
Parâmetros
- baseConfig
-
PlaywrightTestConfig<{}, {}>
Configuração básica do dramaturgo
Opções adicionais para o serviço
Retornos
PlaywrightTestConfig<{}, {}>
PlaywrightConfig
getConnectOptions(PlaywrightServiceAdditionalOptions)
Obtenha as opções de conexão necessárias para se conectar aos navegadores hospedados na nuvem do Azure Playwright.
Exemplo
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>
Parâmetros
Opções adicionais para o serviço
Retornos
Promise<BrowserConnectOptions>
Opções de conexão do navegador
Detalhes da variável
ServiceAuth
Tipos de autenticação suportados no Azure Playwright
ServiceAuth: { ACCESS_TOKEN: "ACCESS_TOKEN", ENTRA_ID: "ENTRA_ID" }
Tipo
{ ACCESS_TOKEN: "ACCESS_TOKEN", ENTRA_ID: "ENTRA_ID" }
ServiceEnvironmentVariable
Variáveis de ambiente usadas pelo Azure Playwright
ServiceEnvironmentVariable: { PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_URL: string }
Tipo
{ PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_URL: string }
ServiceOS
Tipos de sistemas operacionais suportados em navegadores hospedados na nuvem pelo Azure Playwright
ServiceOS: { LINUX: "linux", WINDOWS: "windows" }
Tipo
{ LINUX: "linux", WINDOWS: "windows" }