@azure/microsoft-playwright-testing package

Интерфейсы

MPTReporterConfig

Необязательная конфигурация для MPT Reporter.

пример

import { defineConfig } from "@playwright/test";

export default defineConfig({
 reporter: [["@azure/microsoft-playwright-testing/reporter", {
  enableGitHubSummary: true
 }]],
});

Псевдонимы типа

AuthenticationType

Типы проверки подлинности, поддерживаемые Microsoft Playwright Testing.

BrowserConnectOptions

Параметры подключения браузера для службы. Сюда входят параметры конечной точки и параметры подключения.

пример

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

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

Параметры подключения для службы.

EndpointOptions

Параметры конечной точки для службы.

OsType

Типы ОС, поддерживаемые Microsoft Playwright Testing.

PlaywrightServiceAdditionalOptions

Дополнительные параметры службы.

Функции

getConnectOptions(Omit<PlaywrightServiceAdditionalOptions, "serviceAuthType">)

Получение параметров подключения, необходимых для подключения к облачным размещенным браузерам Microsoft Playwright Testing.

пример

import playwright, { test, expect, BrowserType } from "@playwright/test";
import { getConnectOptions } from "@azure/microsoft-playwright-testing";

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)

Создайте конфигурацию драматурга, интегрированную с Microsoft Playwright Testing.

пример

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

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

пример

import { defineConfig } from "playwright/test";
import { getServiceConfig, ServiceOS } from "@azure/microsoft-playwright-testing";
import playwrightConfig from "./playwright.config";

export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig, {
 runId: "custom run id",
 os: ServiceOS.WINDOWS
}));

Переменные

ServiceAuth

Типы аутентификации, поддерживаемые в тестировании Microsoft Playwright

ServiceEnvironmentVariable

Переменные среды, используемые в Microsoft Playwright Testing

ServiceOS

Типы ОС, поддерживаемые в Microsoft Playwright Testing облачных браузеров

Сведения о функции

getConnectOptions(Omit<PlaywrightServiceAdditionalOptions, "serviceAuthType">)

Получение параметров подключения, необходимых для подключения к облачным размещенным браузерам Microsoft Playwright Testing.

пример

import playwright, { test, expect, BrowserType } from "@playwright/test";
import { getConnectOptions } from "@azure/microsoft-playwright-testing";

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?: Omit<PlaywrightServiceAdditionalOptions, "serviceAuthType">): Promise<BrowserConnectOptions>

Параметры

options

Omit<PlaywrightServiceAdditionalOptions, "serviceAuthType">

дополнительные параметры службы

Возвращаемое значение

BrowserConnectOptions

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

Создайте конфигурацию драматурга, интегрированную с Microsoft Playwright Testing.

пример

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

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

пример

import { defineConfig } from "playwright/test";
import { getServiceConfig, ServiceOS } from "@azure/microsoft-playwright-testing";
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<{}, {}>

Параметры

config

PlaywrightTestConfig<{}, {}>

базовая конфигурация драматурга

options
PlaywrightServiceAdditionalOptions

дополнительные параметры службы

Возвращаемое значение

PlaywrightTestConfig<{}, {}>

PlaywrightConfig

Variable Details

ServiceAuth

Типы аутентификации, поддерживаемые в тестировании Microsoft Playwright

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

Тип

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

ServiceEnvironmentVariable

Переменные среды, используемые в Microsoft Playwright Testing

ServiceEnvironmentVariable: { PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_EXPOSE_NETWORK_ENVIRONMENT_VARIABLE: string, PLAYWRIGHT_SERVICE_OS: string, PLAYWRIGHT_SERVICE_REPORTING_URL: string, PLAYWRIGHT_SERVICE_URL: string }

Тип

{ PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_EXPOSE_NETWORK_ENVIRONMENT_VARIABLE: string, PLAYWRIGHT_SERVICE_OS: string, PLAYWRIGHT_SERVICE_REPORTING_URL: string, PLAYWRIGHT_SERVICE_URL: string }

ServiceOS

Типы ОС, поддерживаемые в Microsoft Playwright Testing облачных браузеров

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

Тип

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