@wdio/cli 7.20.6 → 7.20.8-alpha.504
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/bin/wdio.js +7 -1
- package/build/commands/config.d.ts +3 -3
- package/build/commands/config.d.ts.map +1 -1
- package/build/commands/config.js +58 -69
- package/build/commands/index.d.ts +2 -0
- package/build/commands/index.d.ts.map +1 -0
- package/build/commands/index.js +5 -0
- package/build/commands/install.d.ts +3 -3
- package/build/commands/install.d.ts.map +1 -1
- package/build/commands/install.js +28 -35
- package/build/commands/repl.d.ts +5 -5
- package/build/commands/repl.d.ts.map +1 -1
- package/build/commands/repl.js +15 -29
- package/build/commands/run.d.ts +7 -5
- package/build/commands/run.d.ts.map +1 -1
- package/build/commands/run.js +54 -33
- package/build/constants.d.ts +16 -2
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +53 -48
- package/build/index.d.ts +4 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +24 -41
- package/build/interface.d.ts +3 -3
- package/build/interface.d.ts.map +1 -1
- package/build/interface.js +57 -52
- package/build/launcher.d.ts +4 -4
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +81 -61
- package/build/types.d.ts +2 -2
- package/build/types.d.ts.map +1 -1
- package/build/types.js +1 -2
- package/build/utils.d.ts +8 -1
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +102 -92
- package/build/watcher.d.ts +1 -1
- package/build/watcher.d.ts.map +1 -1
- package/build/watcher.js +25 -24
- package/package.json +32 -27
package/build/commands/run.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const watcher_1 = __importDefault(require("../watcher"));
|
|
12
|
-
const constants_1 = require("../constants");
|
|
13
|
-
exports.command = 'run <configPath>';
|
|
14
|
-
exports.desc = 'Run your WDIO configuration file to initialize your tests. (default)';
|
|
15
|
-
exports.cmdArgs = {
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import cp from 'node:child_process';
|
|
4
|
+
import Launcher from '../launcher.js';
|
|
5
|
+
import Watcher from '../watcher.js';
|
|
6
|
+
import { missingConfigurationPrompt } from './config.js';
|
|
7
|
+
import { CLI_EPILOGUE } from '../constants.js';
|
|
8
|
+
export const command = 'run <configPath>';
|
|
9
|
+
export const desc = 'Run your WDIO configuration file to initialize your tests. (default)';
|
|
10
|
+
export const cmdArgs = {
|
|
16
11
|
watch: {
|
|
17
12
|
desc: 'Run WebdriverIO in watch mode',
|
|
18
13
|
type: 'boolean',
|
|
@@ -94,19 +89,18 @@ exports.cmdArgs = {
|
|
|
94
89
|
desc: 'Auto compilation options'
|
|
95
90
|
}
|
|
96
91
|
};
|
|
97
|
-
const builder = (yargs) => {
|
|
92
|
+
export const builder = (yargs) => {
|
|
98
93
|
return yargs
|
|
99
|
-
.options(
|
|
94
|
+
.options(cmdArgs)
|
|
100
95
|
.example('$0 run wdio.conf.js --suite foobar', 'Run suite on testsuite "foobar"')
|
|
101
96
|
.example('$0 run wdio.conf.js --spec ./tests/e2e/a.js --spec ./tests/e2e/b.js', 'Run suite on specific specs')
|
|
102
97
|
.example('$0 run wdio.conf.js --mochaOpts.timeout 60000', 'Run suite with custom Mocha timeout')
|
|
103
98
|
.example('$0 run wdio.conf.js --autoCompileOpts.autoCompile=false', 'Disable auto-loading of ts-node or @babel/register')
|
|
104
99
|
.example('$0 run wdio.conf.js --autoCompileOpts.tsNodeOpts.project=configs/bdd-tsconfig.json', 'Run suite with ts-node using custom tsconfig.json')
|
|
105
|
-
.epilogue(
|
|
100
|
+
.epilogue(CLI_EPILOGUE)
|
|
106
101
|
.help();
|
|
107
102
|
};
|
|
108
|
-
|
|
109
|
-
function launchWithStdin(wdioConfPath, params) {
|
|
103
|
+
export function launchWithStdin(wdioConfPath, params) {
|
|
110
104
|
let stdinData = '';
|
|
111
105
|
const stdin = process.openStdin();
|
|
112
106
|
stdin.setEncoding('utf8');
|
|
@@ -120,37 +114,65 @@ function launchWithStdin(wdioConfPath, params) {
|
|
|
120
114
|
launch(wdioConfPath, params);
|
|
121
115
|
});
|
|
122
116
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
117
|
+
export function launch(wdioConfPath, params) {
|
|
118
|
+
/**
|
|
119
|
+
* In order to load TypeScript files in ESM we need to apply the ts-node loader.
|
|
120
|
+
* Let's have WebdriverIO set it automatically if the user doesn't.
|
|
121
|
+
*/
|
|
122
|
+
const nodePath = process.argv[0];
|
|
123
|
+
let NODE_OPTIONS = process.env.NODE_OPTIONS || '';
|
|
124
|
+
const runsWithLoader = (Boolean(process.argv.find((arg) => arg.startsWith('--loader')) &&
|
|
125
|
+
process.argv.find((arg) => arg.endsWith('ts-node/esm'))) ||
|
|
126
|
+
NODE_OPTIONS?.includes('ts-node/esm'));
|
|
127
|
+
if (wdioConfPath.endsWith('.ts') && !runsWithLoader && nodePath) {
|
|
128
|
+
NODE_OPTIONS += ' --loader ts-node/esm/transpile-only --no-warnings';
|
|
129
|
+
const tsProcess = cp.spawn(nodePath, process.argv.slice(1), {
|
|
130
|
+
cwd: process.cwd(),
|
|
131
|
+
detached: true,
|
|
132
|
+
stdio: 'inherit',
|
|
133
|
+
env: {
|
|
134
|
+
...process.env,
|
|
135
|
+
NODE_OPTIONS
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* ensure process is killed according to result of new process
|
|
140
|
+
*/
|
|
141
|
+
tsProcess.on('close', (code) => process.exit(code || 0));
|
|
142
|
+
return tsProcess;
|
|
143
|
+
}
|
|
144
|
+
const launcher = new Launcher(wdioConfPath, params);
|
|
126
145
|
return launcher.run()
|
|
127
146
|
.then((...args) => {
|
|
128
147
|
/* istanbul ignore if */
|
|
129
|
-
if (!process.env.
|
|
148
|
+
if (!process.env.VITEST_WORKER_ID) {
|
|
130
149
|
process.exit(...args);
|
|
131
150
|
}
|
|
132
151
|
})
|
|
133
152
|
.catch(err => {
|
|
134
153
|
console.error(err);
|
|
135
154
|
/* istanbul ignore if */
|
|
136
|
-
if (!process.env.
|
|
155
|
+
if (!process.env.VITEST_WORKER_ID) {
|
|
137
156
|
process.exit(1);
|
|
138
157
|
}
|
|
139
158
|
});
|
|
140
159
|
}
|
|
141
|
-
|
|
142
|
-
async function handler(argv) {
|
|
160
|
+
export async function handler(argv) {
|
|
143
161
|
const { configPath, ...params } = argv;
|
|
144
|
-
|
|
145
|
-
|
|
162
|
+
const canAccessConfigPath = await fs.access(configPath).then(() => true, () => false);
|
|
163
|
+
if (!canAccessConfigPath) {
|
|
164
|
+
const configFullPath = path.join(process.cwd(), configPath);
|
|
165
|
+
await missingConfigurationPrompt('run', configFullPath);
|
|
146
166
|
}
|
|
147
|
-
const localConf =
|
|
148
|
-
const wdioConf = configPath || (
|
|
167
|
+
const localConf = path.join(process.cwd(), 'wdio.conf.js');
|
|
168
|
+
const wdioConf = configPath || ((await fs.access(localConf).then(() => true, () => false))
|
|
169
|
+
? localConf
|
|
170
|
+
: undefined);
|
|
149
171
|
/**
|
|
150
172
|
* if `--watch` param is set, run launcher in watch mode
|
|
151
173
|
*/
|
|
152
174
|
if (params.watch) {
|
|
153
|
-
const watcher = new
|
|
175
|
+
const watcher = new Watcher(wdioConf, params);
|
|
154
176
|
return watcher.watch();
|
|
155
177
|
}
|
|
156
178
|
/**
|
|
@@ -169,4 +191,3 @@ async function handler(argv) {
|
|
|
169
191
|
*/
|
|
170
192
|
launchWithStdin(wdioConf, params);
|
|
171
193
|
}
|
|
172
|
-
exports.handler = handler;
|
package/build/constants.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Questionnair } from './types';
|
|
1
|
+
import type { Questionnair } from './types';
|
|
2
|
+
export declare const pkg: any;
|
|
2
3
|
export declare const CLI_EPILOGUE: string;
|
|
3
4
|
export declare const EXCLUSIVE_SERVICES: {
|
|
4
5
|
'wdio-chromedriver-service': {
|
|
@@ -216,8 +217,15 @@ export declare const SUPPORTED_PACKAGES: {
|
|
|
216
217
|
}, {
|
|
217
218
|
readonly name: "azure-devops";
|
|
218
219
|
readonly value: "@gmangiapelo/wdio-azure-devops-service$--$azure-devops";
|
|
220
|
+
}, {
|
|
221
|
+
readonly name: "google-Chat";
|
|
222
|
+
readonly value: "wdio-google-chat-service";
|
|
223
|
+
}, {
|
|
224
|
+
readonly name: "qmate-service";
|
|
225
|
+
readonly value: "@sap_oss/wdio-qmate-service--$qmate-service";
|
|
219
226
|
}];
|
|
220
227
|
};
|
|
228
|
+
export declare const COMMUNITY_PACKAGES_WITH_V8_SUPPORT: string[];
|
|
221
229
|
export declare const BACKEND_CHOICES: readonly ["On my local machine", "In the cloud using Experitest", "In the cloud using Sauce Labs", "In the cloud using Browserstack or Testingbot or LambdaTest or a different service", "I have my own Selenium cloud"];
|
|
222
230
|
export declare const PROTOCOL_OPTIONS: readonly ["https", "http"];
|
|
223
231
|
export declare const REGION_OPTION: readonly ["us", "eu", "apac"];
|
|
@@ -517,8 +525,14 @@ export declare const QUESTIONNAIRE: ({
|
|
|
517
525
|
}, {
|
|
518
526
|
readonly name: "azure-devops";
|
|
519
527
|
readonly value: "@gmangiapelo/wdio-azure-devops-service$--$azure-devops";
|
|
528
|
+
}, {
|
|
529
|
+
readonly name: "google-Chat";
|
|
530
|
+
readonly value: "wdio-google-chat-service";
|
|
531
|
+
}, {
|
|
532
|
+
readonly name: "qmate-service";
|
|
533
|
+
readonly value: "@sap_oss/wdio-qmate-service--$qmate-service";
|
|
520
534
|
}];
|
|
521
|
-
default: ("wdio-chromedriver-service$--$chromedriver" | "wdio-geckodriver-service$--$geckodriver" | "wdio-edgedriver-service$--$edgedriver" | "@wdio/sauce-service$--$sauce" | "@wdio/testingbot-service$--$testingbot" | "@wdio/selenium-standalone-service$--$selenium-standalone" | "wdio-vscode-service$--$vscode" | "wdio-electron-service$--$electron" | "@wdio/devtools-service$--$devtools" | "@wdio/browserstack-service$--$browserstack" | "@wdio/appium-service$--$appium" | "@wdio/firefox-profile-service$--$firefox-profile" | "@wdio/crossbrowsertesting-service$--$crossbrowsertesting" | "wdio-eslinter-service$--$eslinter" | "wdio-lambdatest-service$--$lambdatest" | "wdio-zafira-listener-service$--$zafira-listener" | "wdio-reportportal-service$--$reportportal" | "wdio-docker-service$--$docker" | "wdio-ui5-service$--$ui5" | "wdio-wiremock-service$--$wiremock" | "wdio-ng-apimock-service$--ng-apimock" | "wdio-slack-service$--$slack" | "wdio-cucumber-viewport-logger-service$--$cucumber-viewport-logger" | "wdio-intercept-service$--$intercept" | "wdio-image-comparison-service$--$image-comparison" | "wdio-novus-visual-regression-service$--$novus-visual-regression" | "wdio-rerun-service$--$rerun" | "wdio-winappdriver-service$--$winappdriver" | "wdio-ywinappdriver-service$--$ywinappdriver" | "wdio-performancetotal-service$--$performancetotal" | "wdio-cleanuptotal-service$--$cleanuptotal" | "wdio-aws-device-farm-service$--$aws-device-farm" | "wdio-ocr-service$--$ocr-native-apps" | "wdio-ms-teams-service$--$ms-teams" | "wdio-tesults-service$--$tesults" | "@gmangiapelo/wdio-azure-devops-service$--$azure-devops")[];
|
|
535
|
+
default: ("wdio-chromedriver-service$--$chromedriver" | "wdio-geckodriver-service$--$geckodriver" | "wdio-edgedriver-service$--$edgedriver" | "@wdio/sauce-service$--$sauce" | "@wdio/testingbot-service$--$testingbot" | "@wdio/selenium-standalone-service$--$selenium-standalone" | "wdio-vscode-service$--$vscode" | "wdio-electron-service$--$electron" | "@wdio/devtools-service$--$devtools" | "@wdio/browserstack-service$--$browserstack" | "@wdio/appium-service$--$appium" | "@wdio/firefox-profile-service$--$firefox-profile" | "@wdio/crossbrowsertesting-service$--$crossbrowsertesting" | "wdio-eslinter-service$--$eslinter" | "wdio-lambdatest-service$--$lambdatest" | "wdio-zafira-listener-service$--$zafira-listener" | "wdio-reportportal-service$--$reportportal" | "wdio-docker-service$--$docker" | "wdio-ui5-service$--$ui5" | "wdio-wiremock-service$--$wiremock" | "wdio-ng-apimock-service$--ng-apimock" | "wdio-slack-service$--$slack" | "wdio-cucumber-viewport-logger-service$--$cucumber-viewport-logger" | "wdio-intercept-service$--$intercept" | "wdio-image-comparison-service$--$image-comparison" | "wdio-novus-visual-regression-service$--$novus-visual-regression" | "wdio-rerun-service$--$rerun" | "wdio-winappdriver-service$--$winappdriver" | "wdio-ywinappdriver-service$--$ywinappdriver" | "wdio-performancetotal-service$--$performancetotal" | "wdio-cleanuptotal-service$--$cleanuptotal" | "wdio-aws-device-farm-service$--$aws-device-farm" | "wdio-ocr-service$--$ocr-native-apps" | "wdio-ms-teams-service$--$ms-teams" | "wdio-tesults-service$--$tesults" | "@gmangiapelo/wdio-azure-devops-service$--$azure-devops" | "wdio-google-chat-service" | "@sap_oss/wdio-qmate-service--$qmate-service")[];
|
|
522
536
|
validate: (answers: string[]) => string | Boolean;
|
|
523
537
|
when?: undefined;
|
|
524
538
|
} | {
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C,eAAO,MAAM,GAAG,KAA6B,CAAA;AAE7C,eAAO,MAAM,YAAY,QAAqE,CAAA;AAE9F,eAAO,MAAM,kBAAkB;;;;;CAK9B,CAAA;AAED,eAAO,MAAM,mBAAmB,wFAI/B,CAAA;AAED,eAAO,MAAM,6BAA6B,iHAIzC,CAAA;AAED,eAAO,MAAM,iCAAiC,8CAG7C,CAAA;AAED,eAAO,MAAM,WAAW,KAAK,CAAA;AAE7B,eAAO,MAAM,cAAc;;;;CAI1B,CAAA;AA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-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
exports.EXCLUSIVE_SERVICES = {
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { validateServiceAnswers, hasFile, getDefaultFiles } from './utils.js';
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
export const pkg = require('../package.json');
|
|
5
|
+
export const CLI_EPILOGUE = `Documentation: https://webdriver.io\n@wdio/cli (v${pkg.version})`;
|
|
6
|
+
export const EXCLUSIVE_SERVICES = {
|
|
8
7
|
'wdio-chromedriver-service': {
|
|
9
8
|
services: ['@wdio/selenium-standalone-service'],
|
|
10
9
|
message: '@wdio/selenium-standalone-service already includes chromedriver'
|
|
11
10
|
}
|
|
12
11
|
};
|
|
13
|
-
|
|
12
|
+
export const CONFIG_HELPER_INTRO = `
|
|
14
13
|
=========================
|
|
15
14
|
WDIO Configuration Helper
|
|
16
15
|
=========================
|
|
17
16
|
`;
|
|
18
|
-
|
|
17
|
+
export const CONFIG_HELPER_SUCCESS_MESSAGE = `
|
|
19
18
|
Configuration file was created successfully!
|
|
20
19
|
To run your tests, execute:
|
|
21
20
|
$ npx wdio run %swdio.conf.%s
|
|
22
21
|
`;
|
|
23
|
-
|
|
22
|
+
export const DEPENDENCIES_INSTALLATION_MESSAGE = `
|
|
24
23
|
To install dependencies, execute:
|
|
25
24
|
%s
|
|
26
25
|
`;
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
export const NPM_INSTALL = '';
|
|
27
|
+
export const ANDROID_CONFIG = {
|
|
29
28
|
platformName: 'Android',
|
|
30
29
|
automationName: 'UiAutomator2',
|
|
31
30
|
deviceName: 'Test'
|
|
32
31
|
};
|
|
33
|
-
|
|
32
|
+
export const IOS_CONFIG = {
|
|
34
33
|
platformName: 'iOS',
|
|
35
34
|
automationName: 'XCUITest',
|
|
36
35
|
deviceName: 'iPhone Simulator'
|
|
37
36
|
};
|
|
38
|
-
|
|
37
|
+
export const COMPILER_OPTION_ANSWERS = [
|
|
39
38
|
'Babel (https://babeljs.io/)',
|
|
40
39
|
'TypeScript (https://www.typescriptlang.org/)',
|
|
41
40
|
'No!'
|
|
42
41
|
];
|
|
43
|
-
|
|
44
|
-
babel:
|
|
45
|
-
ts:
|
|
46
|
-
nil:
|
|
42
|
+
export const COMPILER_OPTIONS = {
|
|
43
|
+
babel: COMPILER_OPTION_ANSWERS[0],
|
|
44
|
+
ts: COMPILER_OPTION_ANSWERS[1],
|
|
45
|
+
nil: COMPILER_OPTION_ANSWERS[2]
|
|
47
46
|
};
|
|
48
|
-
|
|
47
|
+
export const TS_COMPILER_INSTRUCTIONS = `To have TypeScript support please add the following packages to your "types" list:
|
|
49
48
|
{
|
|
50
49
|
"compilerOptions": {
|
|
51
50
|
"types": ["node", %s]
|
|
@@ -58,7 +57,7 @@ For for information on TypeScript integration check out: https://webdriver.io/do
|
|
|
58
57
|
* We have to use a string hash for value because InquirerJS default values do not work if we have
|
|
59
58
|
* objects as a `value` to be stored from the user's answers.
|
|
60
59
|
*/
|
|
61
|
-
|
|
60
|
+
export const SUPPORTED_PACKAGES = {
|
|
62
61
|
runner: [
|
|
63
62
|
{ name: 'local', value: '@wdio/local-runner$--$local' }
|
|
64
63
|
],
|
|
@@ -132,37 +131,43 @@ exports.SUPPORTED_PACKAGES = {
|
|
|
132
131
|
{ name: 'ocr-native-apps', value: 'wdio-ocr-service$--$ocr-native-apps' },
|
|
133
132
|
{ name: 'ms-teams', value: 'wdio-ms-teams-service$--$ms-teams' },
|
|
134
133
|
{ name: 'tesults', value: 'wdio-tesults-service$--$tesults' },
|
|
135
|
-
{ name: 'azure-devops', value: '@gmangiapelo/wdio-azure-devops-service$--$azure-devops' }
|
|
134
|
+
{ name: 'azure-devops', value: '@gmangiapelo/wdio-azure-devops-service$--$azure-devops' },
|
|
135
|
+
{ name: 'google-Chat', value: 'wdio-google-chat-service' },
|
|
136
|
+
{ name: 'qmate-service', value: '@sap_oss/wdio-qmate-service--$qmate-service' }
|
|
136
137
|
]
|
|
137
138
|
};
|
|
138
|
-
|
|
139
|
+
export const COMMUNITY_PACKAGES_WITH_V8_SUPPORT = [
|
|
140
|
+
'wdio-chromedriver-service',
|
|
141
|
+
'expect-webdriverio'
|
|
142
|
+
];
|
|
143
|
+
export const BACKEND_CHOICES = [
|
|
139
144
|
'On my local machine',
|
|
140
145
|
'In the cloud using Experitest',
|
|
141
146
|
'In the cloud using Sauce Labs',
|
|
142
147
|
'In the cloud using Browserstack or Testingbot or LambdaTest or a different service',
|
|
143
148
|
'I have my own Selenium cloud'
|
|
144
149
|
];
|
|
145
|
-
|
|
150
|
+
export const PROTOCOL_OPTIONS = [
|
|
146
151
|
'https',
|
|
147
152
|
'http'
|
|
148
153
|
];
|
|
149
|
-
|
|
154
|
+
export const REGION_OPTION = [
|
|
150
155
|
'us',
|
|
151
156
|
'eu',
|
|
152
157
|
'apac'
|
|
153
158
|
];
|
|
154
|
-
|
|
159
|
+
export const QUESTIONNAIRE = [{
|
|
155
160
|
type: 'list',
|
|
156
161
|
name: 'runner',
|
|
157
162
|
message: 'Where should your tests be launched?',
|
|
158
|
-
choices:
|
|
163
|
+
choices: SUPPORTED_PACKAGES.runner,
|
|
159
164
|
// only ask if there are more than 1 runner to pick from
|
|
160
|
-
when: /* istanbul ignore next */ () =>
|
|
165
|
+
when: /* istanbul ignore next */ () => SUPPORTED_PACKAGES.runner.length > 1
|
|
161
166
|
}, {
|
|
162
167
|
type: 'list',
|
|
163
168
|
name: 'backend',
|
|
164
169
|
message: 'Where is your automation backend located?',
|
|
165
|
-
choices:
|
|
170
|
+
choices: BACKEND_CHOICES
|
|
166
171
|
}, {
|
|
167
172
|
type: 'input',
|
|
168
173
|
name: 'hostname',
|
|
@@ -197,7 +202,7 @@ exports.QUESTIONNAIRE = [{
|
|
|
197
202
|
name: 'expEnvProtocol',
|
|
198
203
|
message: 'Choose a protocol for environment variable',
|
|
199
204
|
default: 'https',
|
|
200
|
-
choices:
|
|
205
|
+
choices: PROTOCOL_OPTIONS,
|
|
201
206
|
when: /* istanbul ignore next */ (answers) => {
|
|
202
207
|
return answers.backend === 'In the cloud using Experitest' && answers.expEnvPort !== '80' && answers.expEnvPort !== '443';
|
|
203
208
|
}
|
|
@@ -219,7 +224,7 @@ exports.QUESTIONNAIRE = [{
|
|
|
219
224
|
type: 'input',
|
|
220
225
|
name: 'env_user',
|
|
221
226
|
message: 'Environment variable for username',
|
|
222
|
-
default: '
|
|
227
|
+
default: 'BROWSERSTACK_USERNAME',
|
|
223
228
|
when: /* istanbul ignore next */ (answers) => answers.backend.toString().startsWith('In the cloud using Browserstack')
|
|
224
229
|
}, {
|
|
225
230
|
type: 'input',
|
|
@@ -249,7 +254,7 @@ exports.QUESTIONNAIRE = [{
|
|
|
249
254
|
type: 'list',
|
|
250
255
|
name: 'region',
|
|
251
256
|
message: 'In which region do you want to run your Sauce Labs tests in?',
|
|
252
|
-
choices:
|
|
257
|
+
choices: REGION_OPTION,
|
|
253
258
|
when: /* istanbul ignore next */ (answers) => !answers.headless && answers.backend === 'In the cloud using Sauce Labs'
|
|
254
259
|
}, {
|
|
255
260
|
type: 'input',
|
|
@@ -273,22 +278,22 @@ exports.QUESTIONNAIRE = [{
|
|
|
273
278
|
type: 'list',
|
|
274
279
|
name: 'framework',
|
|
275
280
|
message: 'Which framework do you want to use?',
|
|
276
|
-
choices:
|
|
281
|
+
choices: SUPPORTED_PACKAGES.framework,
|
|
277
282
|
}, {
|
|
278
283
|
type: 'list',
|
|
279
284
|
name: 'isUsingCompiler',
|
|
280
285
|
message: 'Do you want to use a compiler?',
|
|
281
|
-
choices:
|
|
282
|
-
default: /* istanbul ignore next */ () =>
|
|
283
|
-
?
|
|
284
|
-
:
|
|
285
|
-
?
|
|
286
|
-
:
|
|
286
|
+
choices: COMPILER_OPTION_ANSWERS,
|
|
287
|
+
default: /* istanbul ignore next */ () => hasFile('babel.config.js')
|
|
288
|
+
? COMPILER_OPTIONS.babel // default to Babel
|
|
289
|
+
: hasFile('tsconfig.json')
|
|
290
|
+
? COMPILER_OPTIONS.ts // default to TypeScript
|
|
291
|
+
: COMPILER_OPTIONS.nil // default to no compiler
|
|
287
292
|
}, {
|
|
288
293
|
type: 'input',
|
|
289
294
|
name: 'specs',
|
|
290
295
|
message: 'Where are your test specs located?',
|
|
291
|
-
default: (answers) =>
|
|
296
|
+
default: (answers) => getDefaultFiles(answers, './test/specs/**/*'),
|
|
292
297
|
when: /* istanbul ignore next */ (answers) => answers.framework.match(/(mocha|jasmine)/)
|
|
293
298
|
}, {
|
|
294
299
|
type: 'input',
|
|
@@ -300,7 +305,7 @@ exports.QUESTIONNAIRE = [{
|
|
|
300
305
|
type: 'input',
|
|
301
306
|
name: 'stepDefinitions',
|
|
302
307
|
message: 'Where are your step definitions located?',
|
|
303
|
-
default: (answers) =>
|
|
308
|
+
default: (answers) => getDefaultFiles(answers, './features/step-definitions/steps'),
|
|
304
309
|
when: /* istanbul ignore next */ (answers) => answers.framework.includes('cucumber')
|
|
305
310
|
}, {
|
|
306
311
|
type: 'confirm',
|
|
@@ -318,16 +323,16 @@ exports.QUESTIONNAIRE = [{
|
|
|
318
323
|
name: 'pages',
|
|
319
324
|
message: 'Where are your page objects located?',
|
|
320
325
|
default: /* istanbul ignore next */ (answers) => (answers.framework.match(/(mocha|jasmine)/)
|
|
321
|
-
?
|
|
322
|
-
:
|
|
326
|
+
? getDefaultFiles(answers, './test/pageobjects/**/*')
|
|
327
|
+
: getDefaultFiles(answers, './features/pageobjects/**/*')),
|
|
323
328
|
when: /* istanbul ignore next */ (answers) => answers.generateTestFiles && answers.usePageObjects
|
|
324
329
|
}, {
|
|
325
330
|
type: 'checkbox',
|
|
326
331
|
name: 'reporters',
|
|
327
332
|
message: 'Which reporter do you want to use?',
|
|
328
|
-
choices:
|
|
333
|
+
choices: SUPPORTED_PACKAGES.reporter,
|
|
329
334
|
// @ts-ignore
|
|
330
|
-
default: [
|
|
335
|
+
default: [SUPPORTED_PACKAGES.reporter.find(
|
|
331
336
|
/* istanbul ignore next */
|
|
332
337
|
({ name }) => name === 'spec').value
|
|
333
338
|
]
|
|
@@ -335,19 +340,19 @@ exports.QUESTIONNAIRE = [{
|
|
|
335
340
|
type: 'checkbox',
|
|
336
341
|
name: 'plugins',
|
|
337
342
|
message: 'Do you want to add a plugin to your test setup?',
|
|
338
|
-
choices:
|
|
343
|
+
choices: SUPPORTED_PACKAGES.plugin,
|
|
339
344
|
default: []
|
|
340
345
|
}, {
|
|
341
346
|
type: 'checkbox',
|
|
342
347
|
name: 'services',
|
|
343
348
|
message: 'Do you want to add a service to your test setup?',
|
|
344
|
-
choices:
|
|
349
|
+
choices: SUPPORTED_PACKAGES.service,
|
|
345
350
|
// @ts-ignore
|
|
346
|
-
default: [
|
|
351
|
+
default: [SUPPORTED_PACKAGES.service.find(
|
|
347
352
|
/* istanbul ignore next */
|
|
348
353
|
({ name }) => name === 'chromedriver').value
|
|
349
354
|
],
|
|
350
|
-
validate: /* istanbul ignore next */ (answers) =>
|
|
355
|
+
validate: /* istanbul ignore next */ (answers) => validateServiceAnswers(answers)
|
|
351
356
|
}, {
|
|
352
357
|
type: 'input',
|
|
353
358
|
name: 'outputDir',
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import Launcher from './launcher.js';
|
|
3
|
+
export declare const run: () => Promise<void | import("child_process").ChildProcess>;
|
|
3
4
|
export default Launcher;
|
|
4
|
-
export * from './types';
|
|
5
|
+
export * from './types.js';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAO,QAAQ,MAAM,eAAe,CAAA;AAqBpC,eAAO,MAAM,GAAG,4DA0Df,CAAA;AAED,eAAe,QAAQ,CAAA;AACvB,cAAc,YAAY,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.run = void 0;
|
|
21
|
-
const fs_1 = __importDefault(require("fs"));
|
|
22
|
-
const path_1 = __importDefault(require("path"));
|
|
23
|
-
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
24
|
-
const helpers_1 = require("yargs/helpers");
|
|
25
|
-
const launcher_1 = __importDefault(require("./launcher"));
|
|
26
|
-
const run_1 = require("./commands/run");
|
|
27
|
-
const constants_1 = require("./constants");
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import url from 'node:url';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import yargs from 'yargs';
|
|
5
|
+
import { hideBin } from 'yargs/helpers';
|
|
6
|
+
import Launcher from './launcher.js';
|
|
7
|
+
import { commands } from './commands/index.js';
|
|
8
|
+
import { handler, cmdArgs } from './commands/run.js';
|
|
9
|
+
import { CLI_EPILOGUE } from './constants.js';
|
|
10
|
+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
28
11
|
const DEFAULT_CONFIG_FILENAME = 'wdio.conf.js';
|
|
29
12
|
const DESCRIPTION = [
|
|
30
13
|
'The `wdio` command allows you run and manage your WebdriverIO test suite.',
|
|
@@ -37,9 +20,10 @@ const DESCRIPTION = [
|
|
|
37
20
|
'',
|
|
38
21
|
'For more information, visit: https://webdriver.io/docs/clioptions'
|
|
39
22
|
];
|
|
40
|
-
const run = async () => {
|
|
41
|
-
const
|
|
42
|
-
|
|
23
|
+
export const run = async () => {
|
|
24
|
+
const commandDir = path.join(__dirname, 'commands');
|
|
25
|
+
const argv = yargs(hideBin(process.argv))
|
|
26
|
+
.command(commands)
|
|
43
27
|
.example('wdio run wdio.conf.js --suite foobar', 'Run suite on testsuite "foobar"')
|
|
44
28
|
.example('wdio run wdio.conf.js --spec ./tests/e2e/a.js --spec ./tests/e2e/b.js', 'Run suite on specific specs')
|
|
45
29
|
.example('wdio run wdio.conf.js --spec ./tests/e2e/a.feature:5', 'Run scenario by line number')
|
|
@@ -48,14 +32,14 @@ const run = async () => {
|
|
|
48
32
|
.example('wdio install reporter spec', 'Install @wdio/spec-reporter')
|
|
49
33
|
.example('wdio repl chrome -u <SAUCE_USERNAME> -k <SAUCE_ACCESS_KEY>', 'Run repl in Sauce Labs cloud')
|
|
50
34
|
.updateStrings({ 'Commands:': `${DESCRIPTION.join('\n')}\n\nCommands:` })
|
|
51
|
-
.epilogue(
|
|
35
|
+
.epilogue(CLI_EPILOGUE);
|
|
52
36
|
/**
|
|
53
37
|
* parse CLI arguments according to what run expects, without this adding
|
|
54
38
|
* `--spec ./test.js` results in propagating the spec parameter as a
|
|
55
39
|
* string while in reality is should be parsed into a array of strings
|
|
56
40
|
*/
|
|
57
41
|
if (!process.argv.find((arg) => arg === '--help')) {
|
|
58
|
-
argv.options(
|
|
42
|
+
argv.options(cmdArgs);
|
|
59
43
|
}
|
|
60
44
|
/**
|
|
61
45
|
* The only way we reach this point is if the user runs the binary without a command (i.e. wdio wdio.conf.js)
|
|
@@ -66,24 +50,23 @@ const run = async () => {
|
|
|
66
50
|
* we don't have to check that again here.
|
|
67
51
|
*/
|
|
68
52
|
const params = await argv.parse();
|
|
69
|
-
const supportedCommands =
|
|
70
|
-
.readdirSync(
|
|
53
|
+
const supportedCommands = fs
|
|
54
|
+
.readdirSync(commandDir)
|
|
71
55
|
.map((file) => file.slice(0, -3));
|
|
72
56
|
if (params._ && !params._.find((param) => supportedCommands.includes(param))) {
|
|
73
57
|
const args = {
|
|
74
58
|
...params,
|
|
75
|
-
configPath:
|
|
59
|
+
configPath: path.resolve(process.cwd(), params._[0] && params._[0].toString() || DEFAULT_CONFIG_FILENAME)
|
|
76
60
|
};
|
|
77
|
-
return
|
|
78
|
-
const output = await new Promise((resolve) => ((
|
|
61
|
+
return handler(args).catch(async (err) => {
|
|
62
|
+
const output = await new Promise((resolve) => (yargs(hideBin(process.argv)).parse('--help', (err, argv, output) => resolve(output))));
|
|
79
63
|
console.error(`${output}\n\n${err.stack}`);
|
|
80
64
|
/* istanbul ignore if */
|
|
81
|
-
if (!process.env.
|
|
65
|
+
if (!process.env.VITEST_WORKER_ID) {
|
|
82
66
|
process.exit(1);
|
|
83
67
|
}
|
|
84
68
|
});
|
|
85
69
|
}
|
|
86
70
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
__exportStar(require("./types"), exports);
|
|
71
|
+
export default Launcher;
|
|
72
|
+
export * from './types.js';
|
package/build/interface.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from 'events';
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
3
|
import type { Options, Workers } from '@wdio/types';
|
|
4
|
-
import { HookError } from './utils';
|
|
4
|
+
import { HookError } from './utils.js';
|
|
5
5
|
interface TestError {
|
|
6
6
|
type: string;
|
|
7
7
|
message: string;
|
|
@@ -67,7 +67,7 @@ export default class WDIOCLInterface extends EventEmitter {
|
|
|
67
67
|
/**
|
|
68
68
|
* event handler that is triggered when runner sends up events
|
|
69
69
|
*/
|
|
70
|
-
onMessage(event: CLIInterfaceEvent): boolean |
|
|
70
|
+
onMessage(event: CLIInterfaceEvent): boolean | any[] | undefined;
|
|
71
71
|
sigintTrigger(): false | any[];
|
|
72
72
|
printReporters(): void;
|
|
73
73
|
printSummary(): any[];
|
package/build/interface.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,KAAK,EAAE,OAAO,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAA;AAEjE,OAAO,EAAiB,SAAS,EAAE,MAAM,YAAY,CAAA;AAKrD,UAAU,SAAS;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,UAAU,iBAAiB;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,KAAK,CAAC,EAAE,SAAS,CAAA;CACpB;AAED,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,YAAY;IAyBjD,OAAO,CAAC,OAAO;IACR,cAAc,EAAE,MAAM;IAC7B,OAAO,CAAC,YAAY;IA1BjB,cAAc,EAAE,OAAO,CAAA;IACvB,MAAM;;;;;MAKZ;IAED,OAAO,CAAC,KAAK,CAAsC;IACnD,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,qBAAqB,CAAQ;IAErC,OAAO,CAAC,aAAa,CAAI;IACzB,OAAO,CAAC,YAAY,CA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