@azure/create-microsoft-playwright-testing 1.0.0-beta.2 → 1.0.0-beta.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ Copyright (c) Microsoft Corporation.
2
2
 
3
- Copyright (c) 2024 Microsoft
3
+ MIT License
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -12,10 +12,10 @@ furnished to do so, subject to the following conditions:
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
14
14
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -10,10 +10,14 @@ const init = async () => {
10
10
  const { config: playwrightConfigFile } = options;
11
11
  let playwrightServiceInitConfig;
12
12
  if (playwrightConfigFile) {
13
- playwrightServiceInitConfig = Object.assign({}, (0, utils_js_1.getLanguageAndConfigInfoFromConfigurationFile)(playwrightConfigFile));
13
+ playwrightServiceInitConfig = {
14
+ ...(0, utils_js_1.getLanguageAndConfigInfoFromConfigurationFile)(playwrightConfigFile),
15
+ };
14
16
  }
15
17
  else {
16
- playwrightServiceInitConfig = Object.assign({}, (0, utils_js_1.getLanguageAndConfigInfoFromDirectory)());
18
+ playwrightServiceInitConfig = {
19
+ ...(0, utils_js_1.getLanguageAndConfigInfoFromDirectory)(),
20
+ };
17
21
  }
18
22
  console.log("");
19
23
  const playwrightServiceInitialize = new initialize_js_1.PlaywrightServiceInitialize(playwrightServiceInitConfig);
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/bin/init.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,oDAA+D;AAC/D,0CAIqB;AAEd,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IAC5C,MAAM,OAAO,GAAG,IAAA,4BAAiB,GAAE,CAAC;IACpC,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IACjD,IAAI,2BAAwD,CAAC;IAE7D,IAAI,oBAAoB,EAAE,CAAC;QACzB,2BAA2B,qBACtB,IAAA,wDAA6C,EAAC,oBAAoB,CAAC,CACvE,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,2BAA2B,qBACtB,IAAA,gDAAqC,GAAE,CAC3C,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,MAAM,2BAA2B,GAAG,IAAI,2CAA2B,CAAC,2BAA2B,CAAC,CAAC;IACjG,MAAM,2BAA2B,CAAC,4BAA4B,EAAE,CAAC;AACnE,CAAC,CAAC;AAlBW,QAAA,IAAI,QAkBf","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PlaywrightServiceInitConfig } from \"../types.js\";\nimport { PlaywrightServiceInitialize } from \"../initialize.js\";\nimport {\n getLanguageAndConfigInfoFromConfigurationFile,\n getLanguageAndConfigInfoFromDirectory,\n parseCLIArguments,\n} from \"../utils.js\";\n\nexport const init = async (): Promise<void> => {\n const options = parseCLIArguments();\n const { config: playwrightConfigFile } = options;\n let playwrightServiceInitConfig: PlaywrightServiceInitConfig;\n\n if (playwrightConfigFile) {\n playwrightServiceInitConfig = {\n ...getLanguageAndConfigInfoFromConfigurationFile(playwrightConfigFile),\n };\n } else {\n playwrightServiceInitConfig = {\n ...getLanguageAndConfigInfoFromDirectory(),\n };\n }\n\n console.log(\"\");\n const playwrightServiceInitialize = new PlaywrightServiceInitialize(playwrightServiceInitConfig);\n await playwrightServiceInitialize.addServiceSupportToTestSuite();\n};\n"]}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/bin/init.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,oDAA+D;AAC/D,0CAIqB;AAEd,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IAC5C,MAAM,OAAO,GAAG,IAAA,4BAAiB,GAAE,CAAC;IACpC,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IACjD,IAAI,2BAAwD,CAAC;IAE7D,IAAI,oBAAoB,EAAE,CAAC;QACzB,2BAA2B,GAAG;YAC5B,GAAG,IAAA,wDAA6C,EAAC,oBAAoB,CAAC;SACvE,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,2BAA2B,GAAG;YAC5B,GAAG,IAAA,gDAAqC,GAAE;SAC3C,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,MAAM,2BAA2B,GAAG,IAAI,2CAA2B,CAAC,2BAA2B,CAAC,CAAC;IACjG,MAAM,2BAA2B,CAAC,4BAA4B,EAAE,CAAC;AACnE,CAAC,CAAC;AAlBW,QAAA,IAAI,QAkBf","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PlaywrightServiceInitConfig } from \"../types.js\";\nimport { PlaywrightServiceInitialize } from \"../initialize.js\";\nimport {\n getLanguageAndConfigInfoFromConfigurationFile,\n getLanguageAndConfigInfoFromDirectory,\n parseCLIArguments,\n} from \"../utils.js\";\n\nexport const init = async (): Promise<void> => {\n const options = parseCLIArguments();\n const { config: playwrightConfigFile } = options;\n let playwrightServiceInitConfig: PlaywrightServiceInitConfig;\n\n if (playwrightConfigFile) {\n playwrightServiceInitConfig = {\n ...getLanguageAndConfigInfoFromConfigurationFile(playwrightConfigFile),\n };\n } else {\n playwrightServiceInitConfig = {\n ...getLanguageAndConfigInfoFromDirectory(),\n };\n }\n\n console.log(\"\");\n const playwrightServiceInitialize = new PlaywrightServiceInitialize(playwrightServiceInitConfig);\n await playwrightServiceInitialize.addServiceSupportToTestSuite();\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAGV,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AAmBpB,qBAAa,2BAA2B;IACtC,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,eAAe,CAAiB;gBAE5B,WAAW,EAAE,2BAA2B;IAK7C,4BAA4B,QAAa,OAAO,CAAC,IAAI,CAAC,CAM3D;IAEF,OAAO,CAAC,8BAA8B,CAUpC;IAEF,OAAO,CAAC,cAAc,CAEpB;IAEF,OAAO,CAAC,iCAAiC,CAEvC;IAEF,OAAO,CAAC,4BAA4B,CAkBlC;IAEF,OAAO,CAAC,qBAAqB,CAM3B;IAEF,OAAO,CAAC,mBAAmB,CAKzB;IAEF,OAAO,CAAC,uBAAuB,CA2C7B;IAEF,OAAO,CAAC,wBAAwB,CAE9B;CACH"}
1
+ {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAGV,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AAmBpB,qBAAa,2BAA2B;IACtC,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,eAAe,CAAiB;gBAE5B,WAAW,EAAE,2BAA2B;IAK7C,4BAA4B,QAAa,OAAO,CAAC,IAAI,CAAC,CAM3D;IAEF,OAAO,CAAC,8BAA8B,CAUpC;IAEF,OAAO,CAAC,cAAc,CAEpB;IAEF,OAAO,CAAC,iCAAiC,CAEvC;IAEF,OAAO,CAAC,4BAA4B,CAkBlC;IAEF,OAAO,CAAC,qBAAqB,CAM3B;IAEF,OAAO,CAAC,mBAAmB,CAKzB;IAEF,OAAO,CAAC,uBAAuB,CAmC7B;IAEF,OAAO,CAAC,wBAAwB,CAE9B;CACH"}
@@ -24,69 +24,74 @@ const questions = [
24
24
  },
25
25
  ];
