@azure/create-microsoft-playwright-testing 1.0.0-beta.1 → 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 +4 -4
- package/dist/commonjs/bin/init.d.ts.map +1 -0
- package/dist/commonjs/bin/init.js +27 -0
- package/dist/commonjs/bin/init.js.map +1 -0
- package/dist/{constants.d.ts → commonjs/constants.d.ts} +1 -1
- package/dist/commonjs/constants.d.ts.map +1 -0
- package/dist/commonjs/constants.js.map +1 -0
- package/dist/{index.d.ts.map → commonjs/index.d.ts.map} +1 -1
- package/dist/{index.js → commonjs/index.js} +4 -5
- package/dist/commonjs/index.js.map +1 -0
- package/dist/{initialize.d.ts → commonjs/initialize.d.ts} +1 -1
- package/dist/commonjs/initialize.d.ts.map +1 -0
- package/dist/commonjs/initialize.js +113 -0
- package/dist/commonjs/initialize.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/{packageManager.d.ts → commonjs/packageManager.d.ts} +1 -1
- package/dist/commonjs/packageManager.d.ts.map +1 -0
- package/dist/commonjs/packageManager.js +52 -0
- package/dist/commonjs/packageManager.js.map +1 -0
- package/dist/commonjs/types.d.ts.map +1 -0
- package/dist/commonjs/types.js.map +1 -0
- package/dist/{utils.d.ts → commonjs/utils.d.ts} +1 -1
- package/dist/commonjs/utils.d.ts.map +1 -0
- package/dist/{utils.js → commonjs/utils.js} +20 -20
- package/dist/commonjs/utils.js.map +1 -0
- package/dist/esm/bin/init.d.ts +2 -0
- package/dist/esm/bin/init.d.ts.map +1 -0
- package/dist/esm/bin/init.js +23 -0
- package/dist/esm/bin/init.js.map +1 -0
- package/dist/esm/constants.d.ts +19 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +20 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/initialize.d.ts +16 -0
- package/dist/esm/initialize.d.ts.map +1 -0
- package/dist/esm/initialize.js +108 -0
- package/dist/esm/initialize.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/packageManager.d.ts +17 -0
- package/dist/esm/packageManager.d.ts.map +1 -0
- package/dist/esm/packageManager.js +45 -0
- package/dist/esm/packageManager.js.map +1 -0
- package/dist/esm/types.d.ts +17 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +4 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils.d.ts +8 -0
- package/dist/esm/utils.d.ts.map +1 -0
- package/dist/esm/utils.js +92 -0
- package/dist/esm/utils.js.map +1 -0
- package/package.json +61 -45
- package/CHANGELOG.md +0 -8
- package/dist/bin/init.d.ts.map +0 -1
- package/dist/bin/init.js +0 -23
- package/dist/bin/init.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/initialize.d.ts.map +0 -1
- package/dist/initialize.js +0 -119
- package/dist/initialize.js.map +0 -1
- package/dist/packageManager.d.ts.map +0 -1
- package/dist/packageManager.js +0 -56
- package/dist/packageManager.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js.map +0 -1
- /package/dist/{bin → commonjs/bin}/init.d.ts +0 -0
- /package/dist/{constants.js → commonjs/constants.js} +0 -0
- /package/dist/{index.d.ts → commonjs/index.d.ts} +0 -0
- /package/dist/{types.d.ts → commonjs/types.d.ts} +0 -0
- /package/dist/{types.js → commonjs/types.js} +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
Copyright (c) Microsoft Corporation.
|
|
2
2
|
|
|
3
|
-
|
|
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
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/bin/init.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,IAAI,QAAa,OAAO,CAAC,IAAI,CAkBzC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.init = void 0;
|
|
6
|
+
const initialize_js_1 = require("../initialize.js");
|
|
7
|
+
const utils_js_1 = require("../utils.js");
|
|
8
|
+
const init = async () => {
|
|
9
|
+
const options = (0, utils_js_1.parseCLIArguments)();
|
|
10
|
+
const { config: playwrightConfigFile } = options;
|
|
11
|
+
let playwrightServiceInitConfig;
|
|
12
|
+
if (playwrightConfigFile) {
|
|
13
|
+
playwrightServiceInitConfig = {
|
|
14
|
+
...(0, utils_js_1.getLanguageAndConfigInfoFromConfigurationFile)(playwrightConfigFile),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
playwrightServiceInitConfig = {
|
|
19
|
+
...(0, utils_js_1.getLanguageAndConfigInfoFromDirectory)(),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
console.log("");
|
|
23
|
+
const playwrightServiceInitialize = new initialize_js_1.PlaywrightServiceInitialize(playwrightServiceInitConfig);
|
|
24
|
+
await playwrightServiceInitialize.addServiceSupportToTestSuite();
|
|
25
|
+
};
|
|
26
|
+
exports.init = init;
|
|
27
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +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,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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAO,MAAM,SAAS;gBACQ,QAAQ;gBACR,QAAQ;CACrC,CAAC;AAEF,eAAO,MAAM,UAAU;;;CAGtB,CAAC;AAEF,eAAO,MAAM,aAAa;;;CAIzB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;CAMpB,CAAC"}
|
|
@@ -0,0 +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,+FAA+F;IACjG,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 service 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
"use strict";
|
|
4
3
|
// Copyright (c) Microsoft Corporation.
|
|
5
4
|
// Licensed under the MIT License.
|
|
6
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const
|
|
6
|
+
const init_js_1 = require("./bin/init.js");
|
|
8
7
|
(async () => {
|
|
9
|
-
await (0,
|
|
8
|
+
await (0, init_js_1.init)();
|
|
10
9
|
})().catch((err) => {
|
|
11
10
|
console.error(err);
|
|
12
11
|
process.exit(1);
|
|
13
12
|
});
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAEA,uCAAuC;AACvC,kCAAkC;;AAElC,2CAAqC;AAErC,CAAC,KAAK,IAAI,EAAE;IACV,MAAM,IAAA,cAAI,GAAE,CAAC;AACf,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACjB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { init } from \"./bin/init.js\";\n\n(async () => {\n await init();\n})().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n"]}
|
|
@@ -0,0 +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,CAmC7B;IAEF,OAAO,CAAC,wBAAwB,CAE9B;CACH"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.PlaywrightServiceInitialize = void 0;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const prompts_1 = tslib_1.__importDefault(require("prompts"));
|
|
8
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
9
|
+
const constants_js_1 = require("./constants.js");
|
|
10
|
+
const utils_js_1 = require("./utils.js");
|
|
11
|
+
const packageManager_js_1 = require("./packageManager.js");
|
|
12
|
+
const questions = [
|
|
13
|
+
{
|
|
14
|
+
type: "confirm",
|
|
15
|
+
name: "canOverride",
|
|
16
|
+
message: constants_js_1.Messages.CAN_OVERRIDE_MESSAGE,
|
|
17
|
+
initial: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: (prev) => (prev ? null : "confirm"),
|
|
21
|
+
name: "confirmationForExit",
|
|
22
|
+
message: constants_js_1.Messages.CONFIRMATION_FOR_EXIT_MESSAGE,
|
|
23
|
+
initial: true,
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
class PlaywrightServiceInitialize {
|
|
27
|
+
_setupConfig;
|
|
28
|
+
_packageManager;
|
|
29
|
+
constructor(setupConfig) {
|
|
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';
|
|
83
|
+
import { getServiceConfig, ServiceOS } from '@azure/microsoft-playwright-testing';
|
|
84
|
+
import config from '${customerConfigFileName}';
|
|
85
|
+
`;
|
|
86
|
+
const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');
|
|
87
|
+
const { getServiceConfig, ServiceOS } = require('@azure/microsoft-playwright-testing');
|
|
88
|
+
const config = require('${customerConfigFileName}');
|
|
89
|
+
`;
|
|
90
|
+
const importCommand = this._setupConfig.projectLanguage === constants_js_1.Languages.TypeScript
|
|
91
|
+
? importCommandTypeScript
|
|
92
|
+
: importCommandJavaScript;
|
|
93
|
+
const content = importCommand +
|
|
94
|
+
`
|
|
95
|
+
/* Learn more about service configuration at https://aka.ms/mpt/config */
|
|
96
|
+
export default defineConfig(
|
|
97
|
+
config,
|
|
98
|
+
getServiceConfig(config, {
|
|
99
|
+
exposeNetwork: '<loopback>',
|
|
100
|
+
timeout: 30000,
|
|
101
|
+
os: ServiceOS.LINUX,
|
|
102
|
+
}),
|
|
103
|
+
|
|
104
|
+
);
|
|
105
|
+
`;
|
|
106
|
+
return content;
|
|
107
|
+
};
|
|
108
|
+
getServiceConfigFileName = () => {
|
|
109
|
+
return "playwright.service.config" + constants_js_1.Extensions[this._setupConfig.projectLanguage];
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
exports.PlaywrightServiceInitialize = PlaywrightServiceInitialize;
|
|
113
|
+
//# sourceMappingURL=initialize.js.map
|
|
@@ -0,0 +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,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,CAAC;QAClD,IAAI,EAAE,qBAAqB;QAC3B,OAAO,EAAE,uBAAQ,CAAC,6BAA6B;QAC/C,OAAO,EAAE,IAAI;KACd;CACF,CAAC;AAEF,MAAa,2BAA2B;IAC9B,YAAY,CAA8B;IAC1C,eAAe,CAAiB;IAExC,YAAY,WAAwC;QAClD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,IAAA,qCAAiB,GAAE,CAAC;IAC7C,CAAC;IAEM,4BAA4B,GAAG,KAAK,IAAmB,EAAE;QAC9D,MAAM,mCAAmC,GAAG,MAAM,IAAI,CAAC,8BAA8B,EAAE,CAAC,CAAC,uEAAuE;QAChK,IAAI,CAAC,mCAAmC;YAAE,OAAO;QACjD,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,2BAA2B;QAC/D,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,6BAA6B;QAC/D,IAAI,CAAC,4BAA4B,EAAE,CAAC,CAAC,iCAAiC;IACxE,CAAC,CAAC;IAEM,8BAA8B,GAAG,KAAK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port 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"]}
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.getPackageManager = exports.Yarn = exports.PNPM = exports.NPM = void 0;
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_process_1 = require("node:process");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
class NPM {
|
|
10
|
+
installDevDependencyCommand = (packageName) => {
|
|
11
|
+
return `npm install --save-dev ${packageName}`;
|
|
12
|
+
};
|
|
13
|
+
runCommand = (command, args) => {
|
|
14
|
+
return `npx ${command} ${args}`;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.NPM = NPM;
|
|
18
|
+
class PNPM {
|
|
19
|
+
useWorkspace = false;
|
|
20
|
+
constructor() {
|
|
21
|
+
this.useWorkspace = (0, node_fs_1.existsSync)((0, node_path_1.resolve)((0, node_process_1.cwd)(), "pnpm-workspace.yaml"));
|
|
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
|
+
};
|
|
29
|
+
}
|
|
30
|
+
exports.PNPM = PNPM;
|
|
31
|
+
class Yarn {
|
|
32
|
+
installDevDependencyCommand = (packageName) => {
|
|
33
|
+
return `yarn add --dev ${packageName}`;
|
|
34
|
+
};
|
|
35
|
+
runCommand = (command, args) => {
|
|
36
|
+
return `yarn ${command} ${args}`;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
exports.Yarn = Yarn;
|
|
40
|
+
// https://stackoverflow.com/questions/68133683/is-there-a-cross-platform-way-to-get-the-name-of-the-parent-process-in-node-js
|
|
41
|
+
const getPackageManager = () => {
|
|
42
|
+
if (process.env["npm_config_user_agent"]) {
|
|
43
|
+
const userAgent = process.env["npm_config_user_agent"];
|
|
44
|
+
if (userAgent.includes("yarn"))
|
|
45
|
+
return new Yarn();
|
|
46
|
+
if (userAgent.includes("pnpm"))
|
|
47
|
+
return new PNPM();
|
|
48
|
+
}
|
|
49
|
+
return new NPM();
|
|
50
|
+
};
|
|
51
|
+
exports.getPackageManager = getPackageManager;
|
|
52
|
+
//# sourceMappingURL=packageManager.js.map
|
|
@@ -0,0 +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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AC;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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAC;AAEnD,MAAM,MAAM,2BAA2B,GAAG;IACxC,eAAe,EAAE,QAAQ,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,2BAA2B,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7D,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport type Language = \"TypeScript\" | \"JavaScript\";\n\nexport type PlaywrightServiceInitConfig = {\n projectLanguage: Language;\n playwrightConfigFile: string;\n};\n\nexport type CLIArguments = {\n config: string;\n};\n\nexport type OverridePromptResponse = {\n canOverride: boolean;\n confirmationForExit: boolean;\n};\n\nexport type PackageManager = {\n installDevDependencyCommand: (packageName: string) => string;\n runCommand: (command: string, args: string) => string;\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CLIArguments, PlaywrightServiceInitConfig } from "./types";
|
|
1
|
+
import type { CLIArguments, PlaywrightServiceInitConfig } from "./types.js";
|
|
2
2
|
export declare const executeCommand: (command: string) => Promise<string>;
|
|
3
3
|
export declare const getLanguageAndConfigInfoFromDirectory: () => PlaywrightServiceInitConfig;
|
|
4
4
|
export declare const getLanguageAndConfigInfoFromConfigurationFile: (playwrightConfigFile: string) => PlaywrightServiceInitConfig;
|
|
@@ -0,0 +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,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"}
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.parseCLIArguments = exports.showHelpForCLI = exports.getFileReferenceForImport = exports.getLanguageAndConfigInfoFromConfigurationFile = exports.getLanguageAndConfigInfoFromDirectory = exports.executeCommand = void 0;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = tslib_1.__importStar(require("node:path"));
|
|
10
|
+
const constants_js_1 = require("./constants.js");
|
|
11
11
|
const executeCommand = (command) => {
|
|
12
12
|
return new Promise((resolve, reject) => {
|
|
13
|
-
(0,
|
|
13
|
+
(0, node_child_process_1.exec)(command, (error, stdout, _) => {
|
|
14
14
|
if (error) {
|
|
15
15
|
reject(error);
|
|
16
16
|
}
|
|
@@ -22,46 +22,46 @@ const executeCommand = (command) => {
|
|
|
22
22
|
};
|
|
23
23
|
exports.executeCommand = executeCommand;
|
|
24
24
|
const getLanguageAndConfigInfoFromDirectory = () => {
|
|
25
|
-
if (
|
|
25
|
+
if (node_fs_1.default.existsSync("playwright.config.js")) {
|
|
26
26
|
return {
|
|
27
27
|
playwrightConfigFile: "playwright.config.js",
|
|
28
|
-
projectLanguage:
|
|
28
|
+
projectLanguage: constants_js_1.Languages.JavaScript,
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
else if (
|
|
31
|
+
else if (node_fs_1.default.existsSync("playwright.config.ts")) {
|
|
32
32
|
return {
|
|
33
33
|
playwrightConfigFile: "playwright.config.ts",
|
|
34
|
-
projectLanguage:
|
|
34
|
+
projectLanguage: constants_js_1.Languages.TypeScript,
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
throw new Error(
|
|
38
|
+
throw new Error(constants_js_1.ErrorMessages.NO_CONFIGURATION_FILE_FOUND);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
exports.getLanguageAndConfigInfoFromDirectory = getLanguageAndConfigInfoFromDirectory;
|
|
42
42
|
const getLanguageAndConfigInfoFromConfigurationFile = (playwrightConfigFile) => {
|
|
43
|
-
const extension = (0,
|
|
44
|
-
if (extension ===
|
|
43
|
+
const extension = (0, node_path_1.extname)(playwrightConfigFile);
|
|
44
|
+
if (extension === constants_js_1.Extensions.TypeScript) {
|
|
45
45
|
return {
|
|
46
46
|
playwrightConfigFile,
|
|
47
|
-
projectLanguage:
|
|
47
|
+
projectLanguage: constants_js_1.Languages.TypeScript,
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
else if (extension ===
|
|
50
|
+
else if (extension === constants_js_1.Extensions.JavaScript) {
|
|
51
51
|
return {
|
|
52
52
|
playwrightConfigFile,
|
|
53
|
-
projectLanguage:
|
|
53
|
+
projectLanguage: constants_js_1.Languages.JavaScript,
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
else
|
|
57
|
-
throw new Error(
|
|
57
|
+
throw new Error(constants_js_1.ErrorMessages.UNSUPPORTED_CONFIGURATION_FILE);
|
|
58
58
|
};
|
|
59
59
|
exports.getLanguageAndConfigInfoFromConfigurationFile = getLanguageAndConfigInfoFromConfigurationFile;
|
|
60
60
|
const getFileReferenceForImport = (filePath) => {
|
|
61
|
-
const normalizedPath = filePath.split(
|
|
62
|
-
const parsedPath =
|
|
63
|
-
const withoutExtension =
|
|
64
|
-
if (
|
|
61
|
+
const normalizedPath = filePath.split(node_path_1.default.sep).join("/");
|
|
62
|
+
const parsedPath = node_path_1.default.parse(normalizedPath);
|
|
63
|
+
const withoutExtension = node_path_1.default.posix.join(parsedPath.dir, parsedPath.name);
|
|
64
|
+
if (node_path_1.default.isAbsolute(filePath)) {
|
|
65
65
|
return withoutExtension;
|
|
66
66
|
}
|
|
67
67
|
if (!withoutExtension.startsWith("./") && !withoutExtension.startsWith("../")) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,2DAA0C;AAC1C,8DAAyB;AACzB,+DAA0C;AAE1C,iDAAsE;AAE/D,MAAM,cAAc,GAAG,CAAC,OAAe,EAAmB,EAAE;IACjE,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC7C,IAAA,yBAAI,EAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;YACjC,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAVW,QAAA,cAAc,kBAUzB;AAEK,MAAM,qCAAqC,GAAG,GAAgC,EAAE;IACrF,IAAI,iB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AC;IACH,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAdW,QAAA,iBAAiB,qBAc5B","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { exec } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path, { extname } from \"node:path\";\nimport type { CLIArguments, PlaywrightServiceInitConfig } from \"./types.js\";\nimport { ErrorMessages, Extensions, Languages } from \"./constants.js\";\n\nexport const executeCommand = (command: string): Promise<string> => {\n return new Promise<string>((resolve, reject) => {\n exec(command, (error, stdout, _) => {\n if (error) {\n reject(error);\n } else {\n resolve(stdout);\n }\n });\n });\n};\n\nexport const getLanguageAndConfigInfoFromDirectory = (): PlaywrightServiceInitConfig => {\n if (fs.existsSync(\"playwright.config.js\")) {\n return {\n playwrightConfigFile: \"playwright.config.js\",\n projectLanguage: Languages.JavaScript,\n };\n } else if (fs.existsSync(\"playwright.config.ts\")) {\n return {\n playwrightConfigFile: \"playwright.config.ts\",\n projectLanguage: Languages.TypeScript,\n };\n } else {\n throw new Error(ErrorMessages.NO_CONFIGURATION_FILE_FOUND);\n }\n};\n\nexport const getLanguageAndConfigInfoFromConfigurationFile = (\n playwrightConfigFile: string,\n): PlaywrightServiceInitConfig => {\n const extension = extname(playwrightConfigFile);\n if (extension === Extensions.TypeScript) {\n return {\n playwrightConfigFile,\n projectLanguage: Languages.TypeScript,\n };\n } else if (extension === Extensions.JavaScript) {\n return {\n playwrightConfigFile,\n projectLanguage: Languages.JavaScript,\n };\n } else throw new Error(ErrorMessages.UNSUPPORTED_CONFIGURATION_FILE);\n};\n\nexport const getFileReferenceForImport = (filePath: string): string => {\n const normalizedPath = filePath.split(path.sep).join(\"/\");\n const parsedPath = path.parse(normalizedPath);\n const withoutExtension = path.posix.join(parsedPath.dir, parsedPath.name);\n if (path.isAbsolute(filePath)) {\n return withoutExtension;\n }\n if (!withoutExtension.startsWith(\"./\") && !withoutExtension.startsWith(\"../\")) {\n return `./${withoutExtension}`;\n }\n return withoutExtension;\n};\n\nexport const showHelpForCLI = (): string => {\n return `\nUsage: index [options]\n\nplaywright configuration file\n\nOptions:\n -c, --config <config>\n -h, --help display help for command\n`;\n};\n\nexport const parseCLIArguments = (): CLIArguments => {\n const args = process.argv.slice(2);\n const cliArguments: CLIArguments = {\n config: \"\",\n };\n for (let i = 0; i < args.length; i++) {\n if (args[i] === \"-c\" || args[i] === \"--config\") {\n cliArguments.config = args[i + 1];\n } else if (args[i] === \"-h\" || args[i] === \"--help\") {\n console.log(showHelpForCLI());\n process.exit(0);\n }\n }\n return cliArguments;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/bin/init.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,IAAI,QAAa,OAAO,CAAC,IAAI,CAkBzC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { PlaywrightServiceInitialize } from "../initialize.js";
|
|
4
|
+
import { getLanguageAndConfigInfoFromConfigurationFile, getLanguageAndConfigInfoFromDirectory, parseCLIArguments, } from "../utils.js";
|
|
5
|
+
export const init = async () => {
|
|
6
|
+
const options = parseCLIArguments();
|
|
7
|
+
const { config: playwrightConfigFile } = options;
|
|
8
|
+
let playwrightServiceInitConfig;
|
|
9
|
+
if (playwrightConfigFile) {
|
|
10
|
+
playwrightServiceInitConfig = {
|
|
11
|
+
...getLanguageAndConfigInfoFromConfigurationFile(playwrightConfigFile),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
playwrightServiceInitConfig = {
|
|
16
|
+
...getLanguageAndConfigInfoFromDirectory(),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
console.log("");
|
|
20
|
+
const playwrightServiceInitialize = new PlaywrightServiceInitialize(playwrightServiceInitConfig);
|
|
21
|
+
await playwrightServiceInitialize.addServiceSupportToTestSuite();
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +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,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"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Language } from "./types.js";
|
|
2
|
+
export declare const Languages: {
|
|
3
|
+
TypeScript: Language;
|
|
4
|
+
JavaScript: Language;
|
|
5
|
+
};
|
|
6
|
+
export declare const Extensions: {
|
|
7
|
+
TypeScript: string;
|
|
8
|
+
JavaScript: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const ErrorMessages: {
|
|
11
|
+
NO_CONFIGURATION_FILE_FOUND: string;
|
|
12
|
+
UNSUPPORTED_CONFIGURATION_FILE: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const Messages: {
|
|
15
|
+
CAN_OVERRIDE_MESSAGE: string;
|
|
16
|
+
CONFIRMATION_FOR_EXIT_MESSAGE: string;
|
|
17
|
+
SETUP_PROCESS_EXIT_MESSAGE: string;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAO,MAAM,SAAS;gBACQ,QAAQ;gBACR,QAAQ;CACrC,CAAC;AAEF,eAAO,MAAM,UAAU;;;CAGtB,CAAC;AAEF,eAAO,MAAM,aAAa;;;CAIzB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;CAMpB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
export const Languages = {
|
|
4
|
+
TypeScript: "TypeScript",
|
|
5
|
+
JavaScript: "JavaScript",
|
|
6
|
+
};
|
|
7
|
+
export const Extensions = {
|
|
8
|
+
TypeScript: ".ts",
|
|
9
|
+
JavaScript: ".js",
|
|
10
|
+
};
|
|
11
|
+
export const ErrorMessages = {
|
|
12
|
+
NO_CONFIGURATION_FILE_FOUND: "Could not find a playwright configuration file in the current directory. Please use --config parameter to specify the configuration file.",
|
|
13
|
+
UNSUPPORTED_CONFIGURATION_FILE: "The playwright configuration file passed is not supported.",
|
|
14
|
+
};
|
|
15
|
+
export const Messages = {
|
|
16
|
+
CAN_OVERRIDE_MESSAGE: "There's already a playwright service configuration file present. Do you want to overwrite it?",
|
|
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
|
+
SETUP_PROCESS_EXIT_MESSAGE: "Exiting the service setup process.",
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +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,+FAA+F;IACjG,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 service 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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
import { init } from "./bin/init.js";
|
|
5
|
+
(async () => {
|
|
6
|
+
await init();
|
|
7
|
+
})().catch((err) => {
|
|
8
|
+
console.error(err);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAEA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,CAAC,KAAK,IAAI,EAAE;IACV,MAAM,IAAI,EAAE,CAAC;AACf,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACjB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { init } from \"./bin/init.js\";\n\n(async () => {\n await init();\n})().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PlaywrightServiceInitConfig } from "./types.js";
|
|
2
|
+
export declare class PlaywrightServiceInitialize {
|
|
3
|
+
private _setupConfig;
|
|
4
|
+
private _packageManager;
|
|
5
|
+
constructor(setupConfig: PlaywrightServiceInitConfig);
|
|
6
|
+
addServiceSupportToTestSuite: () => Promise<void>;
|
|
7
|
+
private checkIfServiceConfigCanBeAdded;
|
|
8
|
+
private promptOnCancel;
|
|
9
|
+
private isServiceConfigFileAlreadyPresent;
|
|
10
|
+
private displayAdditionalInformation;
|
|
11
|
+
private installServicePackage;
|
|
12
|
+
private createServiceConfig;
|
|
13
|
+
private getServiceConfigContent;
|
|
14
|
+
private getServiceConfigFileName;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=initialize.d.ts.map
|
|
@@ -0,0 +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,CAmC7B;IAEF,OAAO,CAAC,wBAAwB,CAE9B;CACH"}
|