@wdio/cli 8.5.6 → 8.5.7
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/build/commands/config.d.ts +16 -2
- package/build/commands/config.d.ts.map +1 -1
- package/build/commands/config.js +29 -11
- package/build/commands/install.d.ts.map +1 -1
- package/build/commands/install.js +8 -10
- package/build/commands/run.d.ts.map +1 -1
- package/build/commands/run.js +16 -15
- package/build/templates/exampleFiles/cucumber/step_definitions/steps.js.ejs +2 -2
- package/build/templates/exampleFiles/jasmine/example.e2e.js.ejs +2 -2
- package/build/templates/exampleFiles/mocha/example.e2e.js.ejs +2 -2
- package/build/templates/exampleFiles/pageobjects/login.page.js.ejs +1 -1
- package/build/templates/exampleFiles/pageobjects/secure.page.js.ejs +1 -1
- package/build/templates/wdio.conf.tpl.ejs +3 -1
- package/build/types.d.ts +1 -1
- package/build/types.d.ts.map +1 -1
- package/build/utils.d.ts +1 -1
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +43 -34
- package/package.json +5 -5
|
@@ -47,12 +47,26 @@ export declare function handler(argv: ConfigCommandArguments, runConfigCmd?: typ
|
|
|
47
47
|
parsedAnswers: ParsedAnswers;
|
|
48
48
|
installedPackages: string[];
|
|
49
49
|
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Helper utility used in `run` and `install` command to format a provided config path,
|
|
52
|
+
* giving it back as an absolute path, and a version without the file extension
|
|
53
|
+
* @param config the initially given file path to the WDIO config file
|
|
54
|
+
*/
|
|
55
|
+
export declare function formatConfigFilePaths(config: string): Promise<{
|
|
56
|
+
fullPath: string;
|
|
57
|
+
fullPathNoExtension: string;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Helper utility used in `run` and `install` command to check whether a config file currently exists
|
|
61
|
+
* @param configPath the file path to the WDIO config file
|
|
62
|
+
*/
|
|
63
|
+
export declare function canAccessConfigPath(configPath: string): Promise<boolean>;
|
|
50
64
|
/**
|
|
51
65
|
* Helper utility used in `run` and `install` command to create config if none exist
|
|
52
66
|
* @param {string} command to be executed by user
|
|
53
|
-
* @param {string}
|
|
67
|
+
* @param {string} configPath the path to a wdio.conf.[js/ts] file
|
|
54
68
|
* @param {boolean} useYarn parameter set to true if yarn is used
|
|
55
69
|
* @param {Function} runConfigCmd runConfig method to be replaceable for unit testing
|
|
56
70
|
*/
|
|
57
|
-
export declare function missingConfigurationPrompt(command: string,
|
|
71
|
+
export declare function missingConfigurationPrompt(command: string, configPath: string, useYarn?: boolean, runConfigCmd?: typeof runConfigCommand): Promise<false | undefined>;
|
|
58
72
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAQjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAIxE,eAAO,MAAM,OAAO,WAAW,CAAA;AAC/B,eAAO,MAAM,IAAI,4EAA4E,CAAA;AAE7F,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;CAkBV,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI;;;;;;;;;;;;;;;;;;GAKlC,CAAA;AAED,eAAO,MAAM,YAAY,QAAwB,OAAO,KAAG,QAAQ,aAAa,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAQjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAIxE,eAAO,MAAM,OAAO,WAAW,CAAA;AAC/B,eAAO,MAAM,IAAI,4EAA4E,CAAA;AAE7F,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;CAkBV,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI;;;;;;;;;;;;;;;;;;GAKlC,CAAA;AAED,eAAO,MAAM,YAAY,QAAwB,OAAO,KAAG,QAAQ,aAAa,CAkF/E,CAAA;AAED,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAkBpG;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,sBAAsB,EAAE,YAAY,0BAAmB;;;;GAQ1F;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM;;;GAQzD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,oBAO3D;AAED;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,UAAQ,EAAE,YAAY,0BAAmB,8BA4BrI"}
|
package/build/commands/config.js
CHANGED
|
@@ -61,7 +61,7 @@ export const parseAnswers = async function (yes) {
|
|
|
61
61
|
*/
|
|
62
62
|
? path.resolve(projectRootDir, 'tsconfig.json')
|
|
63
63
|
/**
|
|
64
|
-
* otherwise make it
|
|
64
|
+
* otherwise make it dependent on whether the user wants to autogenerate files
|
|
65
65
|
*/
|
|
66
66
|
: answers.specs
|
|
67
67
|
/**
|
|
@@ -95,7 +95,7 @@ export const parseAnswers = async function (yes) {
|
|
|
95
95
|
packagesToInstall,
|
|
96
96
|
isUsingTypeScript,
|
|
97
97
|
isUsingBabel: answers.isUsingCompiler === COMPILER_OPTIONS.babel,
|
|
98
|
-
esmSupport: projectProps
|
|
98
|
+
esmSupport: projectProps && !(projectProps.esmSupported) ? false : true,
|
|
99
99
|
isSync: false,
|
|
100
100
|
_async: 'async ',
|
|
101
101
|
_await: 'await ',
|
|
@@ -103,6 +103,7 @@ export const parseAnswers = async function (yes) {
|
|
|
103
103
|
destSpecRootPath: parsedPaths.destSpecRootPath,
|
|
104
104
|
destPageObjectRootPath: parsedPaths.destPageObjectRootPath,
|
|
105
105
|
relativePath: parsedPaths.relativePath,
|
|
106
|
+
hasRootTSConfig,
|
|
106
107
|
tsConfigFilePath,
|
|
107
108
|
tsProject: `./${path.relative(projectRootDir, tsConfigFilePath).replaceAll(path.sep, '/')}`,
|
|
108
109
|
wdioConfigPath
|
|
@@ -130,21 +131,40 @@ export async function handler(argv, runConfigCmd = runConfigCommand) {
|
|
|
130
131
|
installedPackages: parsedAnswers.packagesToInstall.map((pkg) => pkg.split('--')[0])
|
|
131
132
|
};
|
|
132
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Helper utility used in `run` and `install` command to format a provided config path,
|
|
136
|
+
* giving it back as an absolute path, and a version without the file extension
|
|
137
|
+
* @param config the initially given file path to the WDIO config file
|
|
138
|
+
*/
|
|
139
|
+
export async function formatConfigFilePaths(config) {
|
|
140
|
+
const fullPath = config.includes(process.cwd())
|
|
141
|
+
? config
|
|
142
|
+
: path.join(process.cwd(), config);
|
|
143
|
+
const fullPathNoExtension = fullPath.substring(0, fullPath.lastIndexOf('.'));
|
|
144
|
+
return { fullPath, fullPathNoExtension };
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Helper utility used in `run` and `install` command to check whether a config file currently exists
|
|
148
|
+
* @param configPath the file path to the WDIO config file
|
|
149
|
+
*/
|
|
150
|
+
export async function canAccessConfigPath(configPath) {
|
|
151
|
+
return await fs.access(`${configPath}.js`).then(() => true, () => fs.access(`${configPath}.ts`).then(() => true, () => false));
|
|
152
|
+
}
|
|
133
153
|
/**
|
|
134
154
|
* Helper utility used in `run` and `install` command to create config if none exist
|
|
135
155
|
* @param {string} command to be executed by user
|
|
136
|
-
* @param {string}
|
|
156
|
+
* @param {string} configPath the path to a wdio.conf.[js/ts] file
|
|
137
157
|
* @param {boolean} useYarn parameter set to true if yarn is used
|
|
138
158
|
* @param {Function} runConfigCmd runConfig method to be replaceable for unit testing
|
|
139
159
|
*/
|
|
140
|
-
export async function missingConfigurationPrompt(command,
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
160
|
+
export async function missingConfigurationPrompt(command, configPath, useYarn = false, runConfigCmd = runConfigCommand) {
|
|
161
|
+
const message = (`Could not execute "${command}" due to missing configuration, file ` +
|
|
162
|
+
`"${path.parse(configPath).name}[.js/.ts]" not found! ` +
|
|
163
|
+
'Would you like to create one?');
|
|
144
164
|
const { config } = await inquirer.prompt([{
|
|
145
165
|
type: 'confirm',
|
|
146
166
|
name: 'config',
|
|
147
|
-
message:
|
|
167
|
+
message: message,
|
|
148
168
|
default: false
|
|
149
169
|
}]);
|
|
150
170
|
/**
|
|
@@ -152,9 +172,7 @@ export async function missingConfigurationPrompt(command, message, useYarn = fal
|
|
|
152
172
|
*/
|
|
153
173
|
if (!config) {
|
|
154
174
|
/* istanbul ignore next */
|
|
155
|
-
console.log(
|
|
156
|
-
? `No WebdriverIO configuration found in "${process.cwd()}"`
|
|
157
|
-
: message);
|
|
175
|
+
console.log(`No WebdriverIO configuration found in "${process.cwd()}"`);
|
|
158
176
|
/* istanbul ignore next */
|
|
159
177
|
return !process.env.VITEST_WORKER_ID && process.exit(0);
|
|
160
178
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAUjC,OAAO,KAAK,EAAE,uBAAuB,EAAoB,MAAM,aAAa,CAAA;AAU5E,eAAO,MAAM,OAAO,0BAA0B,CAAA;AAC9C,eAAO,MAAM,IAAI,QAIN,CAAA;AAEX,eAAO,MAAM,OAAO;;;;;;;;;;CAUV,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI,aAalC,CAAA;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAUjC,OAAO,KAAK,EAAE,uBAAuB,EAAoB,MAAM,aAAa,CAAA;AAU5E,eAAO,MAAM,OAAO,0BAA0B,CAAA;AAC9C,eAAO,MAAM,IAAI,QAIN,CAAA;AAEX,eAAO,MAAM,OAAO;;;;;;;;;;CAUV,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI,aAalC,CAAA;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,uBAAuB,iBAuE1D"}
|
|
@@ -3,7 +3,7 @@ import fs from 'node:fs/promises';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import yarnInstall from 'yarn-install';
|
|
5
5
|
import { replaceConfig, findInConfig, addServiceDeps, convertPackageHashToObject } from '../utils.js';
|
|
6
|
-
import { missingConfigurationPrompt } from './config.js';
|
|
6
|
+
import { formatConfigFilePaths, canAccessConfigPath, missingConfigurationPrompt } from './config.js';
|
|
7
7
|
import { SUPPORTED_PACKAGES, CLI_EPILOGUE } from '../constants.js';
|
|
8
8
|
const supportedInstallations = {
|
|
9
9
|
runner: SUPPORTED_PACKAGES.runner.map(({ value }) => convertPackageHashToObject(value)),
|
|
@@ -64,20 +64,18 @@ export async function handler(argv) {
|
|
|
64
64
|
process.exit(0);
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
if (!
|
|
67
|
+
const wdioConf = await formatConfigFilePaths(config);
|
|
68
|
+
const confAccess = await canAccessConfigPath(wdioConf.fullPathNoExtension);
|
|
69
|
+
if (!confAccess) {
|
|
70
70
|
try {
|
|
71
|
-
|
|
72
|
-
'You can create one by running \'wdio config\'');
|
|
73
|
-
await missingConfigurationPrompt('install', promptMessage, yarn);
|
|
71
|
+
await missingConfigurationPrompt('install', wdioConf.fullPathNoExtension, yarn);
|
|
74
72
|
}
|
|
75
73
|
catch {
|
|
76
74
|
process.exit(1);
|
|
77
75
|
return;
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
|
-
const configFile = await fs.readFile(
|
|
78
|
+
const configFile = await fs.readFile(wdioConf.fullPath, { encoding: 'utf-8' });
|
|
81
79
|
const match = findInConfig(configFile, type);
|
|
82
80
|
if (match && match[0].includes(name)) {
|
|
83
81
|
console.log(`The ${type} ${name} is already part of your configuration.`);
|
|
@@ -97,9 +95,9 @@ export async function handler(argv) {
|
|
|
97
95
|
console.log(`Package "${selectedPackage.package}" installed successfully.`);
|
|
98
96
|
const newConfig = replaceConfig(configFile, type, name);
|
|
99
97
|
if (!newConfig) {
|
|
100
|
-
throw new Error(`Couldn't find "${type}" property in ${path.basename(
|
|
98
|
+
throw new Error(`Couldn't find "${type}" property in ${path.basename(wdioConf.fullPath)}`);
|
|
101
99
|
}
|
|
102
|
-
await fs.writeFile(
|
|
100
|
+
await fs.writeFile(wdioConf.fullPath, newConfig, { encoding: 'utf-8' });
|
|
103
101
|
console.log('Your wdio.conf.js file has been updated.');
|
|
104
102
|
process.exit(0);
|
|
105
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAMjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEtD,eAAO,MAAM,OAAO,qBAAqB,CAAA;AAEzC,eAAO,MAAM,IAAI,yEAAyE,CAAA;AAE1F,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoFV,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUlC,CAAA;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,QAczF;AAED,wBAAsB,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,iBAgBtF;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAMjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEtD,eAAO,MAAM,OAAO,qBAAqB,CAAA;AAEzC,eAAO,MAAM,IAAI,yEAAyE,CAAA;AAE1F,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoFV,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUlC,CAAA;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,QAczF;AAED,wBAAsB,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,iBAgBtF;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,mBAAmB,yBAyEtD"}
|
package/build/commands/run.js
CHANGED
|
@@ -3,7 +3,7 @@ import fs from 'node:fs/promises';
|
|
|
3
3
|
import { execa } from 'execa';
|
|
4
4
|
import Launcher from '../launcher.js';
|
|
5
5
|
import Watcher from '../watcher.js';
|
|
6
|
-
import { missingConfigurationPrompt } from './config.js';
|
|
6
|
+
import { formatConfigFilePaths, canAccessConfigPath, missingConfigurationPrompt } from './config.js';
|
|
7
7
|
import { CLI_EPILOGUE } from '../constants.js';
|
|
8
8
|
export const command = 'run <configPath>';
|
|
9
9
|
export const desc = 'Run your WDIO configuration file to initialize your tests. (default)';
|
|
@@ -135,16 +135,17 @@ export async function launch(wdioConfPath, params) {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
export async function handler(argv) {
|
|
138
|
-
const { configPath, ...params } = argv;
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
138
|
+
const { configPath = 'wdio.conf.js', ...params } = argv;
|
|
139
|
+
const wdioConf = await formatConfigFilePaths(configPath);
|
|
140
|
+
const confAccess = await canAccessConfigPath(wdioConf.fullPathNoExtension);
|
|
141
|
+
if (!confAccess) {
|
|
142
|
+
try {
|
|
143
|
+
await missingConfigurationPrompt('run', wdioConf.fullPathNoExtension);
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
143
148
|
}
|
|
144
|
-
const localConf = path.join(process.cwd(), 'wdio.conf.js');
|
|
145
|
-
const wdioConf = configPath || ((await fs.access(localConf).then(() => true, () => false))
|
|
146
|
-
? localConf
|
|
147
|
-
: undefined);
|
|
148
149
|
/**
|
|
149
150
|
* In order to load TypeScript files in ESM we need to apply the ts-node loader.
|
|
150
151
|
* Let's have WebdriverIO set it automatically if the user doesn't.
|
|
@@ -154,11 +155,11 @@ export async function handler(argv) {
|
|
|
154
155
|
const runsWithLoader = (Boolean(process.argv.find((arg) => arg.startsWith('--loader')) &&
|
|
155
156
|
process.argv.find((arg) => arg.endsWith('ts-node/esm'))) ||
|
|
156
157
|
NODE_OPTIONS?.includes('ts-node/esm'));
|
|
157
|
-
if (wdioConf.endsWith('.ts') && !runsWithLoader && nodePath) {
|
|
158
|
+
if (wdioConf.fullPath.endsWith('.ts') && !runsWithLoader && nodePath) {
|
|
158
159
|
NODE_OPTIONS += ' --loader ts-node/esm/transpile-only --no-warnings';
|
|
159
160
|
const localTSConfigPath = ((params.autoCompileOpts?.tsNodeOpts?.project &&
|
|
160
161
|
path.resolve(process.cwd(), params.autoCompileOpts?.tsNodeOpts?.project)) ||
|
|
161
|
-
path.join(path.dirname(wdioConf), 'tsconfig.json'));
|
|
162
|
+
path.join(path.dirname(wdioConf.fullPath), 'tsconfig.json'));
|
|
162
163
|
const hasLocalTSConfig = await fs.access(localTSConfigPath).then(() => true, () => false);
|
|
163
164
|
const p = await execa(nodePath, process.argv.slice(1), {
|
|
164
165
|
reject: false,
|
|
@@ -176,7 +177,7 @@ export async function handler(argv) {
|
|
|
176
177
|
* if `--watch` param is set, run launcher in watch mode
|
|
177
178
|
*/
|
|
178
179
|
if (params.watch) {
|
|
179
|
-
const watcher = new Watcher(wdioConf, params);
|
|
180
|
+
const watcher = new Watcher(wdioConf.fullPath, params);
|
|
180
181
|
return watcher.watch();
|
|
181
182
|
}
|
|
182
183
|
/**
|
|
@@ -187,11 +188,11 @@ export async function handler(argv) {
|
|
|
187
188
|
* stdin.isTTY is false when command is from nodes spawn since it's treated as a pipe
|
|
188
189
|
*/
|
|
189
190
|
if (process.stdin.isTTY || !process.stdout.isTTY) {
|
|
190
|
-
return launch(wdioConf, params);
|
|
191
|
+
return launch(wdioConf.fullPath, params);
|
|
191
192
|
}
|
|
192
193
|
/*
|
|
193
194
|
* get a list of spec files to run from stdin, overriding any other
|
|
194
195
|
* configuration suite or specs.
|
|
195
196
|
*/
|
|
196
|
-
launchWithStdin(wdioConf, params);
|
|
197
|
+
launchWithStdin(wdioConf.fullPath, params);
|
|
197
198
|
}
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
if (usePageObjects) { %>
|
|
9
9
|
<%- isUsingTypeScript || esmSupport
|
|
10
|
-
? `import LoginPage from '${relativePath}/login.page${esmSupport ? '.js' : ''}';`
|
|
10
|
+
? `import LoginPage from '${relativePath}/login.page${esmSupport && isUsingTypeScript ? '.ts' : esmSupport ? '.js' : ''}';`
|
|
11
11
|
: `const LoginPage = require('${relativePath}/login.page');` %>
|
|
12
12
|
<%- isUsingTypeScript || esmSupport
|
|
13
|
-
? `import SecurePage from '${relativePath}/secure.page${esmSupport ? '.js' : ''}';`
|
|
13
|
+
? `import SecurePage from '${relativePath}/secure.page${esmSupport && isUsingTypeScript ? '.ts' : esmSupport ? '.js' : ''}';`
|
|
14
14
|
: `const SecurePage = require('${relativePath}/secure.page');` %>
|
|
15
15
|
|
|
16
16
|
const pages = {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
if (usePageObjects) {
|
|
6
6
|
%><%- isUsingTypeScript || esmSupport
|
|
7
|
-
? `import LoginPage from '${relativePath}/login.page${esmSupport ? '.js' : ''}';`
|
|
7
|
+
? `import LoginPage from '${relativePath}/login.page${esmSupport && isUsingTypeScript ? '.ts' : esmSupport ? '.js' : ''}';`
|
|
8
8
|
: `const LoginPage = require('${relativePath}/login.page');` %>
|
|
9
9
|
<%- isUsingTypeScript || esmSupport
|
|
10
|
-
? `import SecurePage from '${relativePath}/secure.page${esmSupport ? '.js' : ''}';`
|
|
10
|
+
? `import SecurePage from '${relativePath}/secure.page${esmSupport && isUsingTypeScript ? '.ts' : esmSupport ? '.js' : ''}';`
|
|
11
11
|
: `const SecurePage = require('${relativePath}/secure.page');` %>
|
|
12
12
|
|
|
13
13
|
describe('My Login application', () => {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
if (usePageObjects) {
|
|
6
6
|
%><%- isUsingTypeScript || esmSupport
|
|
7
|
-
? `import LoginPage from '${relativePath}/login.page${esmSupport ? '.js' : ''}'`
|
|
7
|
+
? `import LoginPage from '${relativePath}/login.page${esmSupport && isUsingTypeScript ? '.ts' : esmSupport ? '.js' : ''}'`
|
|
8
8
|
: `const LoginPage = require('${relativePath}/login.page')` %>
|
|
9
9
|
<%- isUsingTypeScript || esmSupport
|
|
10
|
-
? `import SecurePage from '${relativePath}/secure.page${esmSupport ? '.js' : ''}'`
|
|
10
|
+
? `import SecurePage from '${relativePath}/secure.page${esmSupport && isUsingTypeScript ? '.ts' : esmSupport ? '.js' : ''}'`
|
|
11
11
|
: `const SecurePage = require('${relativePath}/secure.page')` %>
|
|
12
12
|
|
|
13
13
|
describe('My Login application', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%- isUsingTypeScript ? "import { ChainablePromiseElement } from 'webdriverio';" : "" %>
|
|
2
2
|
|
|
3
3
|
<%- isUsingTypeScript || esmSupport
|
|
4
|
-
? `import Page from './page${esmSupport ? '.js' : ''}';`
|
|
4
|
+
? `import Page from './page${esmSupport && isUsingTypeScript ? '.ts' : esmSupport ? '.js' : ''}';`
|
|
5
5
|
: "const Page = require('./page');" %>
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%- isUsingTypeScript ? "import { ChainablePromiseElement } from 'webdriverio';" : "" %>
|
|
2
2
|
|
|
3
3
|
<%- isUsingTypeScript || esmSupport
|
|
4
|
-
? `import Page from './page${esmSupport ? '.js' : ''}';`
|
|
4
|
+
? `import Page from './page${esmSupport && isUsingTypeScript ? '.ts' : esmSupport ? '.js' : ''}';`
|
|
5
5
|
: "const Page = require('./page');" %>
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -27,8 +27,10 @@ export const config: Options.Testrunner = {<%
|
|
|
27
27
|
%>,<%
|
|
28
28
|
if (answers.isUsingTypeScript) { %>
|
|
29
29
|
autoCompileOpts: {
|
|
30
|
+
autoCompile: 'true',
|
|
30
31
|
tsNodeOpts: {
|
|
31
|
-
project: '<%- answers.tsProject %>'
|
|
32
|
+
project: '<%- answers.tsProject %>',
|
|
33
|
+
transpileOnly: 'true'
|
|
32
34
|
}
|
|
33
35
|
},
|
|
34
36
|
<% } %>
|
package/build/types.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ export interface Questionnair {
|
|
|
31
31
|
baseUrl: string;
|
|
32
32
|
npmInstall: boolean;
|
|
33
33
|
createPackageJSON?: boolean;
|
|
34
|
-
moduleSystem?: 'esm' | 'commonjs';
|
|
35
34
|
projectRootCorrect?: boolean;
|
|
36
35
|
projectRoot?: string;
|
|
37
36
|
}
|
|
@@ -53,6 +52,7 @@ export interface ParsedAnswers extends Omit<Questionnair, 'runner' | 'framework'
|
|
|
53
52
|
destSpecRootPath: string;
|
|
54
53
|
destPageObjectRootPath: string;
|
|
55
54
|
relativePath: string;
|
|
55
|
+
hasRootTSConfig: boolean;
|
|
56
56
|
tsConfigFilePath: string;
|
|
57
57
|
tsProject: string;
|
|
58
58
|
wdioConfigPath: string;
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAE7F,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAE5B,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,OAAO,EAAE,OAAO,CAAC,OAAO,eAAe,CAAC,CAAA;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,C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C;AAC3B,KAAK,iBAAiB,CAAC,CAAC,IAClB,YAAY,GACZ,CAAC,YAAY,EAAE,GAAG,CAAC,GACnB,cAAc,CAAC,CAAC,CAAC,CAAC;AACxB,KAAK,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7C,KAAK,cAAc,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;CACvD,CAAC;AACF,KAAK,OAAO,GAAG,OAAO,CAAC;AAEvB,MAAM,WAAW,YAAY;IACzB,YAAY,EAAE,OAAO,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,qBAAqB,CAAA;CACrC"}
|
package/build/utils.d.ts
CHANGED
|
@@ -121,7 +121,7 @@ export declare function runProgram(command: string, args: string[], options: Spa
|
|
|
121
121
|
/**
|
|
122
122
|
* create package.json if not already existing
|
|
123
123
|
*/
|
|
124
|
-
export declare function createPackageJSON(parsedAnswers: ParsedAnswers): Promise<
|
|
124
|
+
export declare function createPackageJSON(parsedAnswers: ParsedAnswers): Promise<false | undefined>;
|
|
125
125
|
/**
|
|
126
126
|
* run npm install only if required by the user
|
|
127
127
|
*/
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AActD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAGhD,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAMlE,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAA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aAAa,EAAE,aAAa,iBAyCjE;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,aAAa,EAAE,aAAa,iBA4C5D;AAED,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,aAAa,iBAgBlE;AAED,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,aAAa,oBAkBlE"}
|
package/build/utils.js
CHANGED
|
@@ -162,9 +162,11 @@ export function replaceConfig(config, type, name) {
|
|
|
162
162
|
}
|
|
163
163
|
export function addServiceDeps(names, packages, update = false) {
|
|
164
164
|
/**
|
|
165
|
-
*
|
|
165
|
+
* Automatically install latest Chromedriver if `wdio-chromedriver-service` was selected for install.
|
|
166
|
+
* Also, set `DETECT_CHROMEDRIVER_VERSION` flag to have package install the right driver version.
|
|
166
167
|
*/
|
|
167
168
|
if (names.some(({ short }) => short === 'chromedriver')) {
|
|
169
|
+
process.env.DETECT_CHROMEDRIVER_VERSION = '1';
|
|
168
170
|
packages.push('chromedriver');
|
|
169
171
|
}
|
|
170
172
|
/**
|
|
@@ -350,7 +352,8 @@ export async function getAnswers(yes) {
|
|
|
350
352
|
* set nothing if question doesn't apply
|
|
351
353
|
*/
|
|
352
354
|
? {}
|
|
353
|
-
: {
|
|
355
|
+
: {
|
|
356
|
+
[question.name]: typeof question.default !== 'undefined'
|
|
354
357
|
/**
|
|
355
358
|
* set default value if existing
|
|
356
359
|
*/
|
|
@@ -391,16 +394,6 @@ export async function getAnswers(yes) {
|
|
|
391
394
|
name: 'createPackageJSON',
|
|
392
395
|
default: true,
|
|
393
396
|
message: `Couldn't find a package.json in "${process.cwd()}" or any of the parent directories, do you want to create one?`,
|
|
394
|
-
}, {
|
|
395
|
-
type: 'list',
|
|
396
|
-
name: 'moduleSystem',
|
|
397
|
-
message: 'Which module system should be used?',
|
|
398
|
-
choices: [
|
|
399
|
-
{ name: 'esm', value: 'ESM (recommended)$--$esm' },
|
|
400
|
-
{ name: 'commonjs', value: 'CommonJS$--$commonjs' }
|
|
401
|
-
],
|
|
402
|
-
// only ask if there are more than 1 runner to pick from
|
|
403
|
-
when: /* istanbul ignore next */ (answers) => answers.createPackageJSON
|
|
404
397
|
}]
|
|
405
398
|
/**
|
|
406
399
|
* in case create-wdio was used which creates a package.json with name "my-new-project"
|
|
@@ -511,20 +504,34 @@ export function runProgram(command, args, options) {
|
|
|
511
504
|
* create package.json if not already existing
|
|
512
505
|
*/
|
|
513
506
|
export async function createPackageJSON(parsedAnswers) {
|
|
514
|
-
|
|
507
|
+
const packageJsonExists = await fs.access(path.resolve(process.cwd(), 'package.json')).then(() => true, () => false);
|
|
508
|
+
// Use the exisitng package.json if it already exists.
|
|
509
|
+
if (packageJsonExists) {
|
|
515
510
|
return;
|
|
516
511
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
512
|
+
// If a user said no to creating a package.json, but it doesn't exist, abort.
|
|
513
|
+
if (parsedAnswers.createPackageJSON === false) {
|
|
514
|
+
/* istanbul ignore if */
|
|
515
|
+
if (!packageJsonExists) {
|
|
516
|
+
console.log(`No WebdriverIO configuration found in "${parsedAnswers.wdioConfigPath}"`);
|
|
517
|
+
return !process.env.VITEST_WORKER_ID && process.exit(0);
|
|
518
|
+
}
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
// Only create if the user gave explicit permission to
|
|
522
|
+
if (parsedAnswers.createPackageJSON) {
|
|
523
|
+
console.log(`Creating a ${chalk.bold('package.json')} for the directory...`);
|
|
524
|
+
await fs.writeFile(path.resolve(process.cwd(), 'package.json'), JSON.stringify({
|
|
525
|
+
name: 'webdriverio-tests',
|
|
526
|
+
version: '0.0.0',
|
|
527
|
+
private: true,
|
|
528
|
+
license: 'ISC',
|
|
529
|
+
type: 'module',
|
|
530
|
+
dependencies: {},
|
|
531
|
+
devDependencies: {}
|
|
532
|
+
}, null, 2));
|
|
533
|
+
console.log(chalk.green.bold('✔ Success!\n'));
|
|
534
|
+
}
|
|
528
535
|
}
|
|
529
536
|
/**
|
|
530
537
|
* run npm install only if required by the user
|
|
@@ -599,16 +606,18 @@ export async function setupTypeScript(parsedAnswers) {
|
|
|
599
606
|
*/
|
|
600
607
|
.filter(service => service.startsWith('@wdio'))
|
|
601
608
|
];
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
609
|
+
if (!parsedAnswers.hasRootTSConfig) {
|
|
610
|
+
const config = {
|
|
611
|
+
compilerOptions: {
|
|
612
|
+
moduleResolution: 'node',
|
|
613
|
+
module: !parsedAnswers.esmSupport ? 'commonjs' : 'ESNext',
|
|
614
|
+
types,
|
|
615
|
+
target: 'es2022',
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
await fs.mkdir(path.dirname(parsedAnswers.tsConfigFilePath), { recursive: true });
|
|
619
|
+
await fs.writeFile(parsedAnswers.tsConfigFilePath, JSON.stringify(config, null, 4));
|
|
620
|
+
}
|
|
612
621
|
console.log(chalk.green.bold('✔ Success!\n'));
|
|
613
622
|
}
|
|
614
623
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/cli",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.7",
|
|
4
4
|
"description": "WebdriverIO testrunner command line interface",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-cli",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@types/node": "^18.0.0",
|
|
37
37
|
"@wdio/config": "8.5.6",
|
|
38
|
-
"@wdio/globals": "8.5.
|
|
38
|
+
"@wdio/globals": "8.5.7",
|
|
39
39
|
"@wdio/logger": "8.1.0",
|
|
40
|
-
"@wdio/protocols": "8.5.
|
|
40
|
+
"@wdio/protocols": "8.5.7",
|
|
41
41
|
"@wdio/types": "8.4.0",
|
|
42
42
|
"@wdio/utils": "8.5.6",
|
|
43
43
|
"async-exit-hook": "^2.0.1",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"mkdirp": "^2.0.0",
|
|
55
55
|
"read-pkg-up": "9.1.0",
|
|
56
56
|
"recursive-readdir": "^2.2.2",
|
|
57
|
-
"webdriverio": "8.5.
|
|
57
|
+
"webdriverio": "8.5.7",
|
|
58
58
|
"yargs": "^17.5.1",
|
|
59
59
|
"yarn-install": "^1.0.0"
|
|
60
60
|
},
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "b8b610be11417ada5809f75266f0462abeb5df79"
|
|
75
75
|
}
|