26
26
  class PlaywrightServiceInitialize {
27
+ _setupConfig;
28
+ _packageManager;
27
29
  constructor(setupConfig) {
28
- this.addServiceSupportToTestSuite = async () => {
29
- const canProceedWithServiceInitialization = await this.checkIfServiceConfigCanBeAdded(); // if service config already present, ask user for overwrite permission
30
- if (!canProceedWithServiceInitialization)
31
- return;
32
- await this.installServicePackage(); // install service packages
33
- await this.createServiceConfig(); // create service config file
34
- this.displayAdditionalInformation(); // display additional information
35
- };
36
- this.checkIfServiceConfigCanBeAdded = async () => {
37
- if (!this.isServiceConfigFileAlreadyPresent())
38
- return true;
39
- const response = (await prompts_1.default.prompt(questions, {
40
- onCancel: this.promptOnCancel,
41
- }));
42
- if (response.canOverride)
43
- return true;
44
- if (!response.confirmationForExit)
45
- return this.checkIfServiceConfigCanBeAdded();
46
- console.log(`\n${constants_js_1.Messages.SETUP_PROCESS_EXIT_MESSAGE}`);
47
- return false;
48
- };
49
- this.promptOnCancel = () => {
50
- process.exit(0);
51
- };
52
- this.isServiceConfigFileAlreadyPresent = () => {
53
- return node_fs_1.default.existsSync(this.getServiceConfigFileName());
54
- };
55
- this.displayAdditionalInformation = () => {
56
- const runCommandParallelWorkers = this._packageManager.runCommand("playwright", `test -c ${this.getServiceConfigFileName()} --workers=20`);
57
- console.log(`\n\nTo run playwrights tests using Playwright Service\n`);
58
- console.log(`\t${runCommandParallelWorkers}\n`);
59
- console.log("\nPlaywright Service Portal - https://playwright.microsoft.com/");
60
- console.log("Getting Started - https://aka.ms/mpt/quickstart\n");
61
- console.log("If you're already using the Microsoft Playwright Testing service, please review the quickstart guide [https://aka.ms/mpt/quickstart] to ensure your tests continue running smoothly.");
62
- console.log("We've introduced changes related to authentication. You'll need to update the new config file to align with these changes.");
63
- };
64
- this.installServicePackage = async () => {
65
- const command = this._packageManager.installDevDependencyCommand("@azure/microsoft-playwright-testing");
66
- console.log(`Installing Service package (${command})`);
67
- await (0, utils_js_1.executeCommand)(command);
68
- };
69
- this.createServiceConfig = async () => {
70
- const serviceConfigFile = this.getServiceConfigFileName();
71
- const serviceConfigFileContent = this.getServiceConfigContent();
72
- await node_fs_1.default.promises.writeFile(serviceConfigFile, serviceConfigFileContent);
73
- console.log(`Success! Created service configuration file - ${serviceConfigFile}`);
74
- };
75
- this.getServiceConfigContent = () => {
76
- const customerConfigFileName = (0, utils_js_1.getFileReferenceForImport)(this._setupConfig.playwrightConfigFile);
77
- const importCommandTypeScript = `import { defineConfig } from '@playwright/test';
30
+ this._setupConfig = setupConfig;
31
+ this._packageManager = (0, packageManager_js_1.getPackageManager)();
32
+ }
33
+ addServiceSupportToTestSuite = async () => {
34
+ const canProceedWithServiceInitialization = await this.checkIfServiceConfigCanBeAdded(); // if service config already present, ask user for overwrite permission
35
+ if (!canProceedWithServiceInitialization)
36
+ return;
37
+ await this.installServicePackage(); // install service packages
38
+ await this.createServiceConfig(); // create service config file
39
+ this.displayAdditionalInformation(); // display additional information
40
+ };
41
+ checkIfServiceConfigCanBeAdded = async () => {
42
+ if (!this.isServiceConfigFileAlreadyPresent())
43
+ return true;
44
+ const response = (await prompts_1.default.prompt(questions, {
45
+ onCancel: this.promptOnCancel,
46
+ }));
47
+ if (response.canOverride)
48
+ return true;
49
+ if (!response.confirmationForExit)
50
+ return this.checkIfServiceConfigCanBeAdded();
51
+ console.log(`\n${constants_js_1.Messages.SETUP_PROCESS_EXIT_MESSAGE}`);
52
+ return false;
53
+ };
54
+ promptOnCancel = () => {
55
+ process.exit(0);
56
+ };
57
+ isServiceConfigFileAlreadyPresent = () => {
58
+ return node_fs_1.default.existsSync(this.getServiceConfigFileName());
59
+ };
60
+ displayAdditionalInformation = () => {
61
+ const runCommandParallelWorkers = this._packageManager.runCommand("playwright", `test -c ${this.getServiceConfigFileName()} --workers=20`);
62
+ console.log(`\n\nTo run playwrights tests using Playwright Service\n`);
63
+ console.log(`\t${runCommandParallelWorkers}\n`);
64
+ console.log("\nPlaywright Service Portal - https://playwright.microsoft.com/");
65
+ console.log("Getting Started - https://aka.ms/mpt/quickstart\n");
66
+ console.log("If you're already using the Microsoft Playwright Testing service, please review the quickstart guide [https://aka.ms/mpt/quickstart] to ensure your tests continue running smoothly.");
67
+ console.log("We've introduced changes related to authentication. You'll need to update the new config file to align with these changes.");
68
+ };
69
+ installServicePackage = async () => {
70
+ const command = this._packageManager.installDevDependencyCommand("@azure/microsoft-playwright-testing");
71
+ console.log(`Installing Service package (${command})`);
72
+ await (0, utils_js_1.executeCommand)(command);
73
+ };
74
+ createServiceConfig = async () => {
75
+ const serviceConfigFile = this.getServiceConfigFileName();
76
+ const serviceConfigFileContent = this.getServiceConfigContent();
77
+ await node_fs_1.default.promises.writeFile(serviceConfigFile, serviceConfigFileContent);
78
+ console.log(`Success! Created service configuration file - ${serviceConfigFile}`);
79
+ };
80
+ getServiceConfigContent = () => {
81
+ const customerConfigFileName = (0, utils_js_1.getFileReferenceForImport)(this._setupConfig.playwrightConfigFile);
82
+ const importCommandTypeScript = `import { defineConfig } from '@playwright/test';
78
83
  import { getServiceConfig, ServiceOS } from '@azure/microsoft-playwright-testing';
79
84
  import config from '${customerConfigFileName}';
80
85
  `;
81
- const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');
86
+ const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');
82
87
  const { getServiceConfig, ServiceOS } = require('@azure/microsoft-playwright-testing');
83
88
  const config = require('${customerConfigFileName}');
84
89
  `;
85
- const importCommand = this._setupConfig.projectLanguage === constants_js_1.Languages.TypeScript
86
- ? importCommandTypeScript
87
- : importCommandJavaScript;
88
- const content = importCommand +
89
- `
90
+ const importCommand = this._setupConfig.projectLanguage === constants_js_1.Languages.TypeScript
91
+ ? importCommandTypeScript
92
+ : importCommandJavaScript;
93
+ const content = importCommand +
94
+ `
90
95
  /* Learn more about service configuration at https://aka.ms/mpt/config */
91
96
  export default defineConfig(
92
97
  config,
@@ -94,26 +99,15 @@ export default defineConfig(
94
99
  exposeNetwork: '<loopback>',
95
100
  timeout: 30000,
96
101
  os: ServiceOS.LINUX,
97
- useCloudHostedBrowsers: true // Set to false if you want to only use reporting and not cloud hosted browsers
98
102
  }),
99
- {
100
- /*
101
- Playwright Testing service reporter is added by default.
102
- This will override any reporter options specified in the base playwright config.
103
- If you are using more reporters, please update your configuration accordingly.
104
- */
105
- reporter: [['list'], ['@azure/microsoft-playwright-testing/reporter']],
106
- }
103
+
107
104
  );
108
105
  `;
109
- return content;
110
- };
111
- this.getServiceConfigFileName = () => {
112
- return "playwright.service.config" + constants_js_1.Extensions[this._setupConfig.projectLanguage];
113
- };
114
- this._setupConfig = setupConfig;
115
- this._packageManager = (0, packageManager_js_1.getPackageManager)();
116
- }
106
+ return content;
107
+ };
108
+ getServiceConfigFileName = () => {
109
+ return "playwright.service.config" + constants_js_1.Extensions[this._setupConfig.projectLanguage];
110
+ };
117
111
  }
118
112
  exports.PlaywrightServiceInitialize = PlaywrightServiceInitialize;
119
113
  //# sourceMappingURL=initialize.js.map
@@ -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,OAAO,EAAE,uBAAQ,CAA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CAAC;QAEM,4BAAuB,GAAG,GAAW,EAAE;YAC7C,MAAM,sBAAsB,GAAG,IAAA,oCAAyB,EACtD,IAAI,CAAC,YAAY,CAAC,oBAAoB,CACvC,CAAC;YAEF,MAAM,uBAAuB,GAAG;;sBAEd,sBAAsB;CAC3C,CAAC;YAEE,MAAM,uBAAuB,GAAG;;0BAEV,sBAAsB;CAC/C,CAAC;YAEE,MAAM,aAAa,GACjB,IAAI,CAAC,YAAY,CAAC,eAAe,KAAK,wBAAS,CAAC,UAAU;gBACxD,CAAC,CAAC,uBAAuB;gBACzB,CAAC,CAAC,uBAAuB,CAAC;YAE9B,MAAM,OAAO,GACX,aAAa;gBACb;;;;;;;;;;;;;;;;;;;CAmBL,CAAC;YACE,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;QAEM,6BAAwB,GAAG,GAAW,EAAE;YAC9C,OAAO,2BAA2B,GAAG,yBAAU,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;QACrF,CAAC,CAAC;QAlHA,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,IAAA,qCAAiB,GAAE,CAAC;IAC7C,CAAC;CAiHF;AAxHD,kEAwHC","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.getServiceConfigFileName());\n };\n\n private displayAdditionalInformation = (): void => {\n const runCommandParallelWorkers = this._packageManager.runCommand(\n \"playwright\",\n `test -c ${this.getServiceConfigFileName()} --workers=20`,\n );\n\n console.log(`\\n\\nTo run playwrights tests using Playwright Service\\n`);\n console.log(`\\t${runCommandParallelWorkers}\\n`);\n\n console.log(\"\\nPlaywright Service Portal - https://playwright.microsoft.com/\");\n console.log(\"Getting Started - https://aka.ms/mpt/quickstart\\n\");\n\n console.log(\n \"If you're already using the Microsoft Playwright Testing service, please review the quickstart guide [https://aka.ms/mpt/quickstart] to ensure your tests continue running smoothly.\",\n );\n console.log(\n \"We've introduced changes related to authentication. You'll need to update the new config file to align with these changes.\",\n );\n };\n\n private installServicePackage = async (): Promise<void> => {\n const command = this._packageManager.installDevDependencyCommand(\n \"@azure/microsoft-playwright-testing\",\n );\n console.log(`Installing Service package (${command})`);\n await executeCommand(command);\n };\n\n private createServiceConfig = async (): Promise<void> => {\n const serviceConfigFile = this.getServiceConfigFileName();\n const serviceConfigFileContent = this.getServiceConfigContent();\n await fs.promises.writeFile(serviceConfigFile, serviceConfigFileContent);\n console.log(`Success! Created service configuration file - ${serviceConfigFile}`);\n };\n\n private getServiceConfigContent = (): string => {\n const customerConfigFileName = getFileReferenceForImport(\n this._setupConfig.playwrightConfigFile,\n );\n\n const importCommandTypeScript = `import { defineConfig } from '@playwright/test';\nimport { getServiceConfig, ServiceOS } from '@azure/microsoft-playwright-testing';\nimport config from '${customerConfigFileName}';\n`;\n\n const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');\nconst { getServiceConfig, ServiceOS } = require('@azure/microsoft-playwright-testing');\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/mpt/config */\nexport default defineConfig(\n config,\n getServiceConfig(config, {\n exposeNetwork: '<loopback>',\n timeout: 30000,\n os: ServiceOS.LINUX,\n useCloudHostedBrowsers: true // Set to false if you want to only use reporting and not cloud hosted browsers\n }),\n {\n /* \n Playwright Testing service reporter is added by default.\n This will override any reporter options specified in the base playwright config.\n If you are using more reporters, please update your configuration accordingly.\n */\n reporter: [['list'], ['@azure/microsoft-playwright-testing/reporter']],\n }\n);\n`;\n return content;\n };\n\n private getServiceConfigFileName = (): string => {\n return \"playwright.service.config\" + Extensions[this._setupConfig.projectLanguage];\n };\n}\n"]}
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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AAC;QAC1D,MAAM,wBAAwB,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAChE,MAAM,iBAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,iBAAiB,EAAE,wBAAwB,CAAC,CAAC;QACzE,OAAO,CAAC,GAAG,CAAC,iDAAiD,iBAAiB,EAAE,CAAC,CAAC;IACpF,CAAC,CAAC;IAEM,uBAAuB,GAAG,GAAW,EAAE;QAC7C,MAAM,sBAAsB,GAAG,IAAA,oCAAyB,EACtD,IAAI,CAAC,YAAY,CAAC,oBAAoB,CACvC,CAAC;QAEF,MAAM,uBAAuB,GAAG;;sBAEd,sBAAsB;CAC3C,CAAC;QAEE,MAAM,uBAAuB,GAAG;;0BAEV,sBAAsB;CAC/C,CAAC;QAEE,MAAM,aAAa,GACjB,IAAI,CAAC,YAAY,CAAC,eAAe,KAAK,wBAAS,CAAC,UAAU;YACxD,CAAC,CAAC,uBAAuB;YACzB,CAAC,CAAC,uBAAuB,CAAC;QAE9B,MAAM,OAAO,GACX,aAAa;YACb;;;;;;;;;;;CAWL,CAAC;QACE,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEM,wBAAwB,GAAG,GAAW,EAAE;QAC9C,OAAO,2BAA2B,GAAG,yBAAU,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACrF,CAAC,CAAC;CACH;AAhHD,kEAgHC","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.getServiceConfigFileName());\n };\n\n private displayAdditionalInformation = (): void => {\n const runCommandParallelWorkers = this._packageManager.runCommand(\n \"playwright\",\n `test -c ${this.getServiceConfigFileName()} --workers=20`,\n );\n\n console.log(`\\n\\nTo run playwrights tests using Playwright Service\\n`);\n console.log(`\\t${runCommandParallelWorkers}\\n`);\n\n console.log(\"\\nPlaywright Service Portal - https://playwright.microsoft.com/\");\n console.log(\"Getting Started - https://aka.ms/mpt/quickstart\\n\");\n\n console.log(\n \"If you're already using the Microsoft Playwright Testing service, please review the quickstart guide [https://aka.ms/mpt/quickstart] to ensure your tests continue running smoothly.\",\n );\n console.log(\n \"We've introduced changes related to authentication. You'll need to update the new config file to align with these changes.\",\n );\n };\n\n private installServicePackage = async (): Promise<void> => {\n const command = this._packageManager.installDevDependencyCommand(\n \"@azure/microsoft-playwright-testing\",\n );\n console.log(`Installing Service package (${command})`);\n await executeCommand(command);\n };\n\n private createServiceConfig = async (): Promise<void> => {\n const serviceConfigFile = this.getServiceConfigFileName();\n const serviceConfigFileContent = this.getServiceConfigContent();\n await fs.promises.writeFile(serviceConfigFile, serviceConfigFileContent);\n console.log(`Success! Created service configuration file - ${serviceConfigFile}`);\n };\n\n private getServiceConfigContent = (): string => {\n const customerConfigFileName = getFileReferenceForImport(\n this._setupConfig.playwrightConfigFile,\n );\n\n const importCommandTypeScript = `import { defineConfig } from '@playwright/test';\nimport { getServiceConfig, ServiceOS } from '@azure/microsoft-playwright-testing';\nimport config from '${customerConfigFileName}';\n`;\n\n const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');\nconst { getServiceConfig, ServiceOS } = require('@azure/microsoft-playwright-testing');\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/mpt/config */\nexport default defineConfig(\n config,\n getServiceConfig(config, {\n exposeNetwork: '<loopback>',\n timeout: 30000,\n os: ServiceOS.LINUX,\n }),\n\n);\n`;\n return content;\n };\n\n private getServiceConfigFileName = (): string => {\n return \"playwright.service.config\" + Extensions[this._setupConfig.projectLanguage];\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"packageManager.d.ts","sourceRoot":"","sources":["../../src/packageManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,qBAAa,GAAI,YAAW,cAAc;IACxC,2BAA2B,gBAAiB,MAAM,KAAG,MAAM,CAEzD;IACF,UAAU,YAAa,MAAM,QAAQ,MAAM,KAAG,MAAM,CAElD;CACH;AAED,qBAAa,IAAK,YAAW,cAAc;IACzC,OAAO,CAAC,YAAY,CAAkB;;IAMtC,2BAA2B,gBAAiB,MAAM,KAAG,MAAM,CAEzD;IACF,UAAU,YAAa,MAAM,QAAQ,MAAM,KAAG,MAAM,CAElD;CACH;AAED,qBAAa,IAAK,YAAW,cAAc;IACzC,2BAA2B,gBAAiB,MAAM,KAAG,MAAM,CAEzD;IACF,UAAU,YAAa,MAAM,QAAQ,MAAM,KAAG,MAAM,CAElD;CACH;AAGD,eAAO,MAAM,iBAAiB,QAAO,cAOpC,CAAC"}
1
+ {"version":3,"file":"packageManager.d.ts","sourceRoot":"","sources":["../../src/packageManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,qBAAa,GAAI,YAAW,cAAc;IACxC,2BAA2B,GAAI,aAAa,MAAM,KAAG,MAAM,CAEzD;IACF,UAAU,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,KAAG,MAAM,CAElD;CACH;AAED,qBAAa,IAAK,YAAW,cAAc;IACzC,OAAO,CAAC,YAAY,CAAkB;;IAMtC,2BAA2B,GAAI,aAAa,MAAM,KAAG,MAAM,CAEzD;IACF,UAAU,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,KAAG,MAAM,CAElD;CACH;AAED,qBAAa,IAAK,YAAW,cAAc;IACzC,2BAA2B,GAAI,aAAa,MAAM,KAAG,MAAM,CAEzD;IACF,UAAU,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,KAAG,MAAM,CAElD;CACH;AAGD,eAAO,MAAM,iBAAiB,QAAO,cAOpC,CAAC"}
@@ -7,38 +7,34 @@ const node_fs_1 = require("node:fs");
7
7
  const node_process_1 = require("node:process");
8
8
  const node_path_1 = require("node:path");
9
9
  class NPM {
10
- constructor() {
11
- this.installDevDependencyCommand = (packageName) => {
12
- return `npm install --save-dev ${packageName}`;
13
- };
14
- this.runCommand = (command, args) => {
15
- return `npx ${command} ${args}`;
16
- };
17
- }
10
+ installDevDependencyCommand = (packageName) => {
11
+ return `npm install --save-dev ${packageName}`;
12
+ };
13
+ runCommand = (command, args) => {
14
+ return `npx ${command} ${args}`;
15
+ };
18
16
  }
19
17
  exports.NPM = NPM;
20
18
  class PNPM {
19
+ useWorkspace = false;
21
20
  constructor() {
22
- this.useWorkspace = false;
23
- this.installDevDependencyCommand = (packageName) => {
24
- return `pnpm add --save-dev ${this.useWorkspace ? "-w " : ""}${packageName}`;
25
- };
26
- this.runCommand = (command, args) => {
27
- return `pnpm ${command} ${args}`;
28
- };
29
21
  this.useWorkspace = (0, node_fs_1.existsSync)((0, node_path_1.resolve)((0, node_process_1.cwd)(), "pnpm-workspace.yaml"));
30
22
  }
23
+ installDevDependencyCommand = (packageName) => {
24
+ return `pnpm add --save-dev ${this.useWorkspace ? "-w " : ""}${packageName}`;
25
+ };
26
+ runCommand = (command, args) => {
27
+ return `pnpm ${command} ${args}`;
28
+ };
31
29
  }
32
30
  exports.PNPM = PNPM;
33
31
  class Yarn {
34
- constructor() {
35
- this.installDevDependencyCommand = (packageName) => {
36
- return `yarn add --dev ${packageName}`;
37
- };
38
- this.runCommand = (command, args) => {
39
- return `yarn ${command} ${args}`;
40
- };
41
- }
32
+ installDevDependencyCommand = (packageName) => {
33
+ return `yarn add --dev ${packageName}`;
34
+ };
35
+ runCommand = (command, args) => {
36
+ return `yarn ${command} ${args}`;
37
+ };
42
38
  }
43
39
  exports.Yarn = Yarn;
44
40
  // https://stackoverflow.com/questions/68133683/is-there-a-cross-platform-way-to-get-the-name-of-the-parent-process-in-node-js
@@ -1 +1 @@
1
- {"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../src/packageManager.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,qCAAqC;AAErC,+CAAmC;AACnC,yCAAoC;AAEpC,MAAa,GAAG;IAAhB;QACE,gCAA2B,GAAG,CAAC,WAAmB,EAAU,EAAE;YAC5D,OAA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AAI,EAAE,CAAC;QAClD,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,IAAI,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,IAAI,GAAG,EAAE,CAAC;AACnB,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { existsSync } from \"node:fs\";\nimport type { PackageManager } from \"./types.js\";\nimport { cwd } from \"node:process\";\nimport { resolve } from \"node:path\";\n\nexport class NPM implements PackageManager {\n installDevDependencyCommand = (packageName: string): string => {\n return `npm install --save-dev ${packageName}`;\n };\n runCommand = (command: string, args: string): string => {\n return `npx ${command} ${args}`;\n };\n}\n\nexport class PNPM implements PackageManager {\n private useWorkspace: boolean = false;\n\n constructor() {\n this.useWorkspace = existsSync(resolve(cwd(), \"pnpm-workspace.yaml\"));\n }\n\n installDevDependencyCommand = (packageName: string): string => {\n return `pnpm add --save-dev ${this.useWorkspace ? \"-w \" : \"\"}${packageName}`;\n };\n runCommand = (command: string, args: string): string => {\n return `pnpm ${command} ${args}`;\n };\n}\n\nexport class Yarn implements PackageManager {\n installDevDependencyCommand = (packageName: string): string => {\n return `yarn add --dev ${packageName}`;\n };\n runCommand = (command: string, args: string): string => {\n return `yarn ${command} ${args}`;\n };\n}\n\n// https://stackoverflow.com/questions/68133683/is-there-a-cross-platform-way-to-get-the-name-of-the-parent-process-in-node-js\nexport const getPackageManager = (): PackageManager => {\n if (process.env[\"npm_config_user_agent\"]) {\n const userAgent = process.env[\"npm_config_user_agent\"];\n if (userAgent.includes(\"yarn\")) return new Yarn();\n if (userAgent.includes(\"pnpm\")) return new PNPM();\n }\n return new NPM();\n};\n"]}
1
+ {"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../src/packageManager.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,qCAAqC;AAErC,+CAAmC;AACnC,yCAAoC;AAEp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AAM,CAAC;YAAE,OAAO,IAAI,IAAI,EAAE,CAAC;QAClD,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,IAAI,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,IAAI,GAAG,EAAE,CAAC;AACnB,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { existsSync } from \"node:fs\";\nimport type { PackageManager } from \"./types.js\";\nimport { cwd } from \"node:process\";\nimport { resolve } from \"node:path\";\n\nexport class NPM implements PackageManager {\n installDevDependencyCommand = (packageName: string): string => {\n return `npm install --save-dev ${packageName}`;\n };\n runCommand = (command: string, args: string): string => {\n return `npx ${command} ${args}`;\n };\n}\n\nexport class PNPM implements PackageManager {\n private useWorkspace: boolean = false;\n\n constructor() {\n this.useWorkspace = existsSync(resolve(cwd(), \"pnpm-workspace.yaml\"));\n }\n\n installDevDependencyCommand = (packageName: string): string => {\n return `pnpm add --save-dev ${this.useWorkspace ? \"-w \" : \"\"}${packageName}`;\n };\n runCommand = (command: string, args: string): string => {\n return `pnpm ${command} ${args}`;\n };\n}\n\nexport class Yarn implements PackageManager {\n installDevDependencyCommand = (packageName: string): string => {\n return `yarn add --dev ${packageName}`;\n };\n runCommand = (command: string, args: string): string => {\n return `yarn ${command} ${args}`;\n };\n}\n\n// https://stackoverflow.com/questions/68133683/is-there-a-cross-platform-way-to-get-the-name-of-the-parent-process-in-node-js\nexport const getPackageManager = (): PackageManager => {\n if (process.env[\"npm_config_user_agent\"]) {\n const userAgent = process.env[\"npm_config_user_agent\"];\n if (userAgent.includes(\"yarn\")) return new Yarn();\n if (userAgent.includes(\"pnpm\")) return new PNPM();\n }\n return new NPM();\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAG5E,eAAO,MAAM,cAAc,YAAa,MAAM,KAAG,OAAO,CAAC,MAAM,CAU9D,CAAC;AAEF,eAAO,MAAM,qCAAqC,QAAO,2BAcxD,CAAC;AAEF,eAAO,MAAM,6CAA6C,yBAClC,MAAM,KAC3B,2BAaF,CAAC;AAEF,eAAO,MAAM,yBAAyB,aAAc,MAAM,KAAG,MAW5D,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,MAUjC,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,YAcpC,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAG5E,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,KAAG,OAAO,CAAC,MAAM,CAU9D,CAAC;AAEF,eAAO,MAAM,qCAAqC,QAAO,2BAcxD,CAAC;AAEF,eAAO,MAAM,6CAA6C,GACxD,sBAAsB,MAAM,KAC3B,2BAaF,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,UAAU,MAAM,KAAG,MAW5D,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,MAUjC,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,YAcpC,CAAC"}
@@ -7,10 +7,14 @@ export const init = async () => {
7
7
  const { config: playwrightConfigFile } = options;
8
8
  let playwrightServiceInitConfig;
9
9
  if (playwrightConfigFile) {
10
- playwrightServiceInitConfig = Object.assign({}, getLanguageAndConfigInfoFromConfigurationFile(playwrightConfigFile));
10
+ playwrightServiceInitConfig = {
11
+ ...getLanguageAndConfigInfoFromConfigurationFile(playwrightConfigFile),
12
+ };
11
13
  }
12
14
  else {
13
- playwrightServiceInitConfig = Object.assign({}, getLanguageAndConfigInfoFromDirectory());
15
+ playwrightServiceInitConfig = {
16
+ ...getLanguageAndConfigInfoFromDirectory(),
17
+ };
14
18
  }
15
19
  console.log("");
16
20
  const playwrightServiceInitialize = new PlaywrightServiceInitialize(playwrightServiceInitConfig);
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/bin/init.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,6CAA6C,EAC7C,qCAAqC,EACrC,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IAC5C,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;IACpC,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IACjD,IAAI,2BAAwD,CAAC;IAE7D,IAAI,oBAAoB,EAAE,CAAC;QACzB,2BAA2B,qBACtB,6CAA6C,CAAC,oBAAoB,CAAC,CACvE,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,2BAA2B,qBACtB,qCAAqC,EAAE,CAC3C,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,MAAM,2BAA2B,GAAG,IAAI,2BAA2B,CAAC,2BAA2B,CAAC,CAAC;IACjG,MAAM,2BAA2B,CAAC,4BAA4B,EAAE,CAAC;AACnE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PlaywrightServiceInitConfig } from \"../types.js\";\nimport { PlaywrightServiceInitialize } from \"../initialize.js\";\nimport {\n getLanguageAndConfigInfoFromConfigurationFile,\n getLanguageAndConfigInfoFromDirectory,\n parseCLIArguments,\n} from \"../utils.js\";\n\nexport const init = async (): Promise<void> => {\n const options = parseCLIArguments();\n const { config: playwrightConfigFile } = options;\n let playwrightServiceInitConfig: PlaywrightServiceInitConfig;\n\n if (playwrightConfigFile) {\n playwrightServiceInitConfig = {\n ...getLanguageAndConfigInfoFromConfigurationFile(playwrightConfigFile),\n };\n } else {\n playwrightServiceInitConfig = {\n ...getLanguageAndConfigInfoFromDirectory(),\n };\n }\n\n console.log(\"\");\n const playwrightServiceInitialize = new PlaywrightServiceInitialize(playwrightServiceInitConfig);\n await playwrightServiceInitialize.addServiceSupportToTestSuite();\n};\n"]}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/bin/init.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,6CAA6C,EAC7C,qCAAqC,EACrC,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IAC5C,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;IACpC,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IACjD,IAAI,2BAAwD,CAAC;IAE7D,IAAI,oBAAoB,EAAE,CAAC;QACzB,2BAA2B,GAAG;YAC5B,GAAG,6CAA6C,CAAC,oBAAoB,CAAC;SACvE,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,2BAA2B,GAAG;YAC5B,GAAG,qCAAqC,EAAE;SAC3C,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,MAAM,2BAA2B,GAAG,IAAI,2BAA2B,CAAC,2BAA2B,CAAC,CAAC;IACjG,MAAM,2BAA2B,CAAC,4BAA4B,EAAE,CAAC;AACnE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PlaywrightServiceInitConfig } from \"../types.js\";\nimport { PlaywrightServiceInitialize } from \"../initialize.js\";\nimport {\n getLanguageAndConfigInfoFromConfigurationFile,\n getLanguageAndConfigInfoFromDirectory,\n parseCLIArguments,\n} from \"../utils.js\";\n\nexport const init = async (): Promise<void> => {\n const options = parseCLIArguments();\n const { config: playwrightConfigFile } = options;\n let playwrightServiceInitConfig: PlaywrightServiceInitConfig;\n\n if (playwrightConfigFile) {\n playwrightServiceInitConfig = {\n ...getLanguageAndConfigInfoFromConfigurationFile(playwrightConfigFile),\n };\n } else {\n playwrightServiceInitConfig = {\n ...getLanguageAndConfigInfoFromDirectory(),\n };\n }\n\n console.log(\"\");\n const playwrightServiceInitialize = new PlaywrightServiceInitialize(playwrightServiceInitConfig);\n await playwrightServiceInitialize.addServiceSupportToTestSuite();\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAGV,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AAmBpB,qBAAa,2BAA2B;IACtC,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,eAAe,CAAiB;gBAE5B,WAAW,EAAE,2BAA2B;IAK7C,4BAA4B,QAAa,OAAO,CAAC,IAAI,CAAC,CAM3D;IAEF,OAAO,CAAC,8BAA8B,CAUpC;IAEF,OAAO,CAAC,cAAc,CAEpB;IAEF,OAAO,CAAC,iCAAiC,CAEvC;IAEF,OAAO,CAAC,4BAA4B,CAkBlC;IAEF,OAAO,CAAC,qBAAqB,CAM3B;IAEF,OAAO,CAAC,mBAAmB,CAKzB;IAEF,OAAO,CAAC,uBAAuB,CA2C7B;IAEF,OAAO,CAAC,wBAAwB,CAE9B;CACH"}
1
+ {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAGV,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AAmBpB,qBAAa,2BAA2B;IACtC,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,eAAe,CAAiB;gBAE5B,WAAW,EAAE,2BAA2B;IAK7C,4BAA4B,QAAa,OAAO,CAAC,IAAI,CAAC,CAM3D;IAEF,OAAO,CAAC,8BAA8B,CAUpC;IAEF,OAAO,CAAC,cAAc,CAEpB;IAEF,OAAO,CAAC,iCAAiC,CAEvC;IAEF,OAAO,CAAC,4BAA4B,CAkBlC;IAEF,OAAO,CAAC,qBAAqB,CAM3B;IAEF,OAAO,CAAC,mBAAmB,CAKzB;IAEF,OAAO,CAAC,uBAAuB,CAmC7B;IAEF,OAAO,CAAC,wBAAwB,CAE9B;CACH"}
@@ -20,69 +20,74 @@ const questions = [
20
20
  },
21
21
  ];
22
22
  export class PlaywrightServiceInitialize {
23
+ _setupConfig;
24
+ _packageManager;
23
25
  constructor(setupConfig) {
24
- this.addServiceSupportToTestSuite = async () => {
25
- const canProceedWithServiceInitialization = await this.checkIfServiceConfigCanBeAdded(); // if service config already present, ask user for overwrite permission
26
- if (!canProceedWithServiceInitialization)
27
- return;
28
- await this.installServicePackage(); // install service packages
29
- await this.createServiceConfig(); // create service config file
30
- this.displayAdditionalInformation(); // display additional information
31
- };
32
- this.checkIfServiceConfigCanBeAdded = async () => {
33
- if (!this.isServiceConfigFileAlreadyPresent())
34
- return true;
35
- const response = (await prompts.prompt(questions, {
36
- onCancel: this.promptOnCancel,
37
- }));
38
- if (response.canOverride)
39
- return true;
40
- if (!response.confirmationForExit)
41
- return this.checkIfServiceConfigCanBeAdded();
42
- console.log(`\n${Messages.SETUP_PROCESS_EXIT_MESSAGE}`);
43
- return false;
44
- };
45
- this.promptOnCancel = () => {
46
- process.exit(0);
47
- };
48
- this.isServiceConfigFileAlreadyPresent = () => {
49
- return fs.existsSync(this.getServiceConfigFileName());
50
- };
51
- this.displayAdditionalInformation = () => {
52
- const runCommandParallelWorkers = this._packageManager.runCommand("playwright", `test -c ${this.getServiceConfigFileName()} --workers=20`);
53
- console.log(`\n\nTo run playwrights tests using Playwright Service\n`);
54
- console.log(`\t${runCommandParallelWorkers}\n`);
55
- console.log("\nPlaywright Service Portal - https://playwright.microsoft.com/");
56
- console.log("Getting Started - https://aka.ms/mpt/quickstart\n");
57
- console.log("If you're already using the Microsoft Playwright Testing service, please review the quickstart guide [https://aka.ms/mpt/quickstart] to ensure your tests continue running smoothly.");
58
- console.log("We've introduced changes related to authentication. You'll need to update the new config file to align with these changes.");
59
- };
60
- this.installServicePackage = async () => {
61
- const command = this._packageManager.installDevDependencyCommand("@azure/microsoft-playwright-testing");
62
- console.log(`Installing Service package (${command})`);
63
- await executeCommand(command);
64
- };
65
- this.createServiceConfig = async () => {
66
- const serviceConfigFile = this.getServiceConfigFileName();
67
- const serviceConfigFileContent = this.getServiceConfigContent();
68
- await fs.promises.writeFile(serviceConfigFile, serviceConfigFileContent);
69
- console.log(`Success! Created service configuration file - ${serviceConfigFile}`);
70
- };
71
- this.getServiceConfigContent = () => {
72
- const customerConfigFileName = getFileReferenceForImport(this._setupConfig.playwrightConfigFile);
73
- const importCommandTypeScript = `import { defineConfig } from '@playwright/test';
26
+ this._setupConfig = setupConfig;
27
+ this._packageManager = getPackageManager();
28
+ }
29
+ addServiceSupportToTestSuite = async () => {
30
+ const canProceedWithServiceInitialization = await this.checkIfServiceConfigCanBeAdded(); // if service config already present, ask user for overwrite permission
31
+ if (!canProceedWithServiceInitialization)
32
+ return;
33
+ await this.installServicePackage(); // install service packages
34
+ await this.createServiceConfig(); // create service config file
35
+ this.displayAdditionalInformation(); // display additional information
36
+ };
37
+ checkIfServiceConfigCanBeAdded = async () => {
38
+ if (!this.isServiceConfigFileAlreadyPresent())
39
+ return true;
40
+ const response = (await prompts.prompt(questions, {
41
+ onCancel: this.promptOnCancel,
42
+ }));
43
+ if (response.canOverride)
44
+ return true;
45
+ if (!response.confirmationForExit)
46
+ return this.checkIfServiceConfigCanBeAdded();
47
+ console.log(`\n${Messages.SETUP_PROCESS_EXIT_MESSAGE}`);
48
+ return false;
49
+ };
50
+ promptOnCancel = () => {
51
+ process.exit(0);
52
+ };
53
+ isServiceConfigFileAlreadyPresent = () => {
54
+ return fs.existsSync(this.getServiceConfigFileName());
55
+ };
56
+ displayAdditionalInformation = () => {
57
+ const runCommandParallelWorkers = this._packageManager.runCommand("playwright", `test -c ${this.getServiceConfigFileName()} --workers=20`);
58
+ console.log(`\n\nTo run playwrights tests using Playwright Service\n`);
59
+ console.log(`\t${runCommandParallelWorkers}\n`);
60
+ console.log("\nPlaywright Service Portal - https://playwright.microsoft.com/");
61
+ console.log("Getting Started - https://aka.ms/mpt/quickstart\n");
62
+ console.log("If you're already using the Microsoft Playwright Testing service, please review the quickstart guide [https://aka.ms/mpt/quickstart] to ensure your tests continue running smoothly.");
63
+ console.log("We've introduced changes related to authentication. You'll need to update the new config file to align with these changes.");
64
+ };
65
+ installServicePackage = async () => {
66
+ const command = this._packageManager.installDevDependencyCommand("@azure/microsoft-playwright-testing");
67
+ console.log(`Installing Service package (${command})`);
68
+ await executeCommand(command);
69
+ };
70
+ createServiceConfig = async () => {
71
+ const serviceConfigFile = this.getServiceConfigFileName();
72
+ const serviceConfigFileContent = this.getServiceConfigContent();
73
+ await fs.promises.writeFile(serviceConfigFile, serviceConfigFileContent);
74
+ console.log(`Success! Created service configuration file - ${serviceConfigFile}`);
75
+ };
76
+ getServiceConfigContent = () => {
77
+ const customerConfigFileName = getFileReferenceForImport(this._setupConfig.playwrightConfigFile);
78
+ const importCommandTypeScript = `import { defineConfig } from '@playwright/test';
74
79
  import { getServiceConfig, ServiceOS } from '@azure/microsoft-playwright-testing';
75
80
  import config from '${customerConfigFileName}';
76
81
  `;
77
- const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');
82
+ const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');
78
83
  const { getServiceConfig, ServiceOS } = require('@azure/microsoft-playwright-testing');
79
84
  const config = require('${customerConfigFileName}');
80
85
  `;
81
- const importCommand = this._setupConfig.projectLanguage === Languages.TypeScript
82
- ? importCommandTypeScript
83
- : importCommandJavaScript;
84
- const content = importCommand +
85
- `
86
+ const importCommand = this._setupConfig.projectLanguage === Languages.TypeScript
87
+ ? importCommandTypeScript
88
+ : importCommandJavaScript;
89
+ const content = importCommand +
90
+ `
86
91
  /* Learn more about service configuration at https://aka.ms/mpt/config */
87
92
  export default defineConfig(
88
93
  config,
@@ -90,25 +95,14 @@ export default defineConfig(
90
95
  exposeNetwork: '<loopback>',
91
96
  timeout: 30000,
92
97
  os: ServiceOS.LINUX,
93
- useCloudHostedBrowsers: true // Set to false if you want to only use reporting and not cloud hosted browsers
94
98
  }),
95
- {
96
- /*
97
- Playwright Testing service reporter is added by default.
98
- This will override any reporter options specified in the base playwright config.
99
- If you are using more reporters, please update your configuration accordingly.
100
- */
101
- reporter: [['list'], ['@azure/microsoft-playwright-testing/reporter']],
102
- }
99
+
103
100
  );
104
101
  `;
105
- return content;
106
- };
107
- this.getServiceConfigFileName = () => {
108
- return "playwright.service.config" + Extensions[this._setupConfig.projectLanguage];
109
- };
110
- this._setupConfig = setupConfig;
111
- this._packageManager = getPackageManager();
112
- }
102
+ return content;
103
+ };
104
+ getServiceConfigFileName = () => {
105
+ return "playwright.service.config" + Extensions[this._setupConfig.projectLanguage];
106
+ };
113
107
  }
114
108
  //# sourceMappingURL=initialize.js.map
@@ -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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MAAM,sBAAsB,GAAG,yBAAyB,CACtD,IAAI,CAAC,YAAY,CAAC,oBAAoB,CACvC,CAAC;YAEF,MAAM,uBAAuB,GAAG;;sBAEd,sBAAsB;CAC3C,CAAC;YAEE,MAAM,uBAAuB,GAAG;;0BAEV,sBAAsB;CAC/C,CAAC;YAEE,MAAM,aAAa,GACjB,IAAI,CAAC,YAAY,CAAC,eAAe,KAAK,SAAS,CAAC,UAAU;gBACxD,CAAC,CAAC,uBAAuB;gBACzB,CAAC,CAAC,uBAAuB,CAAC;YAE9B,MAAM,OAAO,GACX,aAAa;gBACb;;;;;;;;;;;;;;;;;;;CAmBL,CAAC;YACE,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;QAEM,6BAAwB,GAAG,GAAW,EAAE;YAC9C,OAAO,2BAA2B,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;QACrF,CAAC,CAAC;QAlHA,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,iBAAiB,EAAE,CAAC;IAC7C,CAAC;CAiHF","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.getServiceConfigFileName());\n };\n\n private displayAdditionalInformation = (): void => {\n const runCommandParallelWorkers = this._packageManager.runCommand(\n \"playwright\",\n `test -c ${this.getServiceConfigFileName()} --workers=20`,\n );\n\n console.log(`\\n\\nTo run playwrights tests using Playwright Service\\n`);\n console.log(`\\t${runCommandParallelWorkers}\\n`);\n\n console.log(\"\\nPlaywright Service Portal - https://playwright.microsoft.com/\");\n console.log(\"Getting Started - https://aka.ms/mpt/quickstart\\n\");\n\n console.log(\n \"If you're already using the Microsoft Playwright Testing service, please review the quickstart guide [https://aka.ms/mpt/quickstart] to ensure your tests continue running smoothly.\",\n );\n console.log(\n \"We've introduced changes related to authentication. You'll need to update the new config file to align with these changes.\",\n );\n };\n\n private installServicePackage = async (): Promise<void> => {\n const command = this._packageManager.installDevDependencyCommand(\n \"@azure/microsoft-playwright-testing\",\n );\n console.log(`Installing Service package (${command})`);\n await executeCommand(command);\n };\n\n private createServiceConfig = async (): Promise<void> => {\n const serviceConfigFile = this.getServiceConfigFileName();\n const serviceConfigFileContent = this.getServiceConfigContent();\n await fs.promises.writeFile(serviceConfigFile, serviceConfigFileContent);\n console.log(`Success! Created service configuration file - ${serviceConfigFile}`);\n };\n\n private getServiceConfigContent = (): string => {\n const customerConfigFileName = getFileReferenceForImport(\n this._setupConfig.playwrightConfigFile,\n );\n\n const importCommandTypeScript = `import { defineConfig } from '@playwright/test';\nimport { getServiceConfig, ServiceOS } from '@azure/microsoft-playwright-testing';\nimport config from '${customerConfigFileName}';\n`;\n\n const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');\nconst { getServiceConfig, ServiceOS } = require('@azure/microsoft-playwright-testing');\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/mpt/config */\nexport default defineConfig(\n config,\n getServiceConfig(config, {\n exposeNetwork: '<loopback>',\n timeout: 30000,\n os: ServiceOS.LINUX,\n useCloudHostedBrowsers: true // Set to false if you want to only use reporting and not cloud hosted browsers\n }),\n {\n /* \n Playwright Testing service reporter is added by default.\n This will override any reporter options specified in the base playwright config.\n If you are using more reporters, please update your configuration accordingly.\n */\n reporter: [['list'], ['@azure/microsoft-playwright-testing/reporter']],\n }\n);\n`;\n return content;\n };\n\n private getServiceConfigFileName = (): string => {\n return \"playwright.service.config\" + Extensions[this._setupConfig.projectLanguage];\n };\n}\n"]}
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,EAA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AAC;IAEM,mBAAmB,GAAG,KAAK,IAAmB,EAAE;QACtD,MAAM,iBAAiB,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAC1D,MAAM,wBAAwB,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAChE,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,iBAAiB,EAAE,wBAAwB,CAAC,CAAC;QACzE,OAAO,CAAC,GAAG,CAAC,iDAAiD,iBAAiB,EAAE,CAAC,CAAC;IACpF,CAAC,CAAC;IAEM,uBAAuB,GAAG,GAAW,EAAE;QAC7C,MAAM,sBAAsB,GAAG,yBAAyB,CACtD,IAAI,CAAC,YAAY,CAAC,oBAAoB,CACvC,CAAC;QAEF,MAAM,uBAAuB,GAAG;;sBAEd,sBAAsB;CAC3C,CAAC;QAEE,MAAM,uBAAuB,GAAG;;0BAEV,sBAAsB;CAC/C,CAAC;QAEE,MAAM,aAAa,GACjB,IAAI,CAAC,YAAY,CAAC,eAAe,KAAK,SAAS,CAAC,UAAU;YACxD,CAAC,CAAC,uBAAuB;YACzB,CAAC,CAAC,uBAAuB,CAAC;QAE9B,MAAM,OAAO,GACX,aAAa;YACb;;;;;;;;;;;CAWL,CAAC;QACE,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEM,wBAAwB,GAAG,GAAW,EAAE;QAC9C,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.getServiceConfigFileName());\n };\n\n private displayAdditionalInformation = (): void => {\n const runCommandParallelWorkers = this._packageManager.runCommand(\n \"playwright\",\n `test -c ${this.getServiceConfigFileName()} --workers=20`,\n );\n\n console.log(`\\n\\nTo run playwrights tests using Playwright Service\\n`);\n console.log(`\\t${runCommandParallelWorkers}\\n`);\n\n console.log(\"\\nPlaywright Service Portal - https://playwright.microsoft.com/\");\n console.log(\"Getting Started - https://aka.ms/mpt/quickstart\\n\");\n\n console.log(\n \"If you're already using the Microsoft Playwright Testing service, please review the quickstart guide [https://aka.ms/mpt/quickstart] to ensure your tests continue running smoothly.\",\n );\n console.log(\n \"We've introduced changes related to authentication. You'll need to update the new config file to align with these changes.\",\n );\n };\n\n private installServicePackage = async (): Promise<void> => {\n const command = this._packageManager.installDevDependencyCommand(\n \"@azure/microsoft-playwright-testing\",\n );\n console.log(`Installing Service package (${command})`);\n await executeCommand(command);\n };\n\n private createServiceConfig = async (): Promise<void> => {\n const serviceConfigFile = this.getServiceConfigFileName();\n const serviceConfigFileContent = this.getServiceConfigContent();\n await fs.promises.writeFile(serviceConfigFile, serviceConfigFileContent);\n console.log(`Success! Created service configuration file - ${serviceConfigFile}`);\n };\n\n private getServiceConfigContent = (): string => {\n const customerConfigFileName = getFileReferenceForImport(\n this._setupConfig.playwrightConfigFile,\n );\n\n const importCommandTypeScript = `import { defineConfig } from '@playwright/test';\nimport { getServiceConfig, ServiceOS } from '@azure/microsoft-playwright-testing';\nimport config from '${customerConfigFileName}';\n`;\n\n const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');\nconst { getServiceConfig, ServiceOS } = require('@azure/microsoft-playwright-testing');\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/mpt/config */\nexport default defineConfig(\n config,\n getServiceConfig(config, {\n exposeNetwork: '<loopback>',\n timeout: 30000,\n os: ServiceOS.LINUX,\n }),\n\n);\n`;\n return content;\n };\n\n private getServiceConfigFileName = (): string => {\n return \"playwright.service.config\" + Extensions[this._setupConfig.projectLanguage];\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"packageManager.d.ts","sourceRoot":"","sources":["../../src/packageManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,qBAAa,GAAI,YAAW,cAAc;IACxC,2BAA2B,gBAAiB,MAAM,KAAG,MAAM,CAEzD;IACF,UAAU,YAAa,MAAM,QAAQ,MAAM,KAAG,MAAM,CAElD;CACH;AAED,qBAAa,IAAK,YAAW,cAAc;IACzC,OAAO,CAAC,YAAY,CAAkB;;IAMtC,2BAA2B,gBAAiB,MAAM,KAAG,MAAM,CAEzD;IACF,UAAU,YAAa,MAAM,QAAQ,MAAM,KAAG,MAAM,CAElD;CACH;AAED,qBAAa,IAAK,YAAW,cAAc;IACzC,2BAA2B,gBAAiB,MAAM,KAAG,MAAM,CAEzD;IACF,UAAU,YAAa,MAAM,QAAQ,MAAM,KAAG,MAAM,CAElD;CACH;AAGD,eAAO,MAAM,iBAAiB,QAAO,cAOpC,CAAC"}
1
+ {"version":3,"file":"packageManager.d.ts","sourceRoot":"","sources":["../../src/packageManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,qBAAa,GAAI,YAAW,cAAc;IACxC,2BAA2B,GAAI,aAAa,MAAM,KAAG,MAAM,CAEzD;IACF,UAAU,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,KAAG,MAAM,CAElD;CACH;AAED,qBAAa,IAAK,YAAW,cAAc;IACzC,OAAO,CAAC,YAAY,CAAkB;;IAMtC,2BAA2B,GAAI,aAAa,MAAM,KAAG,MAAM,CAEzD;IACF,UAAU,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,KAAG,MAAM,CAElD;CACH;AAED,qBAAa,IAAK,YAAW,cAAc;IACzC,2BAA2B,GAAI,aAAa,MAAM,KAAG,MAAM,CAEzD;IACF,UAAU,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,KAAG,MAAM,CAElD;CACH;AAGD,eAAO,MAAM,iBAAiB,QAAO,cAOpC,CAAC"}
@@ -4,36 +4,32 @@ import { existsSync } from "node:fs";
4
4
  import { cwd } from "node:process";
5
5
  import { resolve } from "node:path";
6
6
  export class NPM {
7
- constructor() {
8
- this.installDevDependencyCommand = (packageName) => {
9
- return `npm install --save-dev ${packageName}`;
10
- };
11
- this.runCommand = (command, args) => {
12
- return `npx ${command} ${args}`;
13
- };
14
- }
7
+ installDevDependencyCommand = (packageName) => {
8
+ return `npm install --save-dev ${packageName}`;
9
+ };
10
+ runCommand = (command, args) => {
11
+ return `npx ${command} ${args}`;
12
+ };
15
13
  }
16
14
  export class PNPM {
15
+ useWorkspace = false;
17
16
  constructor() {
18
- this.useWorkspace = false;
19
- this.installDevDependencyCommand = (packageName) => {
20
- return `pnpm add --save-dev ${this.useWorkspace ? "-w " : ""}${packageName}`;
21
- };
22
- this.runCommand = (command, args) => {
23
- return `pnpm ${command} ${args}`;
24
- };
25
17
  this.useWorkspace = existsSync(resolve(cwd(), "pnpm-workspace.yaml"));
26
18
  }
19
+ installDevDependencyCommand = (packageName) => {
20
+ return `pnpm add --save-dev ${this.useWorkspace ? "-w " : ""}${packageName}`;
21
+ };
22
+ runCommand = (command, args) => {
23
+ return `pnpm ${command} ${args}`;
24
+ };
27
25
  }
28
26
  export class Yarn {
29
- constructor() {
30
- this.installDevDependencyCommand = (packageName) => {
31
- return `yarn add --dev ${packageName}`;
32
- };
33
- this.runCommand = (command, args) => {
34
- return `yarn ${command} ${args}`;
35
- };
36
- }
27
+ installDevDependencyCommand = (packageName) => {
28
+ return `yarn add --dev ${packageName}`;
29
+ };
30
+ runCommand = (command, args) => {
31
+ return `yarn ${command} ${args}`;
32
+ };
37
33
  }
38
34
  // https://stackoverflow.com/questions/68133683/is-there-a-cross-platform-way-to-get-the-name-of-the-parent-process-in-node-js
39
35
  export const getPackageManager = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../src/packageManager.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW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I,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,IAAI,EAAE,CAAC;QAClD,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,IAAI,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,IAAI,GAAG,EAAE,CAAC;AACnB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { existsSync } from \"node:fs\";\nimport type { PackageManager } from \"./types.js\";\nimport { cwd } from \"node:process\";\nimport { resolve } from \"node:path\";\n\nexport class NPM implements PackageManager {\n installDevDependencyCommand = (packageName: string): string => {\n return `npm install --save-dev ${packageName}`;\n };\n runCommand = (command: string, args: string): string => {\n return `npx ${command} ${args}`;\n };\n}\n\nexport class PNPM implements PackageManager {\n private useWorkspace: boolean = false;\n\n constructor() {\n this.useWorkspace = existsSync(resolve(cwd(), \"pnpm-workspace.yaml\"));\n }\n\n installDevDependencyCommand = (packageName: string): string => {\n return `pnpm add --save-dev ${this.useWorkspace ? \"-w \" : \"\"}${packageName}`;\n };\n runCommand = (command: string, args: string): string => {\n return `pnpm ${command} ${args}`;\n };\n}\n\nexport class Yarn implements PackageManager {\n installDevDependencyCommand = (packageName: string): string => {\n return `yarn add --dev ${packageName}`;\n };\n runCommand = (command: string, args: string): string => {\n return `yarn ${command} ${args}`;\n };\n}\n\n// https://stackoverflow.com/questions/68133683/is-there-a-cross-platform-way-to-get-the-name-of-the-parent-process-in-node-js\nexport const getPackageManager = (): PackageManager => {\n if (process.env[\"npm_config_user_agent\"]) {\n const userAgent = process.env[\"npm_config_user_agent\"];\n if (userAgent.includes(\"yarn\")) return new Yarn();\n if (userAgent.includes(\"pnpm\")) return new PNPM();\n }\n return new NPM();\n};\n"]}
1
+ {"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../src/packageManager.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UA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AM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QACvD,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,IAAI,EAAE,CAAC;QAClD,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,IAAI,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,IAAI,GAAG,EAAE,CAAC;AACnB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { existsSync } from \"node:fs\";\nimport type { PackageManager } from \"./types.js\";\nimport { cwd } from \"node:process\";\nimport { resolve } from \"node:path\";\n\nexport class NPM implements PackageManager {\n installDevDependencyCommand = (packageName: string): string => {\n return `npm install --save-dev ${packageName}`;\n };\n runCommand = (command: string, args: string): string => {\n return `npx ${command} ${args}`;\n };\n}\n\nexport class PNPM implements PackageManager {\n private useWorkspace: boolean = false;\n\n constructor() {\n this.useWorkspace = existsSync(resolve(cwd(), \"pnpm-workspace.yaml\"));\n }\n\n installDevDependencyCommand = (packageName: string): string => {\n return `pnpm add --save-dev ${this.useWorkspace ? \"-w \" : \"\"}${packageName}`;\n };\n runCommand = (command: string, args: string): string => {\n return `pnpm ${command} ${args}`;\n };\n}\n\nexport class Yarn implements PackageManager {\n installDevDependencyCommand = (packageName: string): string => {\n return `yarn add --dev ${packageName}`;\n };\n runCommand = (command: string, args: string): string => {\n return `yarn ${command} ${args}`;\n };\n}\n\n// https://stackoverflow.com/questions/68133683/is-there-a-cross-platform-way-to-get-the-name-of-the-parent-process-in-node-js\nexport const getPackageManager = (): PackageManager => {\n if (process.env[\"npm_config_user_agent\"]) {\n const userAgent = process.env[\"npm_config_user_agent\"];\n if (userAgent.includes(\"yarn\")) return new Yarn();\n if (userAgent.includes(\"pnpm\")) return new PNPM();\n }\n return new NPM();\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAG5E,eAAO,MAAM,cAAc,YAAa,MAAM,KAAG,OAAO,CAAC,MAAM,CAU9D,CAAC;AAEF,eAAO,MAAM,qCAAqC,QAAO,2BAcxD,CAAC;AAEF,eAAO,MAAM,6CAA6C,yBAClC,MAAM,KAC3B,2BAaF,CAAC;AAEF,eAAO,MAAM,yBAAyB,aAAc,MAAM,KAAG,MAW5D,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,MAUjC,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,YAcpC,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAG5E,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,KAAG,OAAO,CAAC,MAAM,CAU9D,CAAC;AAEF,eAAO,MAAM,qCAAqC,QAAO,2BAcxD,CAAC;AAEF,eAAO,MAAM,6CAA6C,GACxD,sBAAsB,MAAM,KAC3B,2BAaF,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,UAAU,MAAM,KAAG,MAW5D,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,MAUjC,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,YAcpC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/create-microsoft-playwright-testing",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "Package to setup @azure/microsoft-playwright-testing",
5
5
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/create-microsoft-playwright-testing/README.md",
6
6
  "sdk-type": "client",
@@ -19,7 +19,7 @@
19
19
  "url": "https://github.com/Azure/azure-sdk-for-js/issues"
20
20
  },
21
21
  "engines": {
22
- "node": ">=18.0.0"
22
+ "node": ">=20.0.0"
23
23
  },
24
24
  "sideEffects": false,
25
25
  "type": "module",
@@ -30,48 +30,25 @@
30
30
  "init": "dist/commonjs/index.js"
31
31
  },
32
32
  "files": [
33
- "dist",
33
+ "dist/",
34
34
  "README.md",
35
- "LICENSE",
36
- "CHANGELOG.md"
35
+ "LICENSE"
37
36
  ],
38
- "scripts": {
39
- "build": "npm run clean && dev-tool run build-package",
40
- "build:samples": "echo Obsolete",
41
- "build:test": "echo skipped. actual commands inlined in browser test scripts",
42
- "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
43
- "clean": "dev-tool run vendored rimraf --glob dist *.log dist-test temp types *.tgz *.xml samples/**/test-results/",
44
- "execute:samples": "echo skipped",
45
- "extract-api": "echo skipped",
46
- "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
47
- "integration-test": "npm run integration-test:node && npm run integration-test:browser",
48
- "integration-test:browser": "echo skipped",
49
- "integration-test:node": "echo skipped",
50
- "lint": "eslint package.json CHANGELOG.md README.md src",
51
- "lint:fix": "eslint package.json CHANGELOG.md README.md src --fix --fix-type [problem,suggestion]",
52
- "pack": "npm pack 2>&1",
53
- "test": "npm run build:test && npm run unit-test && npm run integration-test",
54
- "test:browser": "npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
55
- "test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
56
- "unit-test": "npm run unit-test:node && npm run unit-test:browser",
57
- "unit-test:browser": "echo skipped",
58
- "unit-test:node": "dev-tool run test:vitest --no-test-proxy",
59
- "update-snippets": "echo skipped"
60
- },
61
37
  "dependencies": {
62
38
  "prompts": "^2.4.2",
63
- "tslib": "^2.6.0"
39
+ "tslib": "^2.8.1"
64
40
  },
65
41
  "devDependencies": {
66
- "@azure-tools/test-utils": "^1.0.1",
67
- "@azure/dev-tool": "^1.0.0",
68
- "@azure/eslint-plugin-azure-sdk": "^3.0.0",
69
- "@types/node": "^20.12.12",
42
+ "@azure/logger": "^1.1.4",
43
+ "@types/node": "^20.19.0",
70
44
  "@types/prompts": "^2.4.9",
71
- "@vitest/coverage-istanbul": "^2.1.2",
72
- "eslint": "^9.9.0",
73
- "typescript": "~5.6.2",
74
- "vitest": "^2.1.2"
45
+ "@vitest/coverage-istanbul": "^3.2.3",
46
+ "eslint": "^9.33.0",
47
+ "typescript": "~5.8.3",
48
+ "vitest": "^3.2.3",
49
+ "@azure-tools/test-utils-vitest": "^1.0.0",
50
+ "@azure/eslint-plugin-azure-sdk": "^3.0.0",
51
+ "@azure/dev-tool": "^1.0.0"
75
52
  },
76
53
  "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
77
54
  "//sampleConfiguration": {
@@ -84,6 +61,7 @@
84
61
  }
85
62
  },
86
63
  "tshy": {
64
+ "project": "../../../tsconfig.src.build.json",
87
65
  "exports": {
88
66
  "./package.json": "./package.json",
89
67
  ".": "./src/index.ts"
@@ -106,5 +84,22 @@
106
84
  "default": "./dist/commonjs/index.js"
107
85
  }
108
86
  }
87
+ },
88
+ "scripts": {
89
+ "build": "npm run clean && dev-tool run build-package",
90
+ "build:samples": "echo Skipped.",
91
+ "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
92
+ "clean": "dev-tool run vendored rimraf --glob dist *.log dist-test temp types *.tgz *.xml samples/**/test-results/",
93
+ "execute:samples": "echo skipped",
94
+ "extract-api": "echo skipped",
95
+ "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
96
+ "lint": "eslint package.json src",
97
+ "lint:fix": "eslint package.json src --fix --fix-type [problem,suggestion]",
98
+ "pack": "pnpm pack 2>&1",
99
+ "test": "npm run test:node && npm run test:browser",
100
+ "test:browser": "echo skipped",
101
+ "test:node": "dev-tool run test:vitest --no-test-proxy",
102
+ "test:node:esm": "dev-tool run test:vitest --esm --no-test-proxy",
103
+ "update-snippets": "dev-tool run update-snippets"
109
104
  }
110
- }
105
+ }
package/CHANGELOG.md DELETED
@@ -1,16 +0,0 @@
1
- # Release History
2
-
3
- ## 1.0.0-beta.2 (2024-11-19)
4
-
5
- This release improves compatibility with modern JavaScript environments by migrating the package to ECMAScript modules and Vitest
6
-
7
- ### Other Changes
8
-
9
- -Migrated package to ECMAScript modules and vitest.
10
-
11
- ## 1.0.0-beta.1 (2024-09-09)
12
-
13
- ### Features Added
14
-
15
- - Added authentication using Entra ID for the service.
16
- - Added reporting capabilities for the service. You can now publish the reports and artifacts generated by Playwright OSS to the service.