@azure/microsoft-playwright-testing package

الواجهات

MPTReporterConfig

تكوين اختياري لمراسل MPT.

المثال

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

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

النوع أسماء مستعارة

AuthenticationType

أنواع المصادقة التي يدعمها اختبار Microsoft Playwright.

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.

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)

إنشاء تكوين playwright متكامل مع 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

متغيرات البيئة المستخدمة في اختبار مايكروسوفت بلاي رايت

ServiceOS

أنواع أنظمة التشغيل المدعومة على Microsoft Playwright اختبار المتصفحات المستضافة عبر السحابة

تفاصيل الوظيفة

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">

خيارات إضافية للخدمة

المرتجعات

خيارات اتصال المستعرض

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

إنشاء تكوين playwright متكامل مع 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<{}, {}>

تكوين قاعدة playwright

options
PlaywrightServiceAdditionalOptions

خيارات إضافية للخدمة

المرتجعات

PlaywrightTestConfig<{}, {}>

تكوين Playwright

Variable Details

ServiceAuth

أنواع المصادقة المدعومة في اختبار Microsoft Playwright

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

النوع

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

ServiceEnvironmentVariable

متغيرات البيئة المستخدمة في اختبار مايكروسوفت بلاي رايت

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 اختبار المتصفحات المستضافة عبر السحابة

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

النوع

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