@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 でサポートされている OS の種類。

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 Testingでサポートされる認証タイプ

ServiceEnvironmentVariable

Microsoft Playwright Testingで使用される環境変数

ServiceOS

Microsoft PlaywrightでサポートされているOSタイプクラウドホスティングブラウザのテスト

関数の詳細

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 Testingでサポートされる認証タイプ

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でサポートされているOSタイプクラウドホスティングブラウザのテスト

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

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