@azure/playwright package

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

AuthenticationType

أنواع المصادقة التي يدعمها Azure Playwright.

BrowserConnectOptions

خيارات اتصال المستعرض للخدمة. يتضمن ذلك خيارات نقطة النهاية وخيارات الاتصال.

مثال

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

قيم معرف المصدر مقبولة من قبل Azure Playwright لخيار sourceType.

EndpointOptions

خيارات نقطة النهاية للخدمة.

OsType

أنواع أنظمة التشغيل التي يدعمها Azure Playwright.

PlaywrightServiceAdditionalOptions

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

الوظائف

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

إنشاء تكوين الكائن الوظيفي المتكامل مع Azure Playwright.

مثال

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

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

مثال

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)

احصل على خيارات الاتصال المطلوبة للاتصال بالمستعرضات المستضافة على السحابة في Azure Playwright.

مثال

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

المتغيرات

ServiceAuth

أنواع المصادقة المدعومة على Azure Playwright

ServiceEnvironmentVariable

المتغيرات البيئية المستخدمة من قبل Azure Playwright

ServiceOS

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

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

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

إنشاء تكوين الكائن الوظيفي المتكامل مع Azure Playwright.

مثال

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

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

مثال

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

المعلمات

baseConfig

PlaywrightTestConfig<{}, {}>

تكوين الكاتب المسرحي الأساسي

options
PlaywrightServiceAdditionalOptions

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

المرتجعات

PlaywrightTestConfig<{}, {}>

PlaywrightConfig

getConnectOptions(PlaywrightServiceAdditionalOptions)

احصل على خيارات الاتصال المطلوبة للاتصال بالمستعرضات المستضافة على السحابة في Azure Playwright.

مثال

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>

المعلمات

options
PlaywrightServiceAdditionalOptions

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

المرتجعات

خيارات BrowserConnectOptions

تفاصيل المُتغيّر

ServiceAuth

أنواع المصادقة المدعومة على Azure Playwright

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

النوع

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

ServiceEnvironmentVariable

المتغيرات البيئية المستخدمة من قبل Azure Playwright

ServiceEnvironmentVariable: { PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_URL: string }

النوع

{ PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string, PLAYWRIGHT_SERVICE_URL: string }

ServiceOS

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

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

النوع

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