@wdio/cli 7.17.0 → 7.17.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/build/@types/yarn-install.d.ts +16 -0
- package/build/@types/yarn-install.d.ts.map +1 -0
- package/build/@types/yarn-install.js +1 -0
- package/build/commands/config.d.ts +64 -0
- package/build/commands/config.d.ts.map +1 -0
- package/build/commands/config.js +236 -0
- package/build/commands/install.d.ts +18 -0
- package/build/commands/install.d.ts.map +1 -0
- package/build/commands/install.js +112 -0
- package/build/commands/repl.d.ts +36 -0
- package/build/commands/repl.d.ts.map +1 -0
- package/build/commands/repl.js +62 -0
- package/build/commands/run.d.ts +172 -0
- package/build/commands/run.d.ts.map +1 -0
- package/build/commands/run.js +172 -0
- package/build/constants.d.ts +485 -0
- package/build/constants.d.ts.map +1 -0
- package/build/constants.js +370 -0
- package/build/index.d.ts +5 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +88 -0
- package/build/interface.d.ts +75 -0
- package/build/interface.d.ts.map +1 -0
- package/build/interface.js +245 -0
- package/build/launcher.d.ts +95 -0
- package/build/launcher.d.ts.map +1 -0
- package/build/launcher.js +418 -0
- package/build/templates/afterTest.ejs +20 -0
- package/build/templates/exampleFiles/cucumber/features/login.feature +12 -0
- package/build/templates/exampleFiles/cucumber/step_definitions/steps.js.ejs +52 -0
- package/build/templates/exampleFiles/jasmine/example.e2e.js.ejs +42 -0
- package/build/templates/exampleFiles/mocha/example.e2e.js.ejs +42 -0
- package/build/templates/exampleFiles/pageobjects/login.page.js.ejs +44 -0
- package/build/templates/exampleFiles/pageobjects/page.js.ejs +13 -0
- package/build/templates/exampleFiles/pageobjects/secure.page.js.ejs +19 -0
- package/build/templates/reporters.ejs +14 -0
- package/build/templates/wdio.conf.tpl.ejs +448 -0
- package/build/types.d.ts +110 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/utils.d.ts +82 -0
- package/build/utils.d.ts.map +1 -0
- package/build/utils.js +345 -0
- package/build/watcher.d.ts +34 -0
- package/build/watcher.d.ts.map +1 -0
- package/build/watcher.js +150 -0
- package/package.json +7 -7
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { RunCommandArguments } from '../types';
|
|
2
|
+
import yargs from 'yargs';
|
|
3
|
+
export declare const command = "run <configPath>";
|
|
4
|
+
export declare const desc = "Run your WDIO configuration file to initialize your tests. (default)";
|
|
5
|
+
export declare const cmdArgs: {
|
|
6
|
+
readonly watch: {
|
|
7
|
+
readonly desc: "Run WebdriverIO in watch mode";
|
|
8
|
+
readonly type: "boolean";
|
|
9
|
+
};
|
|
10
|
+
readonly hostname: {
|
|
11
|
+
readonly alias: "h";
|
|
12
|
+
readonly desc: "automation driver host address";
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
};
|
|
15
|
+
readonly port: {
|
|
16
|
+
readonly alias: "p";
|
|
17
|
+
readonly desc: "automation driver port";
|
|
18
|
+
readonly type: "number";
|
|
19
|
+
};
|
|
20
|
+
readonly path: {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly desc: "path to WebDriver endpoints (default \"/\")";
|
|
23
|
+
};
|
|
24
|
+
readonly user: {
|
|
25
|
+
readonly alias: "u";
|
|
26
|
+
readonly desc: "username if using a cloud service as automation backend";
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
};
|
|
29
|
+
readonly key: {
|
|
30
|
+
readonly alias: "k";
|
|
31
|
+
readonly desc: "corresponding access key to the user";
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
};
|
|
34
|
+
readonly logLevel: {
|
|
35
|
+
readonly alias: "l";
|
|
36
|
+
readonly desc: "level of logging verbosity";
|
|
37
|
+
readonly choices: readonly ["trace", "debug", "info", "warn", "error", "silent"];
|
|
38
|
+
};
|
|
39
|
+
readonly bail: {
|
|
40
|
+
readonly desc: "stop test runner after specific amount of tests have failed";
|
|
41
|
+
readonly type: "number";
|
|
42
|
+
};
|
|
43
|
+
readonly baseUrl: {
|
|
44
|
+
readonly desc: "shorten url command calls by setting a base url";
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
};
|
|
47
|
+
readonly waitforTimeout: {
|
|
48
|
+
readonly alias: "w";
|
|
49
|
+
readonly desc: "timeout for all waitForXXX commands";
|
|
50
|
+
readonly type: "number";
|
|
51
|
+
};
|
|
52
|
+
readonly framework: {
|
|
53
|
+
readonly alias: "f";
|
|
54
|
+
readonly desc: "defines the framework (Mocha, Jasmine or Cucumber) to run the specs";
|
|
55
|
+
readonly type: "string";
|
|
56
|
+
};
|
|
57
|
+
readonly reporters: {
|
|
58
|
+
readonly alias: "r";
|
|
59
|
+
readonly desc: "reporters to print out the results on stdout";
|
|
60
|
+
readonly type: "array";
|
|
61
|
+
};
|
|
62
|
+
readonly suite: {
|
|
63
|
+
readonly desc: "overwrites the specs attribute and runs the defined suite";
|
|
64
|
+
readonly type: "array";
|
|
65
|
+
};
|
|
66
|
+
readonly spec: {
|
|
67
|
+
readonly desc: "run only a certain spec file - overrides specs piped from stdin";
|
|
68
|
+
readonly type: "array";
|
|
69
|
+
};
|
|
70
|
+
readonly exclude: {
|
|
71
|
+
readonly desc: "exclude certain spec file from the test run - overrides exclude piped from stdin";
|
|
72
|
+
readonly type: "array";
|
|
73
|
+
};
|
|
74
|
+
readonly mochaOpts: {
|
|
75
|
+
readonly desc: "Mocha options";
|
|
76
|
+
};
|
|
77
|
+
readonly jasmineOpts: {
|
|
78
|
+
readonly desc: "Jasmine options";
|
|
79
|
+
};
|
|
80
|
+
readonly cucumberOpts: {
|
|
81
|
+
readonly desc: "Cucumber options";
|
|
82
|
+
};
|
|
83
|
+
readonly autoCompileOpts: {
|
|
84
|
+
readonly desc: "Auto compilation options";
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export declare const builder: (yargs: yargs.Argv<{}>) => yargs.Argv<yargs.Omit<{}, "framework" | "reporters" | "hostname" | "port" | "path" | "baseUrl" | "exclude" | "user" | "key" | "logLevel" | "spec" | "waitforTimeout" | "watch" | "bail" | "suite" | "mochaOpts" | "jasmineOpts" | "cucumberOpts" | "autoCompileOpts"> & yargs.InferredOptionTypes<{
|
|
88
|
+
readonly watch: {
|
|
89
|
+
readonly desc: "Run WebdriverIO in watch mode";
|
|
90
|
+
readonly type: "boolean";
|
|
91
|
+
};
|
|
92
|
+
readonly hostname: {
|
|
93
|
+
readonly alias: "h";
|
|
94
|
+
readonly desc: "automation driver host address";
|
|
95
|
+
readonly type: "string";
|
|
96
|
+
};
|
|
97
|
+
readonly port: {
|
|
98
|
+
readonly alias: "p";
|
|
99
|
+
readonly desc: "automation driver port";
|
|
100
|
+
readonly type: "number";
|
|
101
|
+
};
|
|
102
|
+
readonly path: {
|
|
103
|
+
readonly type: "string";
|
|
104
|
+
readonly desc: "path to WebDriver endpoints (default \"/\")";
|
|
105
|
+
};
|
|
106
|
+
readonly user: {
|
|
107
|
+
readonly alias: "u";
|
|
108
|
+
readonly desc: "username if using a cloud service as automation backend";
|
|
109
|
+
readonly type: "string";
|
|
110
|
+
};
|
|
111
|
+
readonly key: {
|
|
112
|
+
readonly alias: "k";
|
|
113
|
+
readonly desc: "corresponding access key to the user";
|
|
114
|
+
readonly type: "string";
|
|
115
|
+
};
|
|
116
|
+
readonly logLevel: {
|
|
117
|
+
readonly alias: "l";
|
|
118
|
+
readonly desc: "level of logging verbosity";
|
|
119
|
+
readonly choices: readonly ["trace", "debug", "info", "warn", "error", "silent"];
|
|
120
|
+
};
|
|
121
|
+
readonly bail: {
|
|
122
|
+
readonly desc: "stop test runner after specific amount of tests have failed";
|
|
123
|
+
readonly type: "number";
|
|
124
|
+
};
|
|
125
|
+
readonly baseUrl: {
|
|
126
|
+
readonly desc: "shorten url command calls by setting a base url";
|
|
127
|
+
readonly type: "string";
|
|
128
|
+
};
|
|
129
|
+
readonly waitforTimeout: {
|
|
130
|
+
readonly alias: "w";
|
|
131
|
+
readonly desc: "timeout for all waitForXXX commands";
|
|
132
|
+
readonly type: "number";
|
|
133
|
+
};
|
|
134
|
+
readonly framework: {
|
|
135
|
+
readonly alias: "f";
|
|
136
|
+
readonly desc: "defines the framework (Mocha, Jasmine or Cucumber) to run the specs";
|
|
137
|
+
readonly type: "string";
|
|
138
|
+
};
|
|
139
|
+
readonly reporters: {
|
|
140
|
+
readonly alias: "r";
|
|
141
|
+
readonly desc: "reporters to print out the results on stdout";
|
|
142
|
+
readonly type: "array";
|
|
143
|
+
};
|
|
144
|
+
readonly suite: {
|
|
145
|
+
readonly desc: "overwrites the specs attribute and runs the defined suite";
|
|
146
|
+
readonly type: "array";
|
|
147
|
+
};
|
|
148
|
+
readonly spec: {
|
|
149
|
+
readonly desc: "run only a certain spec file - overrides specs piped from stdin";
|
|
150
|
+
readonly type: "array";
|
|
151
|
+
};
|
|
152
|
+
readonly exclude: {
|
|
153
|
+
readonly desc: "exclude certain spec file from the test run - overrides exclude piped from stdin";
|
|
154
|
+
readonly type: "array";
|
|
155
|
+
};
|
|
156
|
+
readonly mochaOpts: {
|
|
157
|
+
readonly desc: "Mocha options";
|
|
158
|
+
};
|
|
159
|
+
readonly jasmineOpts: {
|
|
160
|
+
readonly desc: "Jasmine options";
|
|
161
|
+
};
|
|
162
|
+
readonly cucumberOpts: {
|
|
163
|
+
readonly desc: "Cucumber options";
|
|
164
|
+
};
|
|
165
|
+
readonly autoCompileOpts: {
|
|
166
|
+
readonly desc: "Auto compilation options";
|
|
167
|
+
};
|
|
168
|
+
}>>;
|
|
169
|
+
export declare function launchWithStdin(wdioConfPath: string, params: Partial<RunCommandArguments>): void;
|
|
170
|
+
export declare function launch(wdioConfPath: string, params: Partial<RunCommandArguments>): Promise<void>;
|
|
171
|
+
export declare function handler(argv: RunCommandArguments): Promise<void>;
|
|
172
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAK9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,OAAO,qBAAqB,CAAA;AAEzC,eAAO,MAAM,IAAI,yEAAyE,CAAA;AAE1F,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFV,CAAA;AAEV,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUnB,CAAA;AAED,wBAAgB,eAAe,CAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,QAc1F;AAED,wBAAgB,MAAM,CAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,iBAgBjF;AAED,wBAAsB,OAAO,CAAE,IAAI,EAAE,mBAAmB,iBAkCvD"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.handler = exports.launch = exports.launchWithStdin = exports.builder = exports.cmdArgs = exports.desc = exports.command = void 0;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const config_1 = require("./config");
|
|
10
|
+
const launcher_1 = __importDefault(require("../launcher"));
|
|
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 = {
|
|
16
|
+
watch: {
|
|
17
|
+
desc: 'Run WebdriverIO in watch mode',
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
},
|
|
20
|
+
hostname: {
|
|
21
|
+
alias: 'h',
|
|
22
|
+
desc: 'automation driver host address',
|
|
23
|
+
type: 'string'
|
|
24
|
+
},
|
|
25
|
+
port: {
|
|
26
|
+
alias: 'p',
|
|
27
|
+
desc: 'automation driver port',
|
|
28
|
+
type: 'number'
|
|
29
|
+
},
|
|
30
|
+
path: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
desc: 'path to WebDriver endpoints (default "/")'
|
|
33
|
+
},
|
|
34
|
+
user: {
|
|
35
|
+
alias: 'u',
|
|
36
|
+
desc: 'username if using a cloud service as automation backend',
|
|
37
|
+
type: 'string'
|
|
38
|
+
},
|
|
39
|
+
key: {
|
|
40
|
+
alias: 'k',
|
|
41
|
+
desc: 'corresponding access key to the user',
|
|
42
|
+
type: 'string'
|
|
43
|
+
},
|
|
44
|
+
logLevel: {
|
|
45
|
+
alias: 'l',
|
|
46
|
+
desc: 'level of logging verbosity',
|
|
47
|
+
choices: ['trace', 'debug', 'info', 'warn', 'error', 'silent']
|
|
48
|
+
},
|
|
49
|
+
bail: {
|
|
50
|
+
desc: 'stop test runner after specific amount of tests have failed',
|
|
51
|
+
type: 'number'
|
|
52
|
+
},
|
|
53
|
+
baseUrl: {
|
|
54
|
+
desc: 'shorten url command calls by setting a base url',
|
|
55
|
+
type: 'string'
|
|
56
|
+
},
|
|
57
|
+
waitforTimeout: {
|
|
58
|
+
alias: 'w',
|
|
59
|
+
desc: 'timeout for all waitForXXX commands',
|
|
60
|
+
type: 'number'
|
|
61
|
+
},
|
|
62
|
+
framework: {
|
|
63
|
+
alias: 'f',
|
|
64
|
+
desc: 'defines the framework (Mocha, Jasmine or Cucumber) to run the specs',
|
|
65
|
+
type: 'string'
|
|
66
|
+
},
|
|
67
|
+
reporters: {
|
|
68
|
+
alias: 'r',
|
|
69
|
+
desc: 'reporters to print out the results on stdout',
|
|
70
|
+
type: 'array'
|
|
71
|
+
},
|
|
72
|
+
suite: {
|
|
73
|
+
desc: 'overwrites the specs attribute and runs the defined suite',
|
|
74
|
+
type: 'array'
|
|
75
|
+
},
|
|
76
|
+
spec: {
|
|
77
|
+
desc: 'run only a certain spec file - overrides specs piped from stdin',
|
|
78
|
+
type: 'array'
|
|
79
|
+
},
|
|
80
|
+
exclude: {
|
|
81
|
+
desc: 'exclude certain spec file from the test run - overrides exclude piped from stdin',
|
|
82
|
+
type: 'array'
|
|
83
|
+
},
|
|
84
|
+
mochaOpts: {
|
|
85
|
+
desc: 'Mocha options'
|
|
86
|
+
},
|
|
87
|
+
jasmineOpts: {
|
|
88
|
+
desc: 'Jasmine options'
|
|
89
|
+
},
|
|
90
|
+
cucumberOpts: {
|
|
91
|
+
desc: 'Cucumber options'
|
|
92
|
+
},
|
|
93
|
+
autoCompileOpts: {
|
|
94
|
+
desc: 'Auto compilation options'
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const builder = (yargs) => {
|
|
98
|
+
return yargs
|
|
99
|
+
.options(exports.cmdArgs)
|
|
100
|
+
.example('$0 run wdio.conf.js --suite foobar', 'Run suite on testsuite "foobar"')
|
|
101
|
+
.example('$0 run wdio.conf.js --spec ./tests/e2e/a.js --spec ./tests/e2e/b.js', 'Run suite on specific specs')
|
|
102
|
+
.example('$0 run wdio.conf.js --mochaOpts.timeout 60000', 'Run suite with custom Mocha timeout')
|
|
103
|
+
.example('$0 run wdio.conf.js --autoCompileOpts.autoCompile=false', 'Disable auto-loading of ts-node or @babel/register')
|
|
104
|
+
.example('$0 run wdio.conf.js --autoCompileOpts.tsNodeOpts.project=configs/bdd-tsconfig.json', 'Run suite with ts-node using custom tsconfig.json')
|
|
105
|
+
.epilogue(constants_1.CLI_EPILOGUE)
|
|
106
|
+
.help();
|
|
107
|
+
};
|
|
108
|
+
exports.builder = builder;
|
|
109
|
+
function launchWithStdin(wdioConfPath, params) {
|
|
110
|
+
let stdinData = '';
|
|
111
|
+
const stdin = process.openStdin();
|
|
112
|
+
stdin.setEncoding('utf8');
|
|
113
|
+
stdin.on('data', (data) => {
|
|
114
|
+
stdinData += data;
|
|
115
|
+
});
|
|
116
|
+
stdin.on('end', () => {
|
|
117
|
+
if (stdinData.length > 0) {
|
|
118
|
+
params.spec = stdinData.trim().split(/\r?\n/);
|
|
119
|
+
}
|
|
120
|
+
launch(wdioConfPath, params);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
exports.launchWithStdin = launchWithStdin;
|
|
124
|
+
function launch(wdioConfPath, params) {
|
|
125
|
+
const launcher = new launcher_1.default(wdioConfPath, params);
|
|
126
|
+
return launcher.run()
|
|
127
|
+
.then((...args) => {
|
|
128
|
+
/* istanbul ignore if */
|
|
129
|
+
if (!process.env.JEST_WORKER_ID) {
|
|
130
|
+
process.exit(...args);
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
.catch(err => {
|
|
134
|
+
console.error(err);
|
|
135
|
+
/* istanbul ignore if */
|
|
136
|
+
if (!process.env.JEST_WORKER_ID) {
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
exports.launch = launch;
|
|
142
|
+
async function handler(argv) {
|
|
143
|
+
const { configPath, ...params } = argv;
|
|
144
|
+
if (!fs_extra_1.default.existsSync(configPath)) {
|
|
145
|
+
await (0, config_1.missingConfigurationPrompt)('run', `No WebdriverIO configuration found in "${process.cwd()}"`);
|
|
146
|
+
}
|
|
147
|
+
const localConf = path_1.default.join(process.cwd(), 'wdio.conf.js');
|
|
148
|
+
const wdioConf = configPath || (fs_extra_1.default.existsSync(localConf) ? localConf : undefined);
|
|
149
|
+
/**
|
|
150
|
+
* if `--watch` param is set, run launcher in watch mode
|
|
151
|
+
*/
|
|
152
|
+
if (params.watch) {
|
|
153
|
+
const watcher = new watcher_1.default(wdioConf, params);
|
|
154
|
+
return watcher.watch();
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* if stdin.isTTY, then no piped input is present and launcher should be
|
|
158
|
+
* called immediately, otherwise piped input is processed, expecting
|
|
159
|
+
* a list of files to process.
|
|
160
|
+
*
|
|
161
|
+
* stdin.isTTY is false when command is from nodes spawn since it's treated as a pipe
|
|
162
|
+
*/
|
|
163
|
+
if (process.stdin.isTTY || !process.stdout.isTTY) {
|
|
164
|
+
return launch(wdioConf, params);
|
|
165
|
+
}
|
|
166
|
+
/*
|
|
167
|
+
* get a list of spec files to run from stdin, overriding any other
|
|
168
|
+
* configuration suite or specs.
|
|
169
|
+
*/
|
|
170
|
+
launchWithStdin(wdioConf, params);
|
|
171
|
+
}
|
|
172
|
+
exports.handler = handler;
|