@azure/microsoft-playwright-testing 1.0.0-alpha.20241125.1 → 1.0.0-alpha.20241127.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/customerConfig.d.ts +2 -2
- package/dist/common/customerConfig.d.ts.map +1 -1
- package/dist/common/customerConfig.js.map +1 -1
- package/dist/common/messages.d.ts +4 -0
- package/dist/common/messages.d.ts.map +1 -1
- package/dist/common/messages.js +4 -0
- package/dist/common/messages.js.map +1 -1
- package/dist/common/types.d.ts +4 -4
- package/dist/common/types.d.ts.map +1 -1
- package/dist/common/types.js.map +1 -1
- package/dist/core/global/playwright-service-global-setup.js +4 -1
- package/dist/core/global/playwright-service-global-setup.js.map +1 -1
- package/dist/core/global/playwright-service-global-teardown.d.ts.map +1 -1
- package/dist/core/global/playwright-service-global-teardown.js +4 -1
- package/dist/core/global/playwright-service-global-teardown.js.map +1 -1
- package/dist/core/playwrightService.d.ts.map +1 -1
- package/dist/core/playwrightService.js +57 -6
- package/dist/core/playwrightService.js.map +1 -1
- package/package.json +1 -1
- package/types/microsoft-playwright-testing.d.ts +287 -77
- package/types/reporter/microsoft-playwright-testing.d.ts +149 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare class CustomerConfig {
|
|
2
2
|
private static instance;
|
|
3
|
-
globalSetup?: string;
|
|
4
|
-
globalTeardown?: string;
|
|
3
|
+
globalSetup?: string | string[];
|
|
4
|
+
globalTeardown?: string | string[];
|
|
5
5
|
static getInstance(): CustomerConfig;
|
|
6
6
|
}
|
|
7
7
|
declare const customerConfig: CustomerConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customerConfig.d.ts","sourceRoot":"","sources":["../../src/common/customerConfig.ts"],"names":[],"mappings":"AAGA,cAAM,cAAc;IAClB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAiB;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"customerConfig.d.ts","sourceRoot":"","sources":["../../src/common/customerConfig.ts"],"names":[],"mappings":"AAGA,cAAM,cAAc;IAClB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAiB;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;WAE5B,WAAW,IAAI,cAAc;CAM5C;AAED,QAAA,MAAM,cAAc,gBAA+B,CAAC;AACpD,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customerConfig.js","sourceRoot":"","sources":["../../src/common/customerConfig.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,MAAM,cAAc;IAKX,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;YAC7B,cAAc,CAAC,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;QACjD,CAAC;QACD,OAAO,cAAc,CAAC,QAAQ,CAAC;IACjC,CAAC;CACF;AAED,MAAM,cAAc,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;AACpD,kBAAe,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nclass CustomerConfig {\n private static instance: CustomerConfig;\n public globalSetup?: string;\n public globalTeardown?: string;\n\n public static getInstance(): CustomerConfig {\n if (!CustomerConfig.instance) {\n CustomerConfig.instance = new CustomerConfig();\n }\n return CustomerConfig.instance;\n }\n}\n\nconst customerConfig = CustomerConfig.getInstance();\nexport default customerConfig;\n"]}
|
|
1
|
+
{"version":3,"file":"customerConfig.js","sourceRoot":"","sources":["../../src/common/customerConfig.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,MAAM,cAAc;IAKX,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;YAC7B,cAAc,CAAC,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;QACjD,CAAC;QACD,OAAO,cAAc,CAAC,QAAQ,CAAC;IACjC,CAAC;CACF;AAED,MAAM,cAAc,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;AACpD,kBAAe,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nclass CustomerConfig {\n private static instance: CustomerConfig;\n public globalSetup?: string | string[];\n public globalTeardown?: string | string[];\n\n public static getInstance(): CustomerConfig {\n if (!CustomerConfig.instance) {\n CustomerConfig.instance = new CustomerConfig();\n }\n return CustomerConfig.instance;\n }\n}\n\nconst customerConfig = CustomerConfig.getInstance();\nexport default customerConfig;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/common/messages.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/common/messages.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCxC,CAAC"}
|
package/dist/common/messages.js
CHANGED
|
@@ -16,6 +16,10 @@ exports.ServiceErrorMessageConstants = {
|
|
|
16
16
|
key: "InvalidPlaywrightVersionError",
|
|
17
17
|
message: "The Playwright version you are using is not supported. See the list of supported versions at https://aka.ms/mpt/supported-versions.",
|
|
18
18
|
},
|
|
19
|
+
MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR: {
|
|
20
|
+
key: "MultipleSetupFilePlaywrightVersionError",
|
|
21
|
+
message: "The Playwright version you are using does not support multiple setup/teardown files. Please update to Playwright version 1.49.0 or higher.",
|
|
22
|
+
},
|
|
19
23
|
WORKSPACE_MISMATCH_ERROR: {
|
|
20
24
|
key: "InvalidAccessToken",
|
|
21
25
|
message: "The provided access token does not match the specified workspace URL. Please verify that both values are correct.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/common/messages.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAErB,QAAA,4BAA4B,GAAG;IAC1C,oBAAoB,EAAE;QACpB,GAAG,EAAE,mBAAmB;QACxB,OAAO,EACL,8GAA8G;KACjH;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,uBAAuB;QAC5B,OAAO,EAAE,qCAAqC;KAC/C;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,+BAA+B;QACpC,OAAO,EACL,qIAAqI;KACxI;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EACL,mHAAmH;KACtH;IACD,aAAa,EAAE;QACb,GAAG,EAAE,aAAa;QAClB,OAAO,EACL,kHAAkH;KACrH;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,8EAA8E;KACxF;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,4DAA4D;KACtE;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const ServiceErrorMessageConstants = {\n NO_SERVICE_URL_ERROR: {\n key: \"NoServiceUrlError\",\n message:\n \"The value for the PLAYWRIGHT_SERVICE_URL variable is not set correctly. Please verify the URL and try again.\",\n },\n INVALID_GLOBAL_FUNCTION: {\n key: \"InvalidGlobalFunction\",\n message: \"File must export a single function.\",\n },\n INVALID_PLAYWRIGHT_VERSION_ERROR: {\n key: \"InvalidPlaywrightVersionError\",\n message:\n \"The Playwright version you are using is not supported. See the list of supported versions at https://aka.ms/mpt/supported-versions.\",\n },\n WORKSPACE_MISMATCH_ERROR: {\n key: \"InvalidAccessToken\",\n message:\n \"The provided access token does not match the specified workspace URL. Please verify that both values are correct.\",\n },\n NO_AUTH_ERROR: {\n key: \"NoAuthError\",\n message:\n \"Could not authenticate with the service. Please refer to https://aka.ms/mpt/authentication for more information.\",\n },\n INVALID_MPT_PAT_ERROR: {\n key: \"InvalidMptPatError\",\n message: \"The authentication token provided is invalid. Check the token and try again.\",\n },\n EXPIRED_MPT_PAT_ERROR: {\n key: \"ExpiredMptPatError\",\n message: \"Your authentication token has expired. Create a new token.\",\n },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/common/messages.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAErB,QAAA,4BAA4B,GAAG;IAC1C,oBAAoB,EAAE;QACpB,GAAG,EAAE,mBAAmB;QACxB,OAAO,EACL,8GAA8G;KACjH;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,uBAAuB;QAC5B,OAAO,EAAE,qCAAqC;KAC/C;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,+BAA+B;QACpC,OAAO,EACL,qIAAqI;KACxI;IACD,4CAA4C,EAAE;QAC5C,GAAG,EAAE,yCAAyC;QAC9C,OAAO,EACL,4IAA4I;KAC/I;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EACL,mHAAmH;KACtH;IACD,aAAa,EAAE;QACb,GAAG,EAAE,aAAa;QAClB,OAAO,EACL,kHAAkH;KACrH;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,8EAA8E;KACxF;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,oBAAoB;QACzB,OAAO,EAAE,4DAA4D;KACtE;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const ServiceErrorMessageConstants = {\n NO_SERVICE_URL_ERROR: {\n key: \"NoServiceUrlError\",\n message:\n \"The value for the PLAYWRIGHT_SERVICE_URL variable is not set correctly. Please verify the URL and try again.\",\n },\n INVALID_GLOBAL_FUNCTION: {\n key: \"InvalidGlobalFunction\",\n message: \"File must export a single function.\",\n },\n INVALID_PLAYWRIGHT_VERSION_ERROR: {\n key: \"InvalidPlaywrightVersionError\",\n message:\n \"The Playwright version you are using is not supported. See the list of supported versions at https://aka.ms/mpt/supported-versions.\",\n },\n MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR: {\n key: \"MultipleSetupFilePlaywrightVersionError\",\n message:\n \"The Playwright version you are using does not support multiple setup/teardown files. Please update to Playwright version 1.49.0 or higher.\",\n },\n WORKSPACE_MISMATCH_ERROR: {\n key: \"InvalidAccessToken\",\n message:\n \"The provided access token does not match the specified workspace URL. Please verify that both values are correct.\",\n },\n NO_AUTH_ERROR: {\n key: \"NoAuthError\",\n message:\n \"Could not authenticate with the service. Please refer to https://aka.ms/mpt/authentication for more information.\",\n },\n INVALID_MPT_PAT_ERROR: {\n key: \"InvalidMptPatError\",\n message: \"The authentication token provided is invalid. Check the token and try again.\",\n },\n EXPIRED_MPT_PAT_ERROR: {\n key: \"ExpiredMptPatError\",\n message: \"Your authentication token has expired. Create a new token.\",\n },\n};\n"]}
|
package/dist/common/types.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ export type PlaywrightConfigInput = {
|
|
|
109
109
|
*
|
|
110
110
|
* Learn more about {@link https://playwright.dev/docs/test-global-setup-teardown | global setup and teardown}.
|
|
111
111
|
*/
|
|
112
|
-
globalSetup?: string;
|
|
112
|
+
globalSetup?: string | string[];
|
|
113
113
|
/**
|
|
114
114
|
* @public
|
|
115
115
|
*
|
|
@@ -119,7 +119,7 @@ export type PlaywrightConfigInput = {
|
|
|
119
119
|
*
|
|
120
120
|
* Learn more about {@link https://playwright.dev/docs/test-global-setup-teardown | global setup and teardown}.
|
|
121
121
|
*/
|
|
122
|
-
globalTeardown?: string;
|
|
122
|
+
globalTeardown?: string | string[];
|
|
123
123
|
};
|
|
124
124
|
/**
|
|
125
125
|
* @public
|
|
@@ -135,8 +135,8 @@ export type PlaywrightConfig = {
|
|
|
135
135
|
use?: {
|
|
136
136
|
connectOptions: BrowserConnectOptions;
|
|
137
137
|
};
|
|
138
|
-
globalSetup?: string;
|
|
139
|
-
globalTeardown?: string;
|
|
138
|
+
globalSetup?: string | string[];
|
|
139
|
+
globalTeardown?: string | string[];
|
|
140
140
|
};
|
|
141
141
|
/**
|
|
142
142
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAEpC;;;;;;OAMG;IACH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ACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrE,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACtD,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAClD,CAAC;AAIF,MAAM,WAAW,UAAU;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/common/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Location, TestStep } from \"@playwright/test/reporter\";\nimport type { ServiceAuth, ServiceOS } from \"./constants\";\nimport type { TokenCredential } from \"@azure/identity\";\n\nexport type JwtPayload = {\n aid?: string;\n iss?: string;\n sub?: string;\n aud?: string[] | string;\n exp?: number;\n nbf?: number;\n iat?: number;\n jti?: string;\n};\n\nexport type AccessTokenClaims = JwtPayload & {\n aid?: string;\n accountId?: string;\n};\n\n/**\n * @public\n *\n * Endpoint options for the service.\n */\nexport type EndpointOptions = {\n /**\n * @public\n *\n * A browser websocket endpoint to connect to.\n */\n wsEndpoint: string;\n};\n\n/**\n * @public\n *\n * Connect options for the service.\n */\nexport type ConnectOptions = {\n /**\n * @public\n *\n * Additional HTTP headers to be sent with web socket connect request.\n */\n headers?: { [key: string]: string };\n\n /**\n * @public\n *\n * Exposes network available on the connecting client to the browser being connected to.\n *\n * @defaultValue `<loopback>`\n */\n exposeNetwork?: string;\n\n /**\n * @public\n *\n * Maximum time in milliseconds to wait for the connection to be established.\n *\n * @defaultValue `30000`\n */\n timeout?: number;\n\n /**\n * @public\n *\n * Slows down Playwright operations by the specified amount of milliseconds.\n *\n * @defaultValue `0`\n */\n slowMo?: number;\n};\n\n/**\n * @public\n *\n * Browser connect options for the service. This includes endpoint options and connect options.\n *\n * @example\n * ```\n * import playwright, { test, expect, BrowserType } from \"@playwright/test\";\n * import { getConnectOptions, BrowserConnectOptions } from \"@azure/microsoft-playwright-testing\";\n *\n * test(\"has title\", async ({ browserName }) => {\n * const { wsEndpoint, options } : BrowserConnectOptions = await getConnectOptions();\n * const browser = await (playwright[browserName] as BrowserType).connect(wsEndpoint, options);\n * const context = await browser.newContext();\n * const page = await context.newPage();\n *\n * await page.goto(\"https://playwright.dev/\");\n * await expect(page).toHaveTitle(/Playwright/);\n *\n * await page.close();\n * await context.close();\n * await browser.close();\n * });\n * ```\n */\nexport type BrowserConnectOptions = EndpointOptions & {\n options: ConnectOptions;\n};\n\n/**\n * @public\n *\n * Base playwright configuration inputs required for generating the service config.\n */\nexport type PlaywrightConfigInput = {\n /**\n * @public\n *\n * Path to the global setup file. This file will be required and run before all the tests. It must export a single\n * function that takes a [`TestConfig`] argument.\n *\n * Learn more about {@link https://playwright.dev/docs/test-global-setup-teardown | global setup and teardown}.\n */\n globalSetup?: string;\n\n /**\n * @public\n *\n * Path to the global teardown file. This file will be required and run after all the tests. It must export a single\n * function. See also\n * {@link https://playwright.dev/docs/api/class-testconfig#test-config-global-teardown | testConfig.globalTeardown}.\n *\n * Learn more about {@link https://playwright.dev/docs/test-global-setup-teardown | global setup and teardown}.\n */\n globalTeardown?: string;\n};\n\n/**\n * @public\n *\n * Playwright configuration integrated with Microsoft Playwright Testing.\n *\n * @remarks\n *\n * GlobalSetup and globalTeardown wraps around any existing global setup\n * and teardown present in the base playwright configuration and runs it.\n */\nexport type PlaywrightConfig = {\n use?: {\n connectOptions: BrowserConnectOptions;\n };\n globalSetup?: string;\n globalTeardown?: string;\n};\n\n/**\n * @public\n *\n * Additional options for the service.\n */\nexport type PlaywrightServiceAdditionalOptions = {\n /**\n * @public\n *\n * Authentication types supported by Microsoft Playwright Testing.\n *\n * @defaultValue `ENTRA_ID`\n */\n serviceAuthType?: AuthenticationType;\n\n /**\n * @public\n *\n * Operating system types supported by Microsoft Playwright Testing.\n *\n * @defaultValue `linux`\n */\n os?: OsType;\n\n /**\n * @public\n *\n * Run id for the test run.\n *\n * @defaultValue `current datetime as ISO string`\n */\n runId?: string;\n\n /**\n * @public\n *\n * Maximum time in milliseconds to wait for the connection to be established.\n *\n * @defaultValue `30000`\n */\n timeout?: number;\n\n /**\n * @public\n *\n * Slows down Playwright operations by the specified amount of milliseconds.\n *\n * @defaultValue `0`\n */\n slowMo?: number;\n\n /**\n * @public\n *\n * Exposes network available on the connecting client to the browser being connected to.\n *\n * @defaultValue `<loopback>`\n */\n exposeNetwork?: string;\n\n /**\n * @public\n *\n * Use cloud hosted browsers.\n *\n * @defaultValue `false`\n */\n useCloudHostedBrowsers?: boolean;\n\n /**\n * @public\n *\n * Custom token credential for Entra ID authentication. Learn more at {@link https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/using-azure-identity.md | Using Azure Identity}.\n *\n * @defaultValue `DefaultAzureCredential`\n */\n credential?: TokenCredential;\n /**\n * @public\n *\n * Run name for the test run.\n *\n * @defaultValue `guid`\n */\n runName?: string;\n};\n\n/**\n * @public\n *\n * OS Types supported by Microsoft Playwright Testing.\n */\nexport type OsType = (typeof ServiceOS)[keyof typeof ServiceOS];\n\n/**\n * @public\n *\n * Authentication types supported by Microsoft Playwright Testing.\n */\nexport type AuthenticationType = (typeof ServiceAuth)[keyof typeof ServiceAuth];\n\nexport type ErrorDetails = {\n message: string;\n location?: Location;\n};\nexport type ApiErrorMessage = {\n [key: string]: {\n [key: number]: string;\n };\n};\n/**\n * @public\n *\n * Optional configuration for MPT Reporter.\n *\n * @example\n *\n * ```\n * import { defineConfig } from \"@playwright/test\";\n *\n * export default defineConfig({\n * reporter: [[\"@azure/microsoft-playwright-testing/reporter\", {\n * enableGitHubSummary: true\n * }]],\n * });\n * ```\n */\nexport interface MPTReporterConfig {\n /**\n * @public\n *\n * Enable GitHub Actions annotations to diagnose test failures and deep link to MPT Portal.\n *\n * @defaultValue `true`\n */\n enableGitHubSummary?: boolean;\n\n /**\n * @public\n *\n * Enable result publishing for the test run. This will upload the test result and artifacts to the MPT Portal.\n *\n * @defaultValue `true`\n */\n enableResultPublish?: boolean;\n}\nexport type DedupedStep = { step: TestStep; count: number; duration: number };\n\nexport type RawTestStep = {\n title: string;\n category: string;\n startTime: string;\n duration: number;\n error?: string;\n steps: RawTestStep[];\n location?: Location;\n snippet?: string;\n count: number;\n};\n\nexport type IBackOffOptions = {\n numOfAttempts: number;\n retry: (e: any, attemptNumber: number) => boolean | Promise<boolean>;\n jitter: JitterType;\n};\n\nexport type JitterType = \"full\" | \"none\";\n\nexport type VersionInfo = {\n major: number;\n minor: number;\n patch: number;\n};\n\nexport type PackageManager = {\n runCommand: (command: string, args: string) => string;\n getVersionFromStdout: (stdout: string) => string;\n};\n\n// Playwright OSS Types\n\nexport interface FullConfig {\n configFile?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Location, TestStep } from \"@playwright/test/reporter\";\nimport type { ServiceAuth, ServiceOS } from \"./constants\";\nimport type { TokenCredential } from \"@azure/identity\";\n\nexport type JwtPayload = {\n aid?: string;\n iss?: string;\n sub?: string;\n aud?: string[] | string;\n exp?: number;\n nbf?: number;\n iat?: number;\n jti?: string;\n};\n\nexport type AccessTokenClaims = JwtPayload & {\n aid?: string;\n accountId?: string;\n};\n\n/**\n * @public\n *\n * Endpoint options for the service.\n */\nexport type EndpointOptions = {\n /**\n * @public\n *\n * A browser websocket endpoint to connect to.\n */\n wsEndpoint: string;\n};\n\n/**\n * @public\n *\n * Connect options for the service.\n */\nexport type ConnectOptions = {\n /**\n * @public\n *\n * Additional HTTP headers to be sent with web socket connect request.\n */\n headers?: { [key: string]: string };\n\n /**\n * @public\n *\n * Exposes network available on the connecting client to the browser being connected to.\n *\n * @defaultValue `<loopback>`\n */\n exposeNetwork?: string;\n\n /**\n * @public\n *\n * Maximum time in milliseconds to wait for the connection to be established.\n *\n * @defaultValue `30000`\n */\n timeout?: number;\n\n /**\n * @public\n *\n * Slows down Playwright operations by the specified amount of milliseconds.\n *\n * @defaultValue `0`\n */\n slowMo?: number;\n};\n\n/**\n * @public\n *\n * Browser connect options for the service. This includes endpoint options and connect options.\n *\n * @example\n * ```\n * import playwright, { test, expect, BrowserType } from \"@playwright/test\";\n * import { getConnectOptions, BrowserConnectOptions } from \"@azure/microsoft-playwright-testing\";\n *\n * test(\"has title\", async ({ browserName }) => {\n * const { wsEndpoint, options } : BrowserConnectOptions = await getConnectOptions();\n * const browser = await (playwright[browserName] as BrowserType).connect(wsEndpoint, options);\n * const context = await browser.newContext();\n * const page = await context.newPage();\n *\n * await page.goto(\"https://playwright.dev/\");\n * await expect(page).toHaveTitle(/Playwright/);\n *\n * await page.close();\n * await context.close();\n * await browser.close();\n * });\n * ```\n */\nexport type BrowserConnectOptions = EndpointOptions & {\n options: ConnectOptions;\n};\n\n/**\n * @public\n *\n * Base playwright configuration inputs required for generating the service config.\n */\nexport type PlaywrightConfigInput = {\n /**\n * @public\n *\n * Path to the global setup file. This file will be required and run before all the tests. It must export a single\n * function that takes a [`TestConfig`] argument.\n *\n * Learn more about {@link https://playwright.dev/docs/test-global-setup-teardown | global setup and teardown}.\n */\n globalSetup?: string | string[];\n\n /**\n * @public\n *\n * Path to the global teardown file. This file will be required and run after all the tests. It must export a single\n * function. See also\n * {@link https://playwright.dev/docs/api/class-testconfig#test-config-global-teardown | testConfig.globalTeardown}.\n *\n * Learn more about {@link https://playwright.dev/docs/test-global-setup-teardown | global setup and teardown}.\n */\n globalTeardown?: string | string[];\n};\n\n/**\n * @public\n *\n * Playwright configuration integrated with Microsoft Playwright Testing.\n *\n * @remarks\n *\n * GlobalSetup and globalTeardown wraps around any existing global setup\n * and teardown present in the base playwright configuration and runs it.\n */\nexport type PlaywrightConfig = {\n use?: {\n connectOptions: BrowserConnectOptions;\n };\n globalSetup?: string | string[];\n globalTeardown?: string | string[];\n};\n\n/**\n * @public\n *\n * Additional options for the service.\n */\nexport type PlaywrightServiceAdditionalOptions = {\n /**\n * @public\n *\n * Authentication types supported by Microsoft Playwright Testing.\n *\n * @defaultValue `ENTRA_ID`\n */\n serviceAuthType?: AuthenticationType;\n\n /**\n * @public\n *\n * Operating system types supported by Microsoft Playwright Testing.\n *\n * @defaultValue `linux`\n */\n os?: OsType;\n\n /**\n * @public\n *\n * Run id for the test run.\n *\n * @defaultValue `current datetime as ISO string`\n */\n runId?: string;\n\n /**\n * @public\n *\n * Maximum time in milliseconds to wait for the connection to be established.\n *\n * @defaultValue `30000`\n */\n timeout?: number;\n\n /**\n * @public\n *\n * Slows down Playwright operations by the specified amount of milliseconds.\n *\n * @defaultValue `0`\n */\n slowMo?: number;\n\n /**\n * @public\n *\n * Exposes network available on the connecting client to the browser being connected to.\n *\n * @defaultValue `<loopback>`\n */\n exposeNetwork?: string;\n\n /**\n * @public\n *\n * Use cloud hosted browsers.\n *\n * @defaultValue `false`\n */\n useCloudHostedBrowsers?: boolean;\n\n /**\n * @public\n *\n * Custom token credential for Entra ID authentication. Learn more at {@link https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/using-azure-identity.md | Using Azure Identity}.\n *\n * @defaultValue `DefaultAzureCredential`\n */\n credential?: TokenCredential;\n /**\n * @public\n *\n * Run name for the test run.\n *\n * @defaultValue `guid`\n */\n runName?: string;\n};\n\n/**\n * @public\n *\n * OS Types supported by Microsoft Playwright Testing.\n */\nexport type OsType = (typeof ServiceOS)[keyof typeof ServiceOS];\n\n/**\n * @public\n *\n * Authentication types supported by Microsoft Playwright Testing.\n */\nexport type AuthenticationType = (typeof ServiceAuth)[keyof typeof ServiceAuth];\n\nexport type ErrorDetails = {\n message: string;\n location?: Location;\n};\nexport type ApiErrorMessage = {\n [key: string]: {\n [key: number]: string;\n };\n};\n/**\n * @public\n *\n * Optional configuration for MPT Reporter.\n *\n * @example\n *\n * ```\n * import { defineConfig } from \"@playwright/test\";\n *\n * export default defineConfig({\n * reporter: [[\"@azure/microsoft-playwright-testing/reporter\", {\n * enableGitHubSummary: true\n * }]],\n * });\n * ```\n */\nexport interface MPTReporterConfig {\n /**\n * @public\n *\n * Enable GitHub Actions annotations to diagnose test failures and deep link to MPT Portal.\n *\n * @defaultValue `true`\n */\n enableGitHubSummary?: boolean;\n\n /**\n * @public\n *\n * Enable result publishing for the test run. This will upload the test result and artifacts to the MPT Portal.\n *\n * @defaultValue `true`\n */\n enableResultPublish?: boolean;\n}\nexport type DedupedStep = { step: TestStep; count: number; duration: number };\n\nexport type RawTestStep = {\n title: string;\n category: string;\n startTime: string;\n duration: number;\n error?: string;\n steps: RawTestStep[];\n location?: Location;\n snippet?: string;\n count: number;\n};\n\nexport type IBackOffOptions = {\n numOfAttempts: number;\n retry: (e: any, attemptNumber: number) => boolean | Promise<boolean>;\n jitter: JitterType;\n};\n\nexport type JitterType = \"full\" | \"none\";\n\nexport type VersionInfo = {\n major: number;\n minor: number;\n patch: number;\n};\n\nexport type PackageManager = {\n runCommand: (command: string, args: string) => string;\n getVersionFromStdout: (stdout: string) => string;\n};\n\n// Playwright OSS Types\n\nexport interface FullConfig {\n configFile?: string;\n}\n"]}
|
|
@@ -9,7 +9,10 @@ const executor_1 = require("../../common/executor");
|
|
|
9
9
|
const customerConfig_1 = tslib_1.__importDefault(require("../../common/customerConfig"));
|
|
10
10
|
const playwrightServiceGlobalSetupWrapper = async (config) => {
|
|
11
11
|
const rootDir = config.configFile ? (0, path_1.dirname)(config.configFile) : process.cwd();
|
|
12
|
-
|
|
12
|
+
let customerGlobalSetupFunc = null;
|
|
13
|
+
if (customerConfig_1.default.globalSetup && typeof customerConfig_1.default.globalSetup === "string") {
|
|
14
|
+
customerGlobalSetupFunc = await (0, executor_1.loadCustomerGlobalFunction)(rootDir, customerConfig_1.default.globalSetup);
|
|
15
|
+
}
|
|
13
16
|
await playwrightServiceEntra_1.default.globalSetup();
|
|
14
17
|
if (customerGlobalSetupFunc) {
|
|
15
18
|
return customerGlobalSetupFunc(config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright-service-global-setup.js","sourceRoot":"","sources":["../../../src/core/global/playwright-service-global-setup.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,+BAA+B;AAE/B,+FAA+D;AAC/D,oDAAmE;AACnE,yFAAyD;AAEzD,MAAM,mCAAmC,GAAG,KAAK,EAAE,MAAkB,EAAgB,EAAE;IACrF,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAO,EAAC,MAAM,CAAC,UAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAChF,
|
|
1
|
+
{"version":3,"file":"playwright-service-global-setup.js","sourceRoot":"","sources":["../../../src/core/global/playwright-service-global-setup.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,+BAA+B;AAE/B,+FAA+D;AAC/D,oDAAmE;AACnE,yFAAyD;AAEzD,MAAM,mCAAmC,GAAG,KAAK,EAAE,MAAkB,EAAgB,EAAE;IACrF,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAO,EAAC,MAAM,CAAC,UAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAChF,IAAI,uBAAuB,GAAQ,IAAI,CAAC;IACxC,IAAI,wBAAc,CAAC,WAAW,IAAI,OAAO,wBAAc,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QACjF,uBAAuB,GAAG,MAAM,IAAA,qCAA0B,EAAC,OAAO,EAAE,wBAAc,CAAC,WAAW,CAAC,CAAC;IAClG,CAAC;IAED,MAAM,gCAAsB,CAAC,WAAW,EAAE,CAAC;IAC3C,IAAI,uBAAuB,EAAE,CAAC;QAC5B,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;AACH,CAAC,CAAC;AAEF,kBAAe,mCAAmC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { dirname } from \"path\";\nimport type { FullConfig } from \"../../common/types\";\nimport playwrightServiceEntra from \"../playwrightServiceEntra\";\nimport { loadCustomerGlobalFunction } from \"../../common/executor\";\nimport customerConfig from \"../../common/customerConfig\";\n\nconst playwrightServiceGlobalSetupWrapper = async (config: FullConfig): Promise<any> => {\n const rootDir = config.configFile ? dirname(config.configFile!) : process.cwd();\n let customerGlobalSetupFunc: any = null;\n if (customerConfig.globalSetup && typeof customerConfig.globalSetup === \"string\") {\n customerGlobalSetupFunc = await loadCustomerGlobalFunction(rootDir, customerConfig.globalSetup);\n }\n\n await playwrightServiceEntra.globalSetup();\n if (customerGlobalSetupFunc) {\n return customerGlobalSetupFunc(config);\n }\n};\n\nexport default playwrightServiceGlobalSetupWrapper;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright-service-global-teardown.d.ts","sourceRoot":"","sources":["../../../src/core/global/playwright-service-global-teardown.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD,QAAA,MAAM,sCAAsC,WAAkB,UAAU,KAAG,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"playwright-service-global-teardown.d.ts","sourceRoot":"","sources":["../../../src/core/global/playwright-service-global-teardown.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD,QAAA,MAAM,sCAAsC,WAAkB,UAAU,KAAG,OAAO,CAAC,IAAI,CActF,CAAC;AAEF,eAAe,sCAAsC,CAAC"}
|
|
@@ -9,7 +9,10 @@ const executor_1 = require("../../common/executor");
|
|
|
9
9
|
const customerConfig_1 = tslib_1.__importDefault(require("../../common/customerConfig"));
|
|
10
10
|
const playwrightServiceGlobalTeardownWrapper = async (config) => {
|
|
11
11
|
const rootDir = config.configFile ? (0, path_1.dirname)(config.configFile) : process.cwd();
|
|
12
|
-
|
|
12
|
+
let customerGlobalTeardownFunc = null;
|
|
13
|
+
if (customerConfig_1.default.globalTeardown && typeof customerConfig_1.default.globalTeardown === "string") {
|
|
14
|
+
customerGlobalTeardownFunc = await (0, executor_1.loadCustomerGlobalFunction)(rootDir, customerConfig_1.default.globalTeardown);
|
|
15
|
+
}
|
|
13
16
|
playwrightServiceEntra_1.default.globalTeardown();
|
|
14
17
|
if (customerGlobalTeardownFunc) {
|
|
15
18
|
await customerGlobalTeardownFunc(config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright-service-global-teardown.js","sourceRoot":"","sources":["../../../src/core/global/playwright-service-global-teardown.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,+BAA+B;AAE/B,+FAA+D;AAC/D,oDAAmE;AACnE,yFAAyD;AAEzD,MAAM,sCAAsC,GAAG,KAAK,EAAE,MAAkB,EAAiB,EAAE;IACzF,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAO,EAAC,MAAM,CAAC,UAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAChF,
|
|
1
|
+
{"version":3,"file":"playwright-service-global-teardown.js","sourceRoot":"","sources":["../../../src/core/global/playwright-service-global-teardown.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,+BAA+B;AAE/B,+FAA+D;AAC/D,oDAAmE;AACnE,yFAAyD;AAEzD,MAAM,sCAAsC,GAAG,KAAK,EAAE,MAAkB,EAAiB,EAAE;IACzF,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAO,EAAC,MAAM,CAAC,UAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAChF,IAAI,0BAA0B,GAAQ,IAAI,CAAC;IAC3C,IAAI,wBAAc,CAAC,cAAc,IAAI,OAAO,wBAAc,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;QACvF,0BAA0B,GAAG,MAAM,IAAA,qCAA0B,EAC3D,OAAO,EACP,wBAAc,CAAC,cAAc,CAC9B,CAAC;IACJ,CAAC;IAED,gCAAsB,CAAC,cAAc,EAAE,CAAC;IACxC,IAAI,0BAA0B,EAAE,CAAC;QAC/B,MAAM,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC,CAAC;AAEF,kBAAe,sCAAsC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { dirname } from \"path\";\nimport type { FullConfig } from \"../../common/types\";\nimport playwrightServiceEntra from \"../playwrightServiceEntra\";\nimport { loadCustomerGlobalFunction } from \"../../common/executor\";\nimport customerConfig from \"../../common/customerConfig\";\n\nconst playwrightServiceGlobalTeardownWrapper = async (config: FullConfig): Promise<void> => {\n const rootDir = config.configFile ? dirname(config.configFile!) : process.cwd();\n let customerGlobalTeardownFunc: any = null;\n if (customerConfig.globalTeardown && typeof customerConfig.globalTeardown === \"string\") {\n customerGlobalTeardownFunc = await loadCustomerGlobalFunction(\n rootDir,\n customerConfig.globalTeardown,\n );\n }\n\n playwrightServiceEntra.globalTeardown();\n if (customerGlobalTeardownFunc) {\n await customerGlobalTeardownFunc(config);\n }\n};\n\nexport default playwrightServiceGlobalTeardownWrapper;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwrightService.d.ts","sourceRoot":"","sources":["../../src/core/playwrightService.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,kCAAkC,EAClC,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"playwrightService.d.ts","sourceRoot":"","sources":["../../src/core/playwrightService.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,kCAAkC,EAClC,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAgBzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,QAAA,MAAM,gBAAgB,WACZ,qBAAqB,YACnB,kCAAkC,KAC3C,gBA+GF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,QAAA,MAAM,iBAAiB,aACX,IAAI,CAAC,kCAAkC,EAAE,iBAAiB,CAAC,KACpE,OAAO,CAAC,qBAAqB,CAoB/B,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -9,6 +9,7 @@ const customerConfig_1 = tslib_1.__importDefault(require("../common/customerConf
|
|
|
9
9
|
const playwrightServiceConfig_1 = require("../common/playwrightServiceConfig");
|
|
10
10
|
const playwrightServiceEntra_1 = tslib_1.__importDefault(require("./playwrightServiceEntra"));
|
|
11
11
|
const utils_1 = require("../utils/utils");
|
|
12
|
+
const messages_1 = require("../common/messages");
|
|
12
13
|
/**
|
|
13
14
|
* @public
|
|
14
15
|
*
|
|
@@ -42,14 +43,48 @@ const utils_1 = require("../utils/utils");
|
|
|
42
43
|
const getServiceConfig = (config, options) => {
|
|
43
44
|
(0, utils_1.validatePlaywrightVersion)();
|
|
44
45
|
(0, utils_1.validateServiceUrl)();
|
|
46
|
+
const playwrightVersionInfo = (0, utils_1.getVersionInfo)((0, utils_1.getPlaywrightVersion)());
|
|
47
|
+
const isMultipleGlobalFileSupported = playwrightVersionInfo.major >= 1 && playwrightVersionInfo.minor >= 49;
|
|
45
48
|
if (options === null || options === void 0 ? void 0 : options.credential) {
|
|
46
49
|
playwrightServiceEntra_1.default.entraIdAccessToken = options.credential;
|
|
47
50
|
}
|
|
48
|
-
if
|
|
49
|
-
|
|
51
|
+
// if global setup/teardown is string -
|
|
52
|
+
// 1. if multiple global file is supported, convert it to array
|
|
53
|
+
// 2. wrap playwright-service global setup/teardown with customer provided global setup/teardown
|
|
54
|
+
// if global setup/teardown is array -
|
|
55
|
+
// 1. if multiple global file is not supported, throw error
|
|
56
|
+
// 2. append playwright-service global setup/teardown with customer provided global setup/teardown
|
|
57
|
+
if (config && config.globalSetup) {
|
|
58
|
+
if (typeof config.globalSetup === "string") {
|
|
59
|
+
if (isMultipleGlobalFileSupported) {
|
|
60
|
+
customerConfig_1.default.globalSetup = [config.globalSetup];
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
customerConfig_1.default.globalSetup = config.globalSetup;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
if (!isMultipleGlobalFileSupported) {
|
|
68
|
+
throw new Error(messages_1.ServiceErrorMessageConstants.MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR.message);
|
|
69
|
+
}
|
|
70
|
+
customerConfig_1.default.globalSetup = config.globalSetup;
|
|
71
|
+
}
|
|
50
72
|
}
|
|
51
|
-
if (config.globalTeardown) {
|
|
52
|
-
|
|
73
|
+
if (config && config.globalTeardown) {
|
|
74
|
+
if (typeof config.globalTeardown === "string") {
|
|
75
|
+
if (isMultipleGlobalFileSupported) {
|
|
76
|
+
customerConfig_1.default.globalTeardown = [config.globalTeardown];
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
customerConfig_1.default.globalTeardown = config.globalTeardown;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
if (!isMultipleGlobalFileSupported) {
|
|
84
|
+
throw new Error(messages_1.ServiceErrorMessageConstants.MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR.message);
|
|
85
|
+
}
|
|
86
|
+
customerConfig_1.default.globalTeardown = config.globalTeardown;
|
|
87
|
+
}
|
|
53
88
|
}
|
|
54
89
|
const playwrightServiceConfig = new playwrightServiceConfig_1.PlaywrightServiceConfig();
|
|
55
90
|
playwrightServiceConfig.setOptions(options);
|
|
@@ -60,8 +95,24 @@ const getServiceConfig = (config, options) => {
|
|
|
60
95
|
(0, utils_1.validateMptPAT)(utils_1.exitWithFailureMessage);
|
|
61
96
|
}
|
|
62
97
|
else {
|
|
63
|
-
|
|
64
|
-
|
|
98
|
+
// If multiple global file is supported, append playwright-service global setup/teardown with customer provided global setup/teardown
|
|
99
|
+
if (isMultipleGlobalFileSupported) {
|
|
100
|
+
globalFunctions.globalSetup = [];
|
|
101
|
+
globalFunctions.globalTeardown = [];
|
|
102
|
+
if (customerConfig_1.default.globalSetup) {
|
|
103
|
+
globalFunctions.globalSetup.push(...customerConfig_1.default.globalSetup);
|
|
104
|
+
}
|
|
105
|
+
if (customerConfig_1.default.globalTeardown) {
|
|
106
|
+
globalFunctions.globalTeardown.push(...customerConfig_1.default.globalTeardown);
|
|
107
|
+
}
|
|
108
|
+
globalFunctions.globalSetup.push(require.resolve("./global/playwright-service-global-setup"));
|
|
109
|
+
globalFunctions.globalTeardown.push(require.resolve("./global/playwright-service-global-teardown"));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
// If multiple global file is not supported, wrap playwright-service global setup/teardown with customer provided global setup/teardown
|
|
113
|
+
globalFunctions.globalSetup = require.resolve("./global/playwright-service-global-setup");
|
|
114
|
+
globalFunctions.globalTeardown = require.resolve("./global/playwright-service-global-teardown");
|
|
115
|
+
}
|
|
65
116
|
}
|
|
66
117
|
if ((options === null || options === void 0 ? void 0 : options.useCloudHostedBrowsers) === false) {
|
|
67
118
|
return Object.assign({}, globalFunctions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwrightService.js","sourceRoot":"","sources":["../../src/core/playwrightService.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,mDAAgF;AAChF,sFAAsD;AACtD,+EAA4E;AAC5E,8FAA8D;AAO9D,0CAUwB;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,gBAAgB,GAAG,CACvB,MAA6B,EAC7B,OAA4C,EAC1B,EAAE;IACpB,IAAA,iCAAyB,GAAE,CAAC;IAC5B,IAAA,0BAAkB,GAAE,CAAC;IACrB,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,EAAE,CAAC;QACxB,gCAAsB,CAAC,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;IACjE,CAAC;IACD,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,wBAAc,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IAClD,CAAC;IACD,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;QAC1B,wBAAc,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IACxD,CAAC;IAED,MAAM,uBAAuB,GAAG,IAAI,iDAAuB,EAAE,CAAC;IAC9D,uBAAuB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAA,wBAAgB,GAAE,CAAC;IAEnB,MAAM,eAAe,GAAQ,EAAE,CAAC;IAChC,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CA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AAE,CAAC;IAC9D,uBAAuB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAE5C,MAAM,KAAK,GAAG,MAAM,IAAA,kCAA0B,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,CAAC,CAAC;IACpE,OAAO;QACL,UAAU,EAAE,IAAA,4BAAoB,EAC9B,uBAAuB,CAAC,KAAK,EAC7B,uBAAuB,CAAC,SAAS,CAClC;QACD,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,sBAAsB,EAAE,uCAAuC,IAAA,yBAAiB,GAAE,EAAE;aACrF;YACD,OAAO,EAAE,uBAAuB,CAAC,OAAO;YACxC,aAAa,EAAE,uBAAuB,CAAC,aAAa;YACpD,MAAM,EAAE,uBAAuB,CAAC,MAAM;SACvC;KACF,CAAC;AACJ,CAAC,CAAC;AAEyB,8CAAiB","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { InternalEnvironmentVariables, ServiceAuth } from \"../common/constants\";\nimport customerConfig from \"../common/customerConfig\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig\";\nimport playwrightServiceEntra from \"./playwrightServiceEntra\";\nimport type {\n PlaywrightServiceAdditionalOptions,\n PlaywrightConfig,\n PlaywrightConfigInput,\n BrowserConnectOptions,\n} from \"../common/types\";\nimport {\n emitReportingUrl,\n fetchOrValidateAccessToken,\n getAccessToken,\n getServiceWSEndpoint,\n validateMptPAT,\n validatePlaywrightVersion,\n validateServiceUrl,\n exitWithFailureMessage,\n getPackageVersion,\n} from \"../utils/utils\";\n\n/**\n * @public\n *\n * Generate playwright configuration integrated with Microsoft Playwright Testing.\n *\n * @param config - base playwright configuration\n * @param options - additional options for the service\n * @returns PlaywrightConfig\n *\n * @example\n * ```\n * import { defineConfig } from \"playwright/test\";\n * import { getServiceConfig } from \"@azure/microsoft-playwright-testing\";\n * import playwrightConfig from \"./playwright.config\";\n *\n * export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig));\n * ```\n *\n * @example\n * ```\n * import { defineConfig } from \"playwright/test\";\n * import { getServiceConfig, ServiceOS } from \"@azure/microsoft-playwright-testing\";\n * import playwrightConfig from \"./playwright.config\";\n *\n * export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig, {\n * runId: \"custom run id\",\n * os: ServiceOS.WINDOWS\n * }));\n * ```\n */\nconst getServiceConfig = (\n config: PlaywrightConfigInput,\n options?: PlaywrightServiceAdditionalOptions,\n): PlaywrightConfig => {\n validatePlaywrightVersion();\n validateServiceUrl();\n if (options?.credential) {\n playwrightServiceEntra.entraIdAccessToken = options.credential;\n }\n if (config.globalSetup) {\n customerConfig.globalSetup = config.globalSetup;\n }\n if (config.globalTeardown) {\n customerConfig.globalTeardown = config.globalTeardown;\n }\n\n const playwrightServiceConfig = new PlaywrightServiceConfig();\n playwrightServiceConfig.setOptions(options);\n emitReportingUrl();\n\n const globalFunctions: any = {};\n if (options?.serviceAuthType === ServiceAuth.ACCESS_TOKEN) {\n // mpt PAT requested and set by the customer, no need to setup entra lifecycle handlers\n validateMptPAT(exitWithFailureMessage);\n } else {\n globalFunctions.globalSetup = require.resolve(\"./global/playwright-service-global-setup\");\n globalFunctions.globalTeardown = require.resolve(\"./global/playwright-service-global-teardown\");\n }\n\n if (options?.useCloudHostedBrowsers === false) {\n return {\n ...globalFunctions,\n };\n }\n if (!process.env[InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED]) {\n process.env[InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED] = \"true\";\n console.log(\"\\nRunning tests using Microsoft Playwright Testing service.\");\n }\n\n return {\n use: {\n connectOptions: {\n wsEndpoint: getServiceWSEndpoint(\n playwrightServiceConfig.runId,\n playwrightServiceConfig.serviceOs,\n ),\n headers: {\n Authorization: `Bearer ${getAccessToken()}`,\n \"x-ms-package-version\": `@azure/microsoft-playwright-testing/${getPackageVersion()}`,\n },\n timeout: playwrightServiceConfig.timeout,\n exposeNetwork: playwrightServiceConfig.exposeNetwork,\n slowMo: playwrightServiceConfig.slowMo,\n },\n },\n ...globalFunctions,\n };\n};\n\n/**\n * @public\n *\n * Get connect options required to connect to Microsoft Playwright Testing's cloud hosted browsers.\n *\n * @param options - additional options for the service\n * @returns BrowserConnectOptions\n *\n * @example\n * ```\n * import playwright, { test, expect, BrowserType } from \"@playwright/test\";\n * import { getConnectOptions } from \"@azure/microsoft-playwright-testing\";\n *\n * test('has title', async ({ browserName }) => {\n * const { wsEndpoint, options } = await getConnectOptions();\n * const browser = await (playwright[browserName] as BrowserType).connect(wsEndpoint, options);\n * const context = await browser.newContext();\n * const page = await context.newPage();\n *\n * await page.goto('https://playwright.dev/');\n * await expect(page).toHaveTitle(/Playwright/);\n *\n * await page.close();\n * await context.close();\n * await browser.close();\n * });\n * ```\n */\nconst getConnectOptions = async (\n options?: Omit<PlaywrightServiceAdditionalOptions, \"serviceAuthType\">,\n): Promise<BrowserConnectOptions> => {\n const playwrightServiceConfig = new PlaywrightServiceConfig();\n playwrightServiceConfig.setOptions(options);\n\n const token = await fetchOrValidateAccessToken(options?.credential);\n return {\n wsEndpoint: getServiceWSEndpoint(\n playwrightServiceConfig.runId,\n playwrightServiceConfig.serviceOs,\n ),\n options: {\n headers: {\n Authorization: `Bearer ${token}`,\n \"x-ms-package-version\": `@azure/microsoft-playwright-testing/${getPackageVersion()}`,\n },\n timeout: playwrightServiceConfig.timeout,\n exposeNetwork: playwrightServiceConfig.exposeNetwork,\n slowMo: playwrightServiceConfig.slowMo,\n },\n };\n};\n\nexport { getServiceConfig, getConnectOptions };\n"]}
|
|
1
|
+
{"version":3,"file":"playwrightService.js","sourceRoot":"","sources":["../../src/core/playwrightService.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,mDAAgF;AAChF,sFAAsD;AACtD,+EAA4E;AAC5E,8FAA8D;AAO9D,0CAYwB;AACxB,iDAAkE;AAEl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7B,OAAqE,EACrC,EAAE;IAClC,MAAM,uBAAuB,GAAG,IAAI,iDAAuB,EAAE,CAAC;IAC9D,uBAAuB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAE5C,MAAM,KAAK,GAAG,MAAM,IAAA,kCAA0B,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,CAAC,CAAC;IACpE,OAAO;QACL,UAAU,EAAE,IAAA,4BAAoB,EAC9B,uBAAuB,CAAC,KAAK,EAC7B,uBAAuB,CAAC,SAAS,CAClC;QACD,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,sBAAsB,EAAE,uCAAuC,IAAA,yBAAiB,GAAE,EAAE;aACrF;YACD,OAAO,EAAE,uBAAuB,CAAC,OAAO;YACxC,aAAa,EAAE,uBAAuB,CAAC,aAAa;YACpD,MAAM,EAAE,uBAAuB,CAAC,MAAM;SACvC;KACF,CAAC;AACJ,CAAC,CAAC;AAEyB,8CAAiB","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { InternalEnvironmentVariables, ServiceAuth } from \"../common/constants\";\nimport customerConfig from \"../common/customerConfig\";\nimport { PlaywrightServiceConfig } from \"../common/playwrightServiceConfig\";\nimport playwrightServiceEntra from \"./playwrightServiceEntra\";\nimport type {\n PlaywrightServiceAdditionalOptions,\n PlaywrightConfig,\n PlaywrightConfigInput,\n BrowserConnectOptions,\n} from \"../common/types\";\nimport {\n emitReportingUrl,\n fetchOrValidateAccessToken,\n getAccessToken,\n getServiceWSEndpoint,\n validateMptPAT,\n validatePlaywrightVersion,\n validateServiceUrl,\n exitWithFailureMessage,\n getPackageVersion,\n getPlaywrightVersion,\n getVersionInfo,\n} from \"../utils/utils\";\nimport { ServiceErrorMessageConstants } from \"../common/messages\";\n\n/**\n * @public\n *\n * Generate playwright configuration integrated with Microsoft Playwright Testing.\n *\n * @param config - base playwright configuration\n * @param options - additional options for the service\n * @returns PlaywrightConfig\n *\n * @example\n * ```\n * import { defineConfig } from \"playwright/test\";\n * import { getServiceConfig } from \"@azure/microsoft-playwright-testing\";\n * import playwrightConfig from \"./playwright.config\";\n *\n * export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig));\n * ```\n *\n * @example\n * ```\n * import { defineConfig } from \"playwright/test\";\n * import { getServiceConfig, ServiceOS } from \"@azure/microsoft-playwright-testing\";\n * import playwrightConfig from \"./playwright.config\";\n *\n * export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig, {\n * runId: \"custom run id\",\n * os: ServiceOS.WINDOWS\n * }));\n * ```\n */\nconst getServiceConfig = (\n config: PlaywrightConfigInput,\n options?: PlaywrightServiceAdditionalOptions,\n): PlaywrightConfig => {\n validatePlaywrightVersion();\n validateServiceUrl();\n const playwrightVersionInfo = getVersionInfo(getPlaywrightVersion());\n const isMultipleGlobalFileSupported =\n playwrightVersionInfo.major >= 1 && playwrightVersionInfo.minor >= 49;\n if (options?.credential) {\n playwrightServiceEntra.entraIdAccessToken = options.credential;\n }\n\n // if global setup/teardown is string -\n // 1. if multiple global file is supported, convert it to array\n // 2. wrap playwright-service global setup/teardown with customer provided global setup/teardown\n\n // if global setup/teardown is array -\n // 1. if multiple global file is not supported, throw error\n // 2. append playwright-service global setup/teardown with customer provided global setup/teardown\n if (config && config.globalSetup) {\n if (typeof config.globalSetup === \"string\") {\n if (isMultipleGlobalFileSupported) {\n customerConfig.globalSetup = [config.globalSetup];\n } else {\n customerConfig.globalSetup = config.globalSetup;\n }\n } else {\n if (!isMultipleGlobalFileSupported) {\n throw new Error(\n ServiceErrorMessageConstants.MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR.message,\n );\n }\n customerConfig.globalSetup = config.globalSetup;\n }\n }\n\n if (config && config.globalTeardown) {\n if (typeof config.globalTeardown === \"string\") {\n if (isMultipleGlobalFileSupported) {\n customerConfig.globalTeardown = [config.globalTeardown];\n } else {\n customerConfig.globalTeardown = config.globalTeardown;\n }\n } else {\n if (!isMultipleGlobalFileSupported) {\n throw new Error(\n ServiceErrorMessageConstants.MULTIPLE_SETUP_FILE_PLAYWRIGHT_VERSION_ERROR.message,\n );\n }\n customerConfig.globalTeardown = config.globalTeardown;\n }\n }\n\n const playwrightServiceConfig = new PlaywrightServiceConfig();\n playwrightServiceConfig.setOptions(options);\n emitReportingUrl();\n\n const globalFunctions: any = {};\n if (options?.serviceAuthType === ServiceAuth.ACCESS_TOKEN) {\n // mpt PAT requested and set by the customer, no need to setup entra lifecycle handlers\n validateMptPAT(exitWithFailureMessage);\n } else {\n // If multiple global file is supported, append playwright-service global setup/teardown with customer provided global setup/teardown\n if (isMultipleGlobalFileSupported) {\n globalFunctions.globalSetup = [] as string[];\n globalFunctions.globalTeardown = [] as string[];\n if (customerConfig.globalSetup) {\n globalFunctions.globalSetup.push(...(customerConfig.globalSetup as string[]));\n }\n if (customerConfig.globalTeardown) {\n globalFunctions.globalTeardown.push(...(customerConfig.globalTeardown as string[]));\n }\n globalFunctions.globalSetup.push(require.resolve(\"./global/playwright-service-global-setup\"));\n globalFunctions.globalTeardown.push(\n require.resolve(\"./global/playwright-service-global-teardown\"),\n );\n } else {\n // If multiple global file is not supported, wrap playwright-service global setup/teardown with customer provided global setup/teardown\n globalFunctions.globalSetup = require.resolve(\"./global/playwright-service-global-setup\");\n globalFunctions.globalTeardown = require.resolve(\n \"./global/playwright-service-global-teardown\",\n );\n }\n }\n\n if (options?.useCloudHostedBrowsers === false) {\n return {\n ...globalFunctions,\n };\n }\n if (!process.env[InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED]) {\n process.env[InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED] = \"true\";\n console.log(\"\\nRunning tests using Microsoft Playwright Testing service.\");\n }\n\n return {\n use: {\n connectOptions: {\n wsEndpoint: getServiceWSEndpoint(\n playwrightServiceConfig.runId,\n playwrightServiceConfig.serviceOs,\n ),\n headers: {\n Authorization: `Bearer ${getAccessToken()}`,\n \"x-ms-package-version\": `@azure/microsoft-playwright-testing/${getPackageVersion()}`,\n },\n timeout: playwrightServiceConfig.timeout,\n exposeNetwork: playwrightServiceConfig.exposeNetwork,\n slowMo: playwrightServiceConfig.slowMo,\n },\n },\n ...globalFunctions,\n };\n};\n\n/**\n * @public\n *\n * Get connect options required to connect to Microsoft Playwright Testing's cloud hosted browsers.\n *\n * @param options - additional options for the service\n * @returns BrowserConnectOptions\n *\n * @example\n * ```\n * import playwright, { test, expect, BrowserType } from \"@playwright/test\";\n * import { getConnectOptions } from \"@azure/microsoft-playwright-testing\";\n *\n * test('has title', async ({ browserName }) => {\n * const { wsEndpoint, options } = await getConnectOptions();\n * const browser = await (playwright[browserName] as BrowserType).connect(wsEndpoint, options);\n * const context = await browser.newContext();\n * const page = await context.newPage();\n *\n * await page.goto('https://playwright.dev/');\n * await expect(page).toHaveTitle(/Playwright/);\n *\n * await page.close();\n * await context.close();\n * await browser.close();\n * });\n * ```\n */\nconst getConnectOptions = async (\n options?: Omit<PlaywrightServiceAdditionalOptions, \"serviceAuthType\">,\n): Promise<BrowserConnectOptions> => {\n const playwrightServiceConfig = new PlaywrightServiceConfig();\n playwrightServiceConfig.setOptions(options);\n\n const token = await fetchOrValidateAccessToken(options?.credential);\n return {\n wsEndpoint: getServiceWSEndpoint(\n playwrightServiceConfig.runId,\n playwrightServiceConfig.serviceOs,\n ),\n options: {\n headers: {\n Authorization: `Bearer ${token}`,\n \"x-ms-package-version\": `@azure/microsoft-playwright-testing/${getPackageVersion()}`,\n },\n timeout: playwrightServiceConfig.timeout,\n exposeNetwork: playwrightServiceConfig.exposeNetwork,\n slowMo: playwrightServiceConfig.slowMo,\n },\n };\n};\n\nexport { getServiceConfig, getConnectOptions };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/microsoft-playwright-testing",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.20241127.1",
|
|
4
4
|
"description": "Package to integrate your Playwright test suite with Microsoft Playwright Testing service",
|
|
5
5
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/microsoft-playwright-testing/README.md",
|
|
6
6
|
"sdk-type": "client",
|
|
@@ -1,114 +1,162 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Microsoft Playwright Testing
|
|
3
|
-
* feature to publish test results and related artifacts and
|
|
4
|
-
* view them in the service portal for faster and easier troubleshooting.
|
|
2
|
+
* Library for integrating Microsoft Playwright Testing with existing playwright projects.
|
|
5
3
|
*
|
|
6
4
|
* @packageDocumentation
|
|
7
5
|
*/
|
|
8
6
|
|
|
9
|
-
import type {
|
|
10
|
-
import type { FullResult } from '@playwright/test/reporter';
|
|
11
|
-
import type { Reporter } from '@playwright/test/reporter';
|
|
12
|
-
import type { Suite } from '@playwright/test/reporter';
|
|
13
|
-
import type { TestCase } from '@playwright/test/reporter';
|
|
14
|
-
import type { TestResult } from '@playwright/test/reporter';
|
|
7
|
+
import type { TokenCredential } from '@azure/identity';
|
|
15
8
|
|
|
16
9
|
/**
|
|
17
10
|
* @public
|
|
18
11
|
*
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
* Authentication types supported by Microsoft Playwright Testing.
|
|
13
|
+
*/
|
|
14
|
+
export declare type AuthenticationType = (typeof ServiceAuth)[keyof typeof ServiceAuth];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @public
|
|
22
18
|
*
|
|
23
|
-
*
|
|
19
|
+
* Browser connect options for the service. This includes endpoint options and connect options.
|
|
24
20
|
*
|
|
21
|
+
* @example
|
|
25
22
|
* ```
|
|
26
|
-
* import {
|
|
23
|
+
* import playwright, { test, expect, BrowserType } from "@playwright/test";
|
|
24
|
+
* import { getConnectOptions, BrowserConnectOptions } from "@azure/microsoft-playwright-testing";
|
|
27
25
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* test("has title", async ({ browserName }) => {
|
|
27
|
+
* const { wsEndpoint, options } : BrowserConnectOptions = await getConnectOptions();
|
|
28
|
+
* const browser = await (playwright[browserName] as BrowserType).connect(wsEndpoint, options);
|
|
29
|
+
* const context = await browser.newContext();
|
|
30
|
+
* const page = await context.newPage();
|
|
31
|
+
*
|
|
32
|
+
* await page.goto("https://playwright.dev/");
|
|
33
|
+
* await expect(page).toHaveTitle(/Playwright/);
|
|
34
|
+
*
|
|
35
|
+
* await page.close();
|
|
36
|
+
* await context.close();
|
|
37
|
+
* await browser.close();
|
|
30
38
|
* });
|
|
31
39
|
* ```
|
|
32
40
|
*/
|
|
33
|
-
declare
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
private sasUri;
|
|
52
|
-
private uploadMetadata;
|
|
53
|
-
private numWorkers;
|
|
54
|
-
private testRunUrl;
|
|
55
|
-
private enableResultPublish;
|
|
56
|
-
constructor(config: Partial<MPTReporterConfig>);
|
|
57
|
-
private _addError;
|
|
58
|
-
private _addInformationalMessage;
|
|
59
|
-
private _addKeyToInformationMessage;
|
|
60
|
-
private _isInformationMessagePresent;
|
|
61
|
-
private _reporterFailureHandler;
|
|
41
|
+
export declare type BrowserConnectOptions = EndpointOptions & {
|
|
42
|
+
options: ConnectOptions;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @public
|
|
47
|
+
*
|
|
48
|
+
* Connect options for the service.
|
|
49
|
+
*/
|
|
50
|
+
export declare type ConnectOptions = {
|
|
51
|
+
/**
|
|
52
|
+
* @public
|
|
53
|
+
*
|
|
54
|
+
* Additional HTTP headers to be sent with web socket connect request.
|
|
55
|
+
*/
|
|
56
|
+
headers?: {
|
|
57
|
+
[key: string]: string;
|
|
58
|
+
};
|
|
62
59
|
/**
|
|
63
60
|
* @public
|
|
64
61
|
*
|
|
65
|
-
*
|
|
62
|
+
* Exposes network available on the connecting client to the browser being connected to.
|
|
66
63
|
*
|
|
67
|
-
* @
|
|
68
|
-
* @param suite - The root suite that contains all projects, files and test cases.
|
|
64
|
+
* @defaultValue `<loopback>`
|
|
69
65
|
*/
|
|
70
|
-
|
|
66
|
+
exposeNetwork?: string;
|
|
71
67
|
/**
|
|
72
68
|
* @public
|
|
73
69
|
*
|
|
74
|
-
*
|
|
70
|
+
* Maximum time in milliseconds to wait for the connection to be established.
|
|
75
71
|
*
|
|
76
|
-
* @
|
|
77
|
-
* @param result - Result of the test run.
|
|
72
|
+
* @defaultValue `30000`
|
|
78
73
|
*/
|
|
79
|
-
|
|
74
|
+
timeout?: number;
|
|
80
75
|
/**
|
|
81
76
|
* @public
|
|
82
77
|
*
|
|
83
|
-
*
|
|
84
|
-
* and Playwright Test will await it. Reporter is allowed to override the status and hence affect the exit code of the
|
|
85
|
-
* test runner.
|
|
78
|
+
* Slows down Playwright operations by the specified amount of milliseconds.
|
|
86
79
|
*
|
|
87
|
-
* @
|
|
88
|
-
* - `'passed'` - Everything went as expected.
|
|
89
|
-
* - `'failed'` - Any test has failed.
|
|
90
|
-
* - `'timedout'` - The
|
|
91
|
-
* {@link https://playwright.dev/docs/api/class-testconfig#test-config-global-timeout | testConfig.globalTimeout} has
|
|
92
|
-
* been reached.
|
|
93
|
-
* - `'interrupted'` - Interrupted by the user.
|
|
80
|
+
* @defaultValue `0`
|
|
94
81
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
82
|
+
slowMo?: number;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @public
|
|
87
|
+
*
|
|
88
|
+
* Endpoint options for the service.
|
|
89
|
+
*/
|
|
90
|
+
export declare type EndpointOptions = {
|
|
103
91
|
/**
|
|
104
92
|
* @public
|
|
105
93
|
*
|
|
106
|
-
*
|
|
107
|
-
* user experience. If your reporter does not print to the terminal, it is strongly recommended to return `false`.
|
|
94
|
+
* A browser websocket endpoint to connect to.
|
|
108
95
|
*/
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
96
|
+
wsEndpoint: string;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @public
|
|
101
|
+
*
|
|
102
|
+
* Get connect options required to connect to Microsoft Playwright Testing's cloud hosted browsers.
|
|
103
|
+
*
|
|
104
|
+
* @param options - additional options for the service
|
|
105
|
+
* @returns BrowserConnectOptions
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```
|
|
109
|
+
* import playwright, { test, expect, BrowserType } from "@playwright/test";
|
|
110
|
+
* import { getConnectOptions } from "@azure/microsoft-playwright-testing";
|
|
111
|
+
*
|
|
112
|
+
* test('has title', async ({ browserName }) => {
|
|
113
|
+
* const { wsEndpoint, options } = await getConnectOptions();
|
|
114
|
+
* const browser = await (playwright[browserName] as BrowserType).connect(wsEndpoint, options);
|
|
115
|
+
* const context = await browser.newContext();
|
|
116
|
+
* const page = await context.newPage();
|
|
117
|
+
*
|
|
118
|
+
* await page.goto('https://playwright.dev/');
|
|
119
|
+
* await expect(page).toHaveTitle(/Playwright/);
|
|
120
|
+
*
|
|
121
|
+
* await page.close();
|
|
122
|
+
* await context.close();
|
|
123
|
+
* await browser.close();
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare const getConnectOptions: (options?: Omit<PlaywrightServiceAdditionalOptions, "serviceAuthType">) => Promise<BrowserConnectOptions>;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @public
|
|
131
|
+
*
|
|
132
|
+
* Generate playwright configuration integrated with Microsoft Playwright Testing.
|
|
133
|
+
*
|
|
134
|
+
* @param config - base playwright configuration
|
|
135
|
+
* @param options - additional options for the service
|
|
136
|
+
* @returns PlaywrightConfig
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```
|
|
140
|
+
* import { defineConfig } from "playwright/test";
|
|
141
|
+
* import { getServiceConfig } from "@azure/microsoft-playwright-testing";
|
|
142
|
+
* import playwrightConfig from "./playwright.config";
|
|
143
|
+
*
|
|
144
|
+
* export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig));
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```
|
|
149
|
+
* import { defineConfig } from "playwright/test";
|
|
150
|
+
* import { getServiceConfig, ServiceOS } from "@azure/microsoft-playwright-testing";
|
|
151
|
+
* import playwrightConfig from "./playwright.config";
|
|
152
|
+
*
|
|
153
|
+
* export default defineConfig(playwrightConfig, getServiceConfig(playwrightConfig, {
|
|
154
|
+
* runId: "custom run id",
|
|
155
|
+
* os: ServiceOS.WINDOWS
|
|
156
|
+
* }));
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
export declare const getServiceConfig: (config: PlaywrightConfigInput, options?: PlaywrightServiceAdditionalOptions) => PlaywrightConfig;
|
|
112
160
|
|
|
113
161
|
/**
|
|
114
162
|
* @public
|
|
@@ -127,7 +175,7 @@ export default MPTReporter;
|
|
|
127
175
|
* });
|
|
128
176
|
* ```
|
|
129
177
|
*/
|
|
130
|
-
declare interface MPTReporterConfig {
|
|
178
|
+
export declare interface MPTReporterConfig {
|
|
131
179
|
/**
|
|
132
180
|
* @public
|
|
133
181
|
*
|
|
@@ -146,4 +194,166 @@ declare interface MPTReporterConfig {
|
|
|
146
194
|
enableResultPublish?: boolean;
|
|
147
195
|
}
|
|
148
196
|
|
|
197
|
+
/**
|
|
198
|
+
* @public
|
|
199
|
+
*
|
|
200
|
+
* OS Types supported by Microsoft Playwright Testing.
|
|
201
|
+
*/
|
|
202
|
+
export declare type OsType = (typeof ServiceOS)[keyof typeof ServiceOS];
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @public
|
|
206
|
+
*
|
|
207
|
+
* Playwright configuration integrated with Microsoft Playwright Testing.
|
|
208
|
+
*
|
|
209
|
+
* @remarks
|
|
210
|
+
*
|
|
211
|
+
* GlobalSetup and globalTeardown wraps around any existing global setup
|
|
212
|
+
* and teardown present in the base playwright configuration and runs it.
|
|
213
|
+
*/
|
|
214
|
+
export declare type PlaywrightConfig = {
|
|
215
|
+
use?: {
|
|
216
|
+
connectOptions: BrowserConnectOptions;
|
|
217
|
+
};
|
|
218
|
+
globalSetup?: string | string[];
|
|
219
|
+
globalTeardown?: string | string[];
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @public
|
|
224
|
+
*
|
|
225
|
+
* Base playwright configuration inputs required for generating the service config.
|
|
226
|
+
*/
|
|
227
|
+
export declare type PlaywrightConfigInput = {
|
|
228
|
+
/**
|
|
229
|
+
* @public
|
|
230
|
+
*
|
|
231
|
+
* Path to the global setup file. This file will be required and run before all the tests. It must export a single
|
|
232
|
+
* function that takes a [`TestConfig`] argument.
|
|
233
|
+
*
|
|
234
|
+
* Learn more about {@link https://playwright.dev/docs/test-global-setup-teardown | global setup and teardown}.
|
|
235
|
+
*/
|
|
236
|
+
globalSetup?: string | string[];
|
|
237
|
+
/**
|
|
238
|
+
* @public
|
|
239
|
+
*
|
|
240
|
+
* Path to the global teardown file. This file will be required and run after all the tests. It must export a single
|
|
241
|
+
* function. See also
|
|
242
|
+
* {@link https://playwright.dev/docs/api/class-testconfig#test-config-global-teardown | testConfig.globalTeardown}.
|
|
243
|
+
*
|
|
244
|
+
* Learn more about {@link https://playwright.dev/docs/test-global-setup-teardown | global setup and teardown}.
|
|
245
|
+
*/
|
|
246
|
+
globalTeardown?: string | string[];
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* @public
|
|
251
|
+
*
|
|
252
|
+
* Additional options for the service.
|
|
253
|
+
*/
|
|
254
|
+
export declare type PlaywrightServiceAdditionalOptions = {
|
|
255
|
+
/**
|
|
256
|
+
* @public
|
|
257
|
+
*
|
|
258
|
+
* Authentication types supported by Microsoft Playwright Testing.
|
|
259
|
+
*
|
|
260
|
+
* @defaultValue `ENTRA_ID`
|
|
261
|
+
*/
|
|
262
|
+
serviceAuthType?: AuthenticationType;
|
|
263
|
+
/**
|
|
264
|
+
* @public
|
|
265
|
+
*
|
|
266
|
+
* Operating system types supported by Microsoft Playwright Testing.
|
|
267
|
+
*
|
|
268
|
+
* @defaultValue `linux`
|
|
269
|
+
*/
|
|
270
|
+
os?: OsType;
|
|
271
|
+
/**
|
|
272
|
+
* @public
|
|
273
|
+
*
|
|
274
|
+
* Run id for the test run.
|
|
275
|
+
*
|
|
276
|
+
* @defaultValue `current datetime as ISO string`
|
|
277
|
+
*/
|
|
278
|
+
runId?: string;
|
|
279
|
+
/**
|
|
280
|
+
* @public
|
|
281
|
+
*
|
|
282
|
+
* Maximum time in milliseconds to wait for the connection to be established.
|
|
283
|
+
*
|
|
284
|
+
* @defaultValue `30000`
|
|
285
|
+
*/
|
|
286
|
+
timeout?: number;
|
|
287
|
+
/**
|
|
288
|
+
* @public
|
|
289
|
+
*
|
|
290
|
+
* Slows down Playwright operations by the specified amount of milliseconds.
|
|
291
|
+
*
|
|
292
|
+
* @defaultValue `0`
|
|
293
|
+
*/
|
|
294
|
+
slowMo?: number;
|
|
295
|
+
/**
|
|
296
|
+
* @public
|
|
297
|
+
*
|
|
298
|
+
* Exposes network available on the connecting client to the browser being connected to.
|
|
299
|
+
*
|
|
300
|
+
* @defaultValue `<loopback>`
|
|
301
|
+
*/
|
|
302
|
+
exposeNetwork?: string;
|
|
303
|
+
/**
|
|
304
|
+
* @public
|
|
305
|
+
*
|
|
306
|
+
* Use cloud hosted browsers.
|
|
307
|
+
*
|
|
308
|
+
* @defaultValue `false`
|
|
309
|
+
*/
|
|
310
|
+
useCloudHostedBrowsers?: boolean;
|
|
311
|
+
/**
|
|
312
|
+
* @public
|
|
313
|
+
*
|
|
314
|
+
* Custom token credential for Entra ID authentication. Learn more at {@link https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/using-azure-identity.md | Using Azure Identity}.
|
|
315
|
+
*
|
|
316
|
+
* @defaultValue `DefaultAzureCredential`
|
|
317
|
+
*/
|
|
318
|
+
credential?: TokenCredential;
|
|
319
|
+
/**
|
|
320
|
+
* @public
|
|
321
|
+
*
|
|
322
|
+
* Run name for the test run.
|
|
323
|
+
*
|
|
324
|
+
* @defaultValue `guid`
|
|
325
|
+
*/
|
|
326
|
+
runName?: string;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
/** @public
|
|
330
|
+
*
|
|
331
|
+
* Authentication types supported on Microsoft Playwright Testing
|
|
332
|
+
*/
|
|
333
|
+
export declare const ServiceAuth: {
|
|
334
|
+
readonly ENTRA_ID: "ENTRA_ID";
|
|
335
|
+
readonly ACCESS_TOKEN: "ACCESS_TOKEN";
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
/** @public
|
|
339
|
+
*
|
|
340
|
+
* Environment variables used by Microsoft Playwright Testing
|
|
341
|
+
*/
|
|
342
|
+
export declare const ServiceEnvironmentVariable: {
|
|
343
|
+
PLAYWRIGHT_SERVICE_OS: string;
|
|
344
|
+
PLAYWRIGHT_SERVICE_EXPOSE_NETWORK_ENVIRONMENT_VARIABLE: string;
|
|
345
|
+
PLAYWRIGHT_SERVICE_ACCESS_TOKEN: string;
|
|
346
|
+
PLAYWRIGHT_SERVICE_URL: string;
|
|
347
|
+
PLAYWRIGHT_SERVICE_REPORTING_URL: string;
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
/** @public
|
|
351
|
+
*
|
|
352
|
+
* OS types supported on Microsoft Playwright Testing cloud hosted browsers
|
|
353
|
+
*/
|
|
354
|
+
export declare const ServiceOS: {
|
|
355
|
+
readonly LINUX: "linux";
|
|
356
|
+
readonly WINDOWS: "windows";
|
|
357
|
+
};
|
|
358
|
+
|
|
149
359
|
export { }
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Microsoft Playwright Testing's Reporting
|
|
3
|
+
* feature to publish test results and related artifacts and
|
|
4
|
+
* view them in the service portal for faster and easier troubleshooting.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { FullConfig } from '@playwright/test/reporter';
|
|
10
|
+
import type { FullResult } from '@playwright/test/reporter';
|
|
11
|
+
import type { Reporter } from '@playwright/test/reporter';
|
|
12
|
+
import type { Suite } from '@playwright/test/reporter';
|
|
13
|
+
import type { TestCase } from '@playwright/test/reporter';
|
|
14
|
+
import type { TestResult } from '@playwright/test/reporter';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @public
|
|
18
|
+
*
|
|
19
|
+
* Extends Playwright's Reporter class to enable Microsoft Playwright Testing's Reporting
|
|
20
|
+
* feature to publish test results and related artifacts and
|
|
21
|
+
* view them in the service portal for faster and easier troubleshooting.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
* import { defineConfig } from "@playwright/test";
|
|
27
|
+
*
|
|
28
|
+
* export default defineConfig({
|
|
29
|
+
* reporter: [["@azure/microsoft-playwright-testing/reporter"]]
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare class MPTReporter implements Reporter {
|
|
34
|
+
private isTokenValid;
|
|
35
|
+
private enableGitHubSummary;
|
|
36
|
+
private isRegionValid;
|
|
37
|
+
private shard;
|
|
38
|
+
private isTestRunStartSuccess;
|
|
39
|
+
private ciInfo;
|
|
40
|
+
private serviceClient;
|
|
41
|
+
private storageClient;
|
|
42
|
+
private reporterUtils;
|
|
43
|
+
private envVariables;
|
|
44
|
+
private testRawResults;
|
|
45
|
+
private promiseOnBegin;
|
|
46
|
+
private _testEndPromises;
|
|
47
|
+
private testResultBatch;
|
|
48
|
+
private errorMessages;
|
|
49
|
+
private informationalMessages;
|
|
50
|
+
private processedErrorMessageKeys;
|
|
51
|
+
private sasUri;
|
|
52
|
+
private uploadMetadata;
|
|
53
|
+
private numWorkers;
|
|
54
|
+
private testRunUrl;
|
|
55
|
+
private enableResultPublish;
|
|
56
|
+
constructor(config: Partial<MPTReporterConfig>);
|
|
57
|
+
private _addError;
|
|
58
|
+
private _addInformationalMessage;
|
|
59
|
+
private _addKeyToInformationMessage;
|
|
60
|
+
private _isInformationMessagePresent;
|
|
61
|
+
private _reporterFailureHandler;
|
|
62
|
+
/**
|
|
63
|
+
* @public
|
|
64
|
+
*
|
|
65
|
+
* Called once before running tests.
|
|
66
|
+
*
|
|
67
|
+
* @param config - Resolved configuration.
|
|
68
|
+
* @param suite - The root suite that contains all projects, files and test cases.
|
|
69
|
+
*/
|
|
70
|
+
onBegin(config: FullConfig, suite: Suite): void;
|
|
71
|
+
/**
|
|
72
|
+
* @public
|
|
73
|
+
*
|
|
74
|
+
* Called after a test has been finished in the worker process.
|
|
75
|
+
*
|
|
76
|
+
* @param test - Test that has been finished.
|
|
77
|
+
* @param result - Result of the test run.
|
|
78
|
+
*/
|
|
79
|
+
onTestEnd(test: TestCase, result: TestResult): void;
|
|
80
|
+
/**
|
|
81
|
+
* @public
|
|
82
|
+
*
|
|
83
|
+
* Called after all tests have been run, or testing has been interrupted. Note that this method may return a [Promise]
|
|
84
|
+
* and Playwright Test will await it. Reporter is allowed to override the status and hence affect the exit code of the
|
|
85
|
+
* test runner.
|
|
86
|
+
*
|
|
87
|
+
* @param result - Result of the full test run, `status` can be one of:
|
|
88
|
+
* - `'passed'` - Everything went as expected.
|
|
89
|
+
* - `'failed'` - Any test has failed.
|
|
90
|
+
* - `'timedout'` - The
|
|
91
|
+
* {@link https://playwright.dev/docs/api/class-testconfig#test-config-global-timeout | testConfig.globalTimeout} has
|
|
92
|
+
* been reached.
|
|
93
|
+
* - `'interrupted'` - Interrupted by the user.
|
|
94
|
+
*/
|
|
95
|
+
onEnd(result: FullResult): Promise<void>;
|
|
96
|
+
private _onBegin;
|
|
97
|
+
private _onTestEnd;
|
|
98
|
+
private _onEnd;
|
|
99
|
+
private _uploadTestResultAttachments;
|
|
100
|
+
private initializeMPTReporter;
|
|
101
|
+
private displayAdditionalInformation;
|
|
102
|
+
private processTestResult;
|
|
103
|
+
/**
|
|
104
|
+
* @public
|
|
105
|
+
*
|
|
106
|
+
* Whether this reporter uses stdio for reporting. When it does not, Playwright Test could add some output to enhance
|
|
107
|
+
* user experience. If your reporter does not print to the terminal, it is strongly recommended to return `false`.
|
|
108
|
+
*/
|
|
109
|
+
printsToStdio(): boolean;
|
|
110
|
+
}
|
|
111
|
+
export default MPTReporter;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @public
|
|
115
|
+
*
|
|
116
|
+
* Optional configuration for MPT Reporter.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
*
|
|
120
|
+
* ```
|
|
121
|
+
* import { defineConfig } from "@playwright/test";
|
|
122
|
+
*
|
|
123
|
+
* export default defineConfig({
|
|
124
|
+
* reporter: [["@azure/microsoft-playwright-testing/reporter", {
|
|
125
|
+
* enableGitHubSummary: true
|
|
126
|
+
* }]],
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
declare interface MPTReporterConfig {
|
|
131
|
+
/**
|
|
132
|
+
* @public
|
|
133
|
+
*
|
|
134
|
+
* Enable GitHub Actions annotations to diagnose test failures and deep link to MPT Portal.
|
|
135
|
+
*
|
|
136
|
+
* @defaultValue `true`
|
|
137
|
+
*/
|
|
138
|
+
enableGitHubSummary?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* @public
|
|
141
|
+
*
|
|
142
|
+
* Enable result publishing for the test run. This will upload the test result and artifacts to the MPT Portal.
|
|
143
|
+
*
|
|
144
|
+
* @defaultValue `true`
|
|
145
|
+
*/
|
|
146
|
+
enableResultPublish?: boolean;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export { }
|