@azure/microsoft-playwright-testing 1.0.0-alpha.20241122.1 → 1.0.0-alpha.20241126.2
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/dist/tsdoc-metadata.json +1 -1
- package/package.json +1 -1
|
@@ -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,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;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AAK,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,CAAE,eAAe,MAAK,uBAAW,CAAC,YAAY,EAAE,C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C,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;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG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,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/dist/tsdoc-metadata.json
CHANGED
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.20241126.2",
|
|
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",
|