@azure/create-playwright 1.0.0-alpha.20250827.1 → 1.0.0-alpha.20250828.3
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/README.md +2 -2
- package/dist/commonjs/constants.js +1 -1
- package/dist/commonjs/constants.js.map +1 -1
- package/dist/commonjs/initialize.js +2 -2
- package/dist/commonjs/initialize.js.map +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/initialize.js +2 -2
- package/dist/esm/initialize.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Azure Playwright
|
|
1
|
+
# Azure Playwright
|
|
2
2
|
|
|
3
|
-
Azure Playwright is a fully managed service that uses the cloud to enable you to run Playwright tests with much higher parallelization across different operating system-browser combinations simultaneously. This means faster test runs with broader scenario coverage, which helps speed up delivery of features without sacrificing quality. The service also enables you to publish test results and related artifacts to the service and view them in the service portal enabling faster and easier troubleshooting. With
|
|
3
|
+
Azure Playwright is a fully managed service that uses the cloud to enable you to run Playwright tests with much higher parallelization across different operating system-browser combinations simultaneously. This means faster test runs with broader scenario coverage, which helps speed up delivery of features without sacrificing quality. The service also enables you to publish test results and related artifacts to the service and view them in the service portal enabling faster and easier troubleshooting. With Playwright Workspaces, you can release features faster and more confidently.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -16,7 +16,7 @@ exports.ErrorMessages = {
|
|
|
16
16
|
UNSUPPORTED_CONFIGURATION_FILE: "The playwright configuration file passed is not supported.",
|
|
17
17
|
};
|
|
18
18
|
exports.Messages = {
|
|
19
|
-
CAN_OVERRIDE_MESSAGE: "There's already a playwright
|
|
19
|
+
CAN_OVERRIDE_MESSAGE: "There's already a playwright workspaces configuration file present. Do you want to overwrite it?",
|
|
20
20
|
CONFIRMATION_FOR_EXIT_MESSAGE: "You won't be able to install and setup up the service without overwriting the existing configuration file. Do you still want to exit the setup process?",
|
|
21
21
|
SETUP_PROCESS_EXIT_MESSAGE: "Exiting the service setup process.",
|
|
22
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAIrB,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE,YAAwB;IACpC,UAAU,EAAE,YAAwB;CACrC,CAAC;AAEW,QAAA,UAAU,GAAG;IACxB,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,KAAK;CAClB,CAAC;AAEW,QAAA,aAAa,GAAG;IAC3B,2BAA2B,EACzB,2IAA2I;IAC7I,8BAA8B,EAAE,4DAA4D;CAC7F,CAAC;AAEW,QAAA,QAAQ,GAAG;IACtB,oBAAoB,EAClB
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAIrB,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE,YAAwB;IACpC,UAAU,EAAE,YAAwB;CACrC,CAAC;AAEW,QAAA,UAAU,GAAG;IACxB,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,KAAK;CAClB,CAAC;AAEW,QAAA,aAAa,GAAG;IAC3B,2BAA2B,EACzB,2IAA2I;IAC7I,8BAA8B,EAAE,4DAA4D;CAC7F,CAAC;AAEW,QAAA,QAAQ,GAAG;IACtB,oBAAoB,EAClB,kGAAkG;IACpG,6BAA6B,EAC3B,yJAAyJ;IAC3J,0BAA0B,EAAE,oCAAoC;CACjE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Language } from \"./types.js\";\n\nexport const Languages = {\n TypeScript: \"TypeScript\" as Language,\n JavaScript: \"JavaScript\" as Language,\n};\n\nexport const Extensions = {\n TypeScript: \".ts\",\n JavaScript: \".js\",\n};\n\nexport const ErrorMessages = {\n NO_CONFIGURATION_FILE_FOUND:\n \"Could not find a playwright configuration file in the current directory. Please use --config parameter to specify the configuration file.\",\n UNSUPPORTED_CONFIGURATION_FILE: \"The playwright configuration file passed is not supported.\",\n};\n\nexport const Messages = {\n CAN_OVERRIDE_MESSAGE:\n \"There's already a playwright workspaces configuration file present. Do you want to overwrite it?\",\n CONFIRMATION_FOR_EXIT_MESSAGE:\n \"You won't be able to install and setup up the service without overwriting the existing configuration file. Do you still want to exit the setup process?\",\n SETUP_PROCESS_EXIT_MESSAGE: \"Exiting the service setup process.\",\n};\n"]}
|
|
@@ -59,10 +59,10 @@ class PlaywrightServiceInitialize {
|
|
|
59
59
|
};
|
|
60
60
|
displayAdditionalInformation = () => {
|
|
61
61
|
const runCommandParallelWorkers = this._packageManager.runCommand("playwright", `test -c ${this.createAzurePlaywrightConfigFileName()} --workers=20`);
|
|
62
|
-
console.log(`\n\nTo run playwrights tests using Playwright
|
|
62
|
+
console.log(`\n\nTo run playwrights tests using Playwright Workspaces\n`);
|
|
63
63
|
console.log(`\t${runCommandParallelWorkers}\n`);
|
|
64
64
|
console.log("Getting Started - https://aka.ms/pww/docs/quickstart\n");
|
|
65
|
-
console.log("If you're already using the
|
|
65
|
+
console.log("If you're already using the Playwright Workspaces, please review the quickstart guide [https://aka.ms/pww/docs/quickstart] to ensure your tests continue running smoothly.");
|
|
66
66
|
};
|
|
67
67
|
installServicePackage = async () => {
|
|
68
68
|
const command = this._packageManager.installDevDependencyCommand("@azure/playwright @azure/identity");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAGlC,8DAA8B;AAC9B,8DAAyB;AACzB,iDAAiE;AAMjE,yCAAuE;AACvE,2DAAwD;AAExD,MAAM,SAAS,GAAmB;IAChC;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,aAAa;QACnB,OA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CAAC;QAE9B,MAAM,OAAO,GACX,aAAa;YACb;;;;;;;;;;;CAWL,CAAC;QACE,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEM,mCAAmC,GAAG,GAAW,EAAE;QACzD,OAAO,2BAA2B,GAAG,yBAAU,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACrF,CAAC,CAAC;CACH;AA9GD,kEA8GC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PromptObject } from \"prompts\";\nimport prompts from \"prompts\";\nimport fs from \"node:fs\";\nimport { Extensions, Languages, Messages } from \"./constants.js\";\nimport type {\n OverridePromptResponse,\n PackageManager,\n PlaywrightServiceInitConfig,\n} from \"./types.js\";\nimport { executeCommand, getFileReferenceForImport } from \"./utils.js\";\nimport { getPackageManager } from \"./packageManager.js\";\n\nconst questions: PromptObject[] = [\n {\n type: \"confirm\",\n name: \"canOverride\",\n message: Messages.CAN_OVERRIDE_MESSAGE,\n initial: true,\n },\n {\n type: (prev: boolean) => (prev ? null : \"confirm\"),\n name: \"confirmationForExit\",\n message: Messages.CONFIRMATION_FOR_EXIT_MESSAGE,\n initial: true,\n },\n];\n\nexport class PlaywrightServiceInitialize {\n private _setupConfig: PlaywrightServiceInitConfig;\n private _packageManager: PackageManager;\n\n constructor(setupConfig: PlaywrightServiceInitConfig) {\n this._setupConfig = setupConfig;\n this._packageManager = getPackageManager();\n }\n\n public addServiceSupportToTestSuite = async (): Promise<void> => {\n const canProceedWithServiceInitialization = await this.checkIfServiceConfigCanBeAdded(); // if service config already present, ask user for overwrite permission\n if (!canProceedWithServiceInitialization) return;\n await this.installServicePackage(); // install service packages\n await this.createServiceConfig(); // create service config file\n this.displayAdditionalInformation(); // display additional information\n };\n\n private checkIfServiceConfigCanBeAdded = async (): Promise<boolean> => {\n if (!this.isServiceConfigFileAlreadyPresent()) return true;\n const response = (await prompts.prompt(questions, {\n onCancel: this.promptOnCancel,\n })) as OverridePromptResponse;\n if (response.canOverride) return true;\n if (!response.confirmationForExit) return this.checkIfServiceConfigCanBeAdded();\n\n console.log(`\\n${Messages.SETUP_PROCESS_EXIT_MESSAGE}`);\n return false;\n };\n\n private promptOnCancel = (): never => {\n process.exit(0);\n };\n\n private isServiceConfigFileAlreadyPresent = (): boolean => {\n return fs.existsSync(this.createAzurePlaywrightConfigFileName());\n };\n\n private displayAdditionalInformation = (): void => {\n const runCommandParallelWorkers = this._packageManager.runCommand(\n \"playwright\",\n `test -c ${this.createAzurePlaywrightConfigFileName()} --workers=20`,\n );\n\n console.log(`\\n\\nTo run playwrights tests using Playwright Workspaces\\n`);\n console.log(`\\t${runCommandParallelWorkers}\\n`);\n\n console.log(\"Getting Started - https://aka.ms/pww/docs/quickstart\\n\");\n\n console.log(\n \"If you're already using the Playwright Workspaces, please review the quickstart guide [https://aka.ms/pww/docs/quickstart] to ensure your tests continue running smoothly.\",\n );\n };\n\n private installServicePackage = async (): Promise<void> => {\n const command = this._packageManager.installDevDependencyCommand(\n \"@azure/playwright @azure/identity\",\n );\n console.log(`Installing Service package (${command})`);\n await executeCommand(command);\n };\n\n private createServiceConfig = async (): Promise<void> => {\n const serviceConfigFile = this.createAzurePlaywrightConfigFileName();\n const serviceConfigFileContent = this.createAzurePlaywrightConfigContent();\n await fs.promises.writeFile(serviceConfigFile, serviceConfigFileContent);\n console.log(`Success! Created service configuration file - ${serviceConfigFile}`);\n };\n\n private createAzurePlaywrightConfigContent = (): string => {\n const customerConfigFileName = getFileReferenceForImport(\n this._setupConfig.playwrightConfigFile,\n );\n\n const importCommandTypeScript = `import { defineConfig } from '@playwright/test';\nimport { createAzurePlaywrightConfig, ServiceOS } from '@azure/playwright';\nimport { DefaultAzureCredential } from '@azure/identity';\nimport config from '${customerConfigFileName}';\n`;\n\n const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');\nconst { createAzurePlaywrightConfig, ServiceOS } = require('@azure/playwright');\nconst { DefaultAzureCredential } = require('@azure/identity');\nconst config = require('${customerConfigFileName}');\n`;\n\n const importCommand =\n this._setupConfig.projectLanguage === Languages.TypeScript\n ? importCommandTypeScript\n : importCommandJavaScript;\n\n const content =\n importCommand +\n `\n/* Learn more about service configuration at https://aka.ms/pww/docs/config */\nexport default defineConfig(\n config,\n createAzurePlaywrightConfig(config, {\n exposeNetwork: '<loopback>',\n connectTimeout: 3 * 60 * 1000, // 3 minutes\n os: ServiceOS.LINUX,\n credential: new DefaultAzureCredential(),\n })\n);\n`;\n return content;\n };\n\n private createAzurePlaywrightConfigFileName = (): string => {\n return \"playwright.service.config\" + Extensions[this._setupConfig.projectLanguage];\n };\n}\n"]}
|
package/dist/esm/constants.js
CHANGED
|
@@ -13,7 +13,7 @@ export const ErrorMessages = {
|
|
|
13
13
|
UNSUPPORTED_CONFIGURATION_FILE: "The playwright configuration file passed is not supported.",
|
|
14
14
|
};
|
|
15
15
|
export const Messages = {
|
|
16
|
-
CAN_OVERRIDE_MESSAGE: "There's already a playwright
|
|
16
|
+
CAN_OVERRIDE_MESSAGE: "There's already a playwright workspaces configuration file present. Do you want to overwrite it?",
|
|
17
17
|
CONFIRMATION_FOR_EXIT_MESSAGE: "You won't be able to install and setup up the service without overwriting the existing configuration file. Do you still want to exit the setup process?",
|
|
18
18
|
SETUP_PROCESS_EXIT_MESSAGE: "Exiting the service setup process.",
|
|
19
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,UAAU,EAAE,YAAwB;IACpC,UAAU,EAAE,YAAwB;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,2BAA2B,EACzB,2IAA2I;IAC7I,8BAA8B,EAAE,4DAA4D;CAC7F,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,oBAAoB,EAClB
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,UAAU,EAAE,YAAwB;IACpC,UAAU,EAAE,YAAwB;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,2BAA2B,EACzB,2IAA2I;IAC7I,8BAA8B,EAAE,4DAA4D;CAC7F,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,oBAAoB,EAClB,kGAAkG;IACpG,6BAA6B,EAC3B,yJAAyJ;IAC3J,0BAA0B,EAAE,oCAAoC;CACjE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Language } from \"./types.js\";\n\nexport const Languages = {\n TypeScript: \"TypeScript\" as Language,\n JavaScript: \"JavaScript\" as Language,\n};\n\nexport const Extensions = {\n TypeScript: \".ts\",\n JavaScript: \".js\",\n};\n\nexport const ErrorMessages = {\n NO_CONFIGURATION_FILE_FOUND:\n \"Could not find a playwright configuration file in the current directory. Please use --config parameter to specify the configuration file.\",\n UNSUPPORTED_CONFIGURATION_FILE: \"The playwright configuration file passed is not supported.\",\n};\n\nexport const Messages = {\n CAN_OVERRIDE_MESSAGE:\n \"There's already a playwright workspaces configuration file present. Do you want to overwrite it?\",\n CONFIRMATION_FOR_EXIT_MESSAGE:\n \"You won't be able to install and setup up the service without overwriting the existing configuration file. Do you still want to exit the setup process?\",\n SETUP_PROCESS_EXIT_MESSAGE: \"Exiting the service setup process.\",\n};\n"]}
|
package/dist/esm/initialize.js
CHANGED
|
@@ -55,10 +55,10 @@ export class PlaywrightServiceInitialize {
|
|
|
55
55
|
};
|
|
56
56
|
displayAdditionalInformation = () => {
|
|
57
57
|
const runCommandParallelWorkers = this._packageManager.runCommand("playwright", `test -c ${this.createAzurePlaywrightConfigFileName()} --workers=20`);
|
|
58
|
-
console.log(`\n\nTo run playwrights tests using Playwright
|
|
58
|
+
console.log(`\n\nTo run playwrights tests using Playwright Workspaces\n`);
|
|
59
59
|
console.log(`\t${runCommandParallelWorkers}\n`);
|
|
60
60
|
console.log("Getting Started - https://aka.ms/pww/docs/quickstart\n");
|
|
61
|
-
console.log("If you're already using the
|
|
61
|
+
console.log("If you're already using the Playwright Workspaces, please review the quickstart guide [https://aka.ms/pww/docs/quickstart] to ensure your tests continue running smoothly.");
|
|
62
62
|
};
|
|
63
63
|
installServicePackage = async () => {
|
|
64
64
|
const command = this._packageManager.installDevDependencyCommand("@azure/playwright @azure/identity");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAMjE,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,SAAS,GAAmB;IAChC;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,QAAQ,CAAC,oBAAoB;QACtC,OAAO,EAAE,IAAI;KACd;IACD;QACE,IAAI,EAAE,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,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,MAAM,OAAO,GACX,aAAa;YACb;;;;;;;;;;;CAWL,CAAC;QACE,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEM,mCAAmC,GAAG,GAAW,EAAE;QACzD,OAAO,2BAA2B,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACrF,CAAC,CAAC;CACH","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PromptObject } from \"prompts\";\nimport prompts from \"prompts\";\nimport fs from \"node:fs\";\nimport { Extensions, Languages, Messages } from \"./constants.js\";\nimport type {\n OverridePromptResponse,\n PackageManager,\n PlaywrightServiceInitConfig,\n} from \"./types.js\";\nimport { executeCommand, getFileReferenceForImport } from \"./utils.js\";\nimport { getPackageManager } from \"./packageManager.js\";\n\nconst questions: PromptObject[] = [\n {\n type: \"confirm\",\n name: \"canOverride\",\n message: Messages.CAN_OVERRIDE_MESSAGE,\n initial: true,\n },\n {\n type: (prev: boolean) => (prev ? null : \"confirm\"),\n name: \"confirmationForExit\",\n message: Messages.CONFIRMATION_FOR_EXIT_MESSAGE,\n initial: true,\n },\n];\n\nexport class PlaywrightServiceInitialize {\n private _setupConfig: PlaywrightServiceInitConfig;\n private _packageManager: PackageManager;\n\n constructor(setupConfig: PlaywrightServiceInitConfig) {\n this._setupConfig = setupConfig;\n this._packageManager = getPackageManager();\n }\n\n public addServiceSupportToTestSuite = async (): Promise<void> => {\n const canProceedWithServiceInitialization = await this.checkIfServiceConfigCanBeAdded(); // if service config already present, ask user for overwrite permission\n if (!canProceedWithServiceInitialization) return;\n await this.installServicePackage(); // install service packages\n await this.createServiceConfig(); // create service config file\n this.displayAdditionalInformation(); // display additional information\n };\n\n private checkIfServiceConfigCanBeAdded = async (): Promise<boolean> => {\n if (!this.isServiceConfigFileAlreadyPresent()) return true;\n const response = (await prompts.prompt(questions, {\n onCancel: this.promptOnCancel,\n })) as OverridePromptResponse;\n if (response.canOverride) return true;\n if (!response.confirmationForExit) return this.checkIfServiceConfigCanBeAdded();\n\n console.log(`\\n${Messages.SETUP_PROCESS_EXIT_MESSAGE}`);\n return false;\n };\n\n private promptOnCancel = (): never => {\n process.exit(0);\n };\n\n private isServiceConfigFileAlreadyPresent = (): boolean => {\n return fs.existsSync(this.createAzurePlaywrightConfigFileName());\n };\n\n private displayAdditionalInformation = (): void => {\n const runCommandParallelWorkers = this._packageManager.runCommand(\n \"playwright\",\n `test -c ${this.createAzurePlaywrightConfigFileName()} --workers=20`,\n );\n\n console.log(`\\n\\nTo run playwrights tests using Playwright Workspaces\\n`);\n console.log(`\\t${runCommandParallelWorkers}\\n`);\n\n console.log(\"Getting Started - https://aka.ms/pww/docs/quickstart\\n\");\n\n console.log(\n \"If you're already using the Playwright Workspaces, please review the quickstart guide [https://aka.ms/pww/docs/quickstart] to ensure your tests continue running smoothly.\",\n );\n };\n\n private installServicePackage = async (): Promise<void> => {\n const command = this._packageManager.installDevDependencyCommand(\n \"@azure/playwright @azure/identity\",\n );\n console.log(`Installing Service package (${command})`);\n await executeCommand(command);\n };\n\n private createServiceConfig = async (): Promise<void> => {\n const serviceConfigFile = this.createAzurePlaywrightConfigFileName();\n const serviceConfigFileContent = this.createAzurePlaywrightConfigContent();\n await fs.promises.writeFile(serviceConfigFile, serviceConfigFileContent);\n console.log(`Success! Created service configuration file - ${serviceConfigFile}`);\n };\n\n private createAzurePlaywrightConfigContent = (): string => {\n const customerConfigFileName = getFileReferenceForImport(\n this._setupConfig.playwrightConfigFile,\n );\n\n const importCommandTypeScript = `import { defineConfig } from '@playwright/test';\nimport { createAzurePlaywrightConfig, ServiceOS } from '@azure/playwright';\nimport { DefaultAzureCredential } from '@azure/identity';\nimport config from '${customerConfigFileName}';\n`;\n\n const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');\nconst { createAzurePlaywrightConfig, ServiceOS } = require('@azure/playwright');\nconst { DefaultAzureCredential } = require('@azure/identity');\nconst config = require('${customerConfigFileName}');\n`;\n\n const importCommand =\n this._setupConfig.projectLanguage === Languages.TypeScript\n ? importCommandTypeScript\n : importCommandJavaScript;\n\n const content =\n importCommand +\n `\n/* Learn more about service configuration at https://aka.ms/pww/docs/config */\nexport default defineConfig(\n config,\n createAzurePlaywrightConfig(config, {\n exposeNetwork: '<loopback>',\n connectTimeout: 3 * 60 * 1000, // 3 minutes\n os: ServiceOS.LINUX,\n credential: new DefaultAzureCredential(),\n })\n);\n`;\n return content;\n };\n\n private createAzurePlaywrightConfigFileName = (): string => {\n return \"playwright.service.config\" + Extensions[this._setupConfig.projectLanguage];\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/create-playwright",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.20250828.3",
|
|
4
4
|
"description": "Package to setup @azure/playwright",
|
|
5
5
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/create-playwright/README.md",
|
|
6
6
|
"sdk-type": "client",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"azure",
|
|
10
10
|
"cloud",
|
|
11
11
|
"playwright",
|
|
12
|
-
"playwright
|
|
12
|
+
"playwright workspaces",
|
|
13
13
|
"reporting"
|
|
14
14
|
],
|
|
15
15
|
"author": "Microsoft Corporation",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"eslint": "^9.33.0",
|
|
46
46
|
"typescript": "~5.8.3",
|
|
47
47
|
"vitest": "^3.2.3",
|
|
48
|
-
"@azure
|
|
48
|
+
"@azure/dev-tool": "^1.0.0",
|
|
49
49
|
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
50
|
-
"@azure/
|
|
50
|
+
"@azure-tools/test-utils-vitest": "^2.0.1"
|
|
51
51
|
},
|
|
52
52
|
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
|
|
53
53
|
"//sampleConfiguration": {
|