@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.
Files changed (47) hide show
  1. package/build/@types/yarn-install.d.ts +16 -0
  2. package/build/@types/yarn-install.d.ts.map +1 -0
  3. package/build/@types/yarn-install.js +1 -0
  4. package/build/commands/config.d.ts +64 -0
  5. package/build/commands/config.d.ts.map +1 -0
  6. package/build/commands/config.js +236 -0
  7. package/build/commands/install.d.ts +18 -0
  8. package/build/commands/install.d.ts.map +1 -0
  9. package/build/commands/install.js +112 -0
  10. package/build/commands/repl.d.ts +36 -0
  11. package/build/commands/repl.d.ts.map +1 -0
  12. package/build/commands/repl.js +62 -0
  13. package/build/commands/run.d.ts +172 -0
  14. package/build/commands/run.d.ts.map +1 -0
  15. package/build/commands/run.js +172 -0
  16. package/build/constants.d.ts +485 -0
  17. package/build/constants.d.ts.map +1 -0
  18. package/build/constants.js +370 -0
  19. package/build/index.d.ts +5 -0
  20. package/build/index.d.ts.map +1 -0
  21. package/build/index.js +88 -0
  22. package/build/interface.d.ts +75 -0
  23. package/build/interface.d.ts.map +1 -0
  24. package/build/interface.js +245 -0
  25. package/build/launcher.d.ts +95 -0
  26. package/build/launcher.d.ts.map +1 -0
  27. package/build/launcher.js +418 -0
  28. package/build/templates/afterTest.ejs +20 -0
  29. package/build/templates/exampleFiles/cucumber/features/login.feature +12 -0
  30. package/build/templates/exampleFiles/cucumber/step_definitions/steps.js.ejs +52 -0
  31. package/build/templates/exampleFiles/jasmine/example.e2e.js.ejs +42 -0
  32. package/build/templates/exampleFiles/mocha/example.e2e.js.ejs +42 -0
  33. package/build/templates/exampleFiles/pageobjects/login.page.js.ejs +44 -0
  34. package/build/templates/exampleFiles/pageobjects/page.js.ejs +13 -0
  35. package/build/templates/exampleFiles/pageobjects/secure.page.js.ejs +19 -0
  36. package/build/templates/reporters.ejs +14 -0
  37. package/build/templates/wdio.conf.tpl.ejs +448 -0
  38. package/build/types.d.ts +110 -0
  39. package/build/types.d.ts.map +1 -0
  40. package/build/types.js +2 -0
  41. package/build/utils.d.ts +82 -0
  42. package/build/utils.d.ts.map +1 -0
  43. package/build/utils.js +345 -0
  44. package/build/watcher.d.ts +34 -0
  45. package/build/watcher.d.ts.map +1 -0
  46. package/build/watcher.js +150 -0
  47. package/package.json +7 -7
@@ -0,0 +1,448 @@
1
+ <% if(!answers.isUsingTypeScript) { %>exports.config = {<% } else { %>export const config: WebdriverIO.Config = {<% } %>
2
+ //
3
+ // ====================
4
+ // Runner Configuration
5
+ // ====================
6
+ //<%
7
+ if(answers.isUsingTypeScript){ %>
8
+ //
9
+ // =====================
10
+ // ts-node Configurations
11
+ // =====================
12
+ //
13
+ // You can write tests using TypeScript to get autocompletion and type safety.
14
+ // You will need typescript and ts-node installed as devDependencies.
15
+ // WebdriverIO will automatically detect if these dependencies are installed
16
+ // and will compile your config and tests for you.
17
+ // If you need to configure how ts-node runs please use the
18
+ // environment variables for ts-node or use wdio config's autoCompileOpts section.
19
+ //
20
+
21
+ autoCompileOpts: {
22
+ autoCompile: true,
23
+ // see https://github.com/TypeStrong/ts-node#cli-and-programmatic-options
24
+ // for all available options
25
+ tsNodeOpts: {
26
+ transpileOnly: true,
27
+ project: 'test/tsconfig.json'
28
+ }
29
+ // tsconfig-paths is only used if "tsConfigPathsOpts" are provided, if you
30
+ // do please make sure "tsconfig-paths" is installed as dependency
31
+ //tsConfigPathsOpts: {
32
+ // baseUrl: './'
33
+ //}
34
+ },<% }
35
+
36
+ if(answers.expEnvAccessKey){ %>
37
+ hostname: '<%- answers.expEnvHostname %>',
38
+ <% if (answers.expEnvPort === '443'){%>protocol: 'https',
39
+ <%} else if (answers.expEnvPort === '80'){%>protocol: 'http',
40
+ <%} else { %>protocol: '<%- answers.expEnvProtocol %>',<%}%>
41
+ port: <%- answers.expEnvPort %>,
42
+ path: '/wd/hub',
43
+ <% } else if(answers.hostname && answers.port) { %>
44
+ //
45
+ // =====================
46
+ // Server Configurations
47
+ // =====================
48
+ // Host address of the running Selenium server. This information is usually obsolete as
49
+ // WebdriverIO automatically connects to localhost. Also, if you are using one of the
50
+ // supported cloud services like Sauce Labs, Browserstack, Testing Bot or LambdaTest you don't
51
+ // need to define host and port information because WebdriverIO can figure that out
52
+ // according to your user and key information. However, if you are using a private Selenium
53
+ // backend you should define the host address, port, and path here.
54
+ //
55
+ hostname: '<%- answers.hostname %>',
56
+ port: <%- answers.port %>,
57
+ path: '<%- answers.path %>',<% } else if (answers.services.includes('appium')) { %>
58
+ port: 4723,<% }
59
+
60
+ // Protocol: http | https
61
+ // protocol: 'http',
62
+ if(answers.env_user && answers.env_key) { %>
63
+ //
64
+ // =================
65
+ // Service Providers
66
+ // =================
67
+ // WebdriverIO supports Sauce Labs, Browserstack, Testing Bot and LambdaTest (other cloud providers
68
+ // should work too though). These services define specific user and key (or access key)
69
+ // values you need to put in here in order to connect to these services.
70
+ //
71
+ user: process.env.<%- answers.env_user %>,
72
+ key: process.env.<%- answers.env_key %>,
73
+ //
74
+ // If you run your tests on Sauce Labs you can specify the region you want to run your tests
75
+ // in via the `region` property. Available short handles for regions are `us` (default), `eu` and `apac`.
76
+ // These regions are used for the Sauce Labs VM cloud and the Sauce Labs Real Device Cloud.
77
+ // If you don't provide the region it will default for the `us`
78
+ <% }
79
+ if(answers.headless) { %>headless: true,<% }
80
+ if(answers.region) { %>region: '<%- answers.region %>',<% } %>
81
+ //
82
+ // ==================
83
+ // Specify Test Files
84
+ // ==================
85
+ // Define which test specs should run. The pattern is relative to the directory
86
+ // from which `wdio` was called.
87
+ //
88
+ // The specs are defined as an array of spec files (optionally using wildcards
89
+ // that will be expanded). The test for each spec file will be run in a separate
90
+ // worker process. In order to have a group of spec files run in the same worker
91
+ // process simply enclose them in an array within the specs array.
92
+ //
93
+ // If you are calling `wdio` from an NPM script (see https://docs.npmjs.com/cli/run-script),
94
+ // then the current working directory is where your `package.json` resides, so `wdio`
95
+ // will be called from there.
96
+ //
97
+ specs: [
98
+ '<%- answers.specs %>'
99
+ ],
100
+ // Patterns to exclude.
101
+ exclude: [
102
+ // 'path/to/excluded/files'
103
+ ],
104
+ //
105
+ // ============
106
+ // Capabilities
107
+ // ============
108
+ // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
109
+ // time. Depending on the number of capabilities, WebdriverIO launches several test
110
+ // sessions. Within your capabilities you can overwrite the spec and exclude options in
111
+ // order to group specific specs to a specific capability.
112
+ //
113
+ // First, you can define how many instances should be started at the same time. Let's
114
+ // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
115
+ // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
116
+ // files and you set maxInstances to 10, all spec files will get tested at the same time
117
+ // and 30 processes will get spawned. The property handles how many capabilities
118
+ // from the same test should run tests.
119
+ //
120
+ maxInstances: 10,
121
+ //
122
+ // If you have trouble getting all important capabilities together, check out the
123
+ // Sauce Labs platform configurator - a great tool to configure your capabilities:
124
+ // https://saucelabs.com/platform/platform-configurator
125
+ //
126
+ capabilities: [{
127
+ <%if(answers.expEnvAccessKey){%> 'experitest:accessKey': '<%- answers.expEnvAccessKey %>',<%}%>
128
+ // maxInstances can get overwritten per capability. So if you have an in-house Selenium
129
+ // grid with only 5 firefox instances available you can make sure that not more than
130
+ // 5 instances get started at a time.
131
+ maxInstances: 5,
132
+ //
133
+ browserName: 'chrome',
134
+ acceptInsecureCerts: true
135
+ // If outputDir is provided WebdriverIO can capture driver session logs
136
+ // it is possible to configure which logTypes to include/exclude.
137
+ // excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
138
+ // excludeDriverLogs: ['bugreport', 'server'],
139
+ }],
140
+ //
141
+ // ===================
142
+ // Test Configurations
143
+ // ===================
144
+ // Define all options that are relevant for the WebdriverIO instance here
145
+ //
146
+ // Level of logging verbosity: trace | debug | info | warn | error | silent
147
+ logLevel: 'info',
148
+ //
149
+ // Set specific log levels per logger
150
+ // loggers:
151
+ // - webdriver, webdriverio
152
+ // - @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service
153
+ // - @wdio/mocha-framework, @wdio/jasmine-framework
154
+ // - @wdio/local-runner
155
+ // - @wdio/sumologic-reporter
156
+ // - @wdio/cli, @wdio/config, @wdio/utils
157
+ // Level of logging verbosity: trace | debug | info | warn | error | silent
158
+ // logLevels: {
159
+ // webdriver: 'info',
160
+ // '@wdio/appium-service': 'info'
161
+ // },
162
+ //
163
+ // If you only want to run your tests until a specific amount of tests have failed use
164
+ // bail (default is 0 - don't bail, run all tests).
165
+ bail: 0,
166
+ //
167
+ // Set a base URL in order to shorten url command calls. If your `url` parameter starts
168
+ // with `/`, the base url gets prepended, not including the path portion of your baseUrl.
169
+ // If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
170
+ // gets prepended directly.
171
+ baseUrl: '<%- answers.baseUrl %>',
172
+ //
173
+ // Default timeout for all waitFor* commands.
174
+ waitforTimeout: 10000,
175
+ //
176
+ // Default timeout in milliseconds for request
177
+ // if browser driver or grid doesn't send response
178
+ connectionRetryTimeout: 120000,
179
+ //
180
+ // Default request retries count
181
+ connectionRetryCount: 3,
182
+ //
183
+ // Test runner services
184
+ // Services take over a specific job you don't want to take care of. They enhance
185
+ // your test setup with almost no effort. Unlike plugins, they don't add new
186
+ // commands. Instead, they hook themselves up into the test process.
187
+ <% if(answers.services.length) {
188
+ %>services: [<%- answers.services.map(service => `'${service}'`) %>],
189
+ <% } else {
190
+ %>// services: [],
191
+ //<% } %>
192
+ // Framework you want to run your specs with.
193
+ // The following are supported: Mocha, Jasmine, and Cucumber
194
+ // see also: https://webdriver.io/docs/frameworks
195
+ //
196
+ // Make sure you have the wdio adapter package for the specific framework installed
197
+ // before running any tests.
198
+ framework: '<%- answers.framework %>',
199
+ //
200
+ // The number of times to retry the entire specfile when it fails as a whole
201
+ // specFileRetries: 1,
202
+ //
203
+ // Delay in seconds between the spec file retry attempts
204
+ // specFileRetriesDelay: 0,
205
+ //
206
+ // Whether or not retried specfiles should be retried immediately or deferred to the end of the queue
207
+ // specFileRetriesDeferred: false,
208
+ //
209
+ <%- include('reporters', { reporters: answers.reporters }) %>
210
+ <% if(answers.framework === 'mocha') { %>
211
+ //
212
+ // Options to be passed to Mocha.
213
+ // See the full list at http://mochajs.org/
214
+ mochaOpts: {
215
+ ui: 'bdd',
216
+ timeout: 60000
217
+ },<%
218
+ }
219
+ if(answers.framework === 'jasmine') { %>
220
+ //
221
+ // Options to be passed to Jasmine.
222
+ jasmineOpts: {
223
+ // Jasmine default timeout
224
+ defaultTimeoutInterval: 60000,
225
+ //
226
+ // The Jasmine framework allows interception of each assertion in order to log the state of the application
227
+ // or website depending on the result. For example, it is pretty handy to take a screenshot every time
228
+ // an assertion fails.
229
+ expectationResultHandler: function(passed, assertion) {
230
+ // do something
231
+ }
232
+ },
233
+ <% }
234
+ if(answers.framework === 'cucumber') { %>//
235
+ // If you are using Cucumber you need to specify the location of your step definitions.
236
+ cucumberOpts: {
237
+ // <string[]> (file/dir) require files before executing features
238
+ require: ['<%- answers.stepDefinitions %>'],
239
+ // <boolean> show full backtrace for errors
240
+ backtrace: false,
241
+ // <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
242
+ requireModule: [],
243
+ // <boolean> invoke formatters without executing steps
244
+ dryRun: false,
245
+ // <boolean> abort the run on first failure
246
+ failFast: false,
247
+ // <boolean> hide step definition snippets for pending steps
248
+ snippets: true,
249
+ // <boolean> hide source uris
250
+ source: true,
251
+ // <boolean> fail if there are any undefined or pending steps
252
+ strict: false,
253
+ // <string> (expression) only execute the features or scenarios with tags matching the expression
254
+ tagExpression: '',
255
+ // <number> timeout for step definitions
256
+ timeout: 60000,
257
+ // <boolean> Enable this config to treat undefined definitions as warnings.
258
+ ignoreUndefinedDefinitions: false
259
+ },
260
+ <% } %>
261
+ //
262
+ // =====
263
+ // Hooks
264
+ // =====
265
+ // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
266
+ // it and to build services around it. You can either apply a single function or an array of
267
+ // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
268
+ // resolved to continue.
269
+ /**
270
+ * Gets executed once before all workers get launched.
271
+ * @param {Object} config wdio configuration object
272
+ * @param {Array.<Object>} capabilities list of capabilities details
273
+ */
274
+ // onPrepare: function (config, capabilities) {
275
+ // },
276
+ /**
277
+ * Gets executed before a worker process is spawned and can be used to initialise specific service
278
+ * for that worker as well as modify runtime environments in an async fashion.
279
+ * @param {String} cid capability id (e.g 0-0)
280
+ * @param {[type]} caps object containing capabilities for session that will be spawn in the worker
281
+ * @param {[type]} specs specs to be run in the worker process
282
+ * @param {[type]} args object that will be merged with the main configuration once worker is initialised
283
+ * @param {[type]} execArgv list of string arguments passed to the worker process
284
+ */
285
+ // onWorkerStart: function (cid, caps, specs, args, execArgv) {
286
+ // },
287
+ /**
288
+ * Gets executed just before initialising the webdriver session and test framework. It allows you
289
+ * to manipulate configurations depending on the capability or spec.
290
+ * @param {Object} config wdio configuration object
291
+ * @param {Array.<Object>} capabilities list of capabilities details
292
+ * @param {Array.<String>} specs List of spec file paths that are to be run
293
+ * @param {String} cid worker id (e.g. 0-0)
294
+ */
295
+ // beforeSession: function (config, capabilities, specs, cid) {
296
+ // },
297
+ /**
298
+ * Gets executed before test execution begins. At this point you can access to all global
299
+ * variables like `browser`. It is the perfect place to define custom commands.
300
+ * @param {Array.<Object>} capabilities list of capabilities details
301
+ * @param {Array.<String>} specs List of spec file paths that are to be run
302
+ * @param {Object} browser instance of created browser/device session
303
+ */
304
+ // before: function (capabilities, specs) {
305
+ // },
306
+ /**
307
+ * Runs before a WebdriverIO command gets executed.
308
+ * @param {String} commandName hook command name
309
+ * @param {Array} args arguments that command would receive
310
+ */
311
+ // beforeCommand: function (commandName, args) {
312
+ // },<%
313
+ if(answers.framework === 'mocha' || answers.framework === 'jasmine') { %>
314
+ /**
315
+ * Hook that gets executed before the suite starts
316
+ * @param {Object} suite suite details
317
+ */
318
+ // beforeSuite: function (suite) {
319
+ // },
320
+ /**
321
+ * Function to be executed before a test (in Mocha/Jasmine) starts.
322
+ */
323
+ // beforeTest: function (test, context) {
324
+ // },
325
+ /**
326
+ * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
327
+ * beforeEach in Mocha)
328
+ */
329
+ // beforeHook: function (test, context) {
330
+ // },
331
+ /**
332
+ * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
333
+ * afterEach in Mocha)
334
+ */
335
+ // afterHook: function (test, context, { error, result, duration, passed, retries }) {
336
+ // },
337
+ <%- include('afterTest', { reporters: answers.reporters }) %>
338
+ /**
339
+ * Hook that gets executed after the suite has ended
340
+ * @param {Object} suite suite details
341
+ */
342
+ // afterSuite: function (suite) {
343
+ // },<% }
344
+ if(answers.framework === 'cucumber') { %>
345
+ /**
346
+ * Cucumber Hooks
347
+ *
348
+ * Runs before a Cucumber Feature.
349
+ * @param {String} uri path to feature file
350
+ * @param {GherkinDocument.IFeature} feature Cucumber feature object
351
+ */
352
+ // beforeFeature: function (uri, feature) {
353
+ // },
354
+ /**
355
+ *
356
+ * Runs before a Cucumber Scenario.
357
+ * @param {ITestCaseHookParameter} world world object containing information on pickle and test step
358
+ * @param {Object} context Cucumber World object
359
+ */
360
+ // beforeScenario: function (world, context) {
361
+ // },
362
+ /**
363
+ *
364
+ * Runs before a Cucumber Step.
365
+ * @param {Pickle.IPickleStep} step step data
366
+ * @param {IPickle} scenario scenario pickle
367
+ * @param {Object} context Cucumber World object
368
+ */
369
+ // beforeStep: function (step, scenario, context) {
370
+ // },
371
+ /**
372
+ *
373
+ * Runs after a Cucumber Step.
374
+ * @param {Pickle.IPickleStep} step step data
375
+ * @param {IPickle} scenario scenario pickle
376
+ * @param {Object} result results object containing scenario results
377
+ * @param {boolean} result.passed true if scenario has passed
378
+ * @param {string} result.error error stack if scenario failed
379
+ * @param {number} result.duration duration of scenario in milliseconds
380
+ * @param {Object} context Cucumber World object
381
+ */
382
+ // afterStep: function (step, scenario, result, context) {
383
+ // },
384
+ /**
385
+ *
386
+ * Runs after a Cucumber Scenario.
387
+ * @param {ITestCaseHookParameter} world world object containing information on pickle and test step
388
+ * @param {Object} result results object containing scenario results
389
+ * @param {boolean} result.passed true if scenario has passed
390
+ * @param {string} result.error error stack if scenario failed
391
+ * @param {number} result.duration duration of scenario in milliseconds
392
+ * @param {Object} context Cucumber World object
393
+ */
394
+ // afterScenario: function (world, result, context) {
395
+ // },
396
+ /**
397
+ *
398
+ * Runs after a Cucumber Feature.
399
+ * @param {String} uri path to feature file
400
+ * @param {GherkinDocument.IFeature} feature Cucumber feature object
401
+ */
402
+ // afterFeature: function (uri, feature) {
403
+ // },
404
+ <% } %>
405
+ /**
406
+ * Runs after a WebdriverIO command gets executed
407
+ * @param {String} commandName hook command name
408
+ * @param {Array} args arguments that command would receive
409
+ * @param {Number} result 0 - command success, 1 - command error
410
+ * @param {Object} error error object if any
411
+ */
412
+ // afterCommand: function (commandName, args, result, error) {
413
+ // },
414
+ /**
415
+ * Gets executed after all tests are done. You still have access to all global variables from
416
+ * the test.
417
+ * @param {Number} result 0 - test pass, 1 - test fail
418
+ * @param {Array.<Object>} capabilities list of capabilities details
419
+ * @param {Array.<String>} specs List of spec file paths that ran
420
+ */
421
+ // after: function (result, capabilities, specs) {
422
+ // },
423
+ /**
424
+ * Gets executed right after terminating the webdriver session.
425
+ * @param {Object} config wdio configuration object
426
+ * @param {Array.<Object>} capabilities list of capabilities details
427
+ * @param {Array.<String>} specs List of spec file paths that ran
428
+ */
429
+ // afterSession: function (config, capabilities, specs) {
430
+ // },
431
+ /**
432
+ * Gets executed after all workers got shut down and the process is about to exit. An error
433
+ * thrown in the onComplete hook will result in the test run failing.
434
+ * @param {Object} exitCode 0 - success, 1 - fail
435
+ * @param {Object} config wdio configuration object
436
+ * @param {Array.<Object>} capabilities list of capabilities details
437
+ * @param {<Object>} results object containing test results
438
+ */
439
+ // onComplete: function(exitCode, config, capabilities, results) {
440
+ // },
441
+ /**
442
+ * Gets executed when a refresh happens.
443
+ * @param {String} oldSessionId session ID of the old session
444
+ * @param {String} newSessionId session ID of the new session
445
+ */
446
+ //onReload: function(oldSessionId, newSessionId) {
447
+ //}
448
+ }
@@ -0,0 +1,110 @@
1
+ import { Options, Reporters } from '@wdio/types';
2
+ import { BACKEND_CHOICES, REGION_OPTION, COMPILER_OPTION_ANSWERS } from './constants';
3
+ declare type ValueOf<T> = T[keyof T];
4
+ export interface Questionnair {
5
+ runner: 'local';
6
+ backend: ValueOf<typeof BACKEND_CHOICES>;
7
+ hostname: string;
8
+ port: string;
9
+ path: string;
10
+ expEnvAccessKey: string;
11
+ expEnvHostname: string;
12
+ expEnvPort: string;
13
+ expEnvProtocol: 'http' | 'https';
14
+ env_user: string;
15
+ env_key: string;
16
+ headless: boolean;
17
+ region: ValueOf<typeof REGION_OPTION>;
18
+ framework: string;
19
+ specs: string;
20
+ stepDefinitions: string;
21
+ generateTestFiles: boolean;
22
+ usePageObjects: boolean;
23
+ pages: string;
24
+ isUsingCompiler: ValueOf<typeof COMPILER_OPTION_ANSWERS>;
25
+ reporters: string[];
26
+ services: string[];
27
+ plugins: string[];
28
+ outputDir: string;
29
+ baseUrl: string;
30
+ npmInstall: boolean;
31
+ }
32
+ export interface ParsedAnswers extends Omit<Questionnair, 'runner' | 'framework' | 'reporters' | 'services' | 'plugins'> {
33
+ runner: 'local';
34
+ framework: string;
35
+ reporters: string[];
36
+ plugins: string[];
37
+ services: string[];
38
+ packagesToInstall: string[];
39
+ isUsingTypeScript: boolean;
40
+ isUsingBabel: boolean;
41
+ isSync: boolean;
42
+ _async: string;
43
+ _await: string;
44
+ destSpecRootPath: string;
45
+ destPageObjectRootPath: string;
46
+ relativePath: string;
47
+ tsConfigFilePath: string;
48
+ }
49
+ export interface RunCommandArguments {
50
+ watch?: boolean;
51
+ hostname?: string;
52
+ port?: number;
53
+ path?: string;
54
+ user?: string;
55
+ key?: string;
56
+ logLevel?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
57
+ bail?: number;
58
+ baseUrl?: string;
59
+ waitforTimeout?: number;
60
+ framework?: string;
61
+ reporters?: Reporters.ReporterEntry[];
62
+ suite?: string[];
63
+ spec?: string[];
64
+ exclude?: string[];
65
+ mochaOpts?: WebdriverIO.MochaOpts;
66
+ jasmineOpts?: WebdriverIO.JasmineOpts;
67
+ cucumberOpts?: WebdriverIO.CucumberOpts;
68
+ autoCompileOpts?: Options.AutoCompileConfig;
69
+ configPath: string;
70
+ /**
71
+ * @internal
72
+ */
73
+ ignoredWorkerServices?: string[];
74
+ }
75
+ export interface ReplCommandArguments {
76
+ platformVersion: string;
77
+ deviceName: string;
78
+ udid: string;
79
+ option: string;
80
+ }
81
+ export interface InstallCommandArguments {
82
+ yarn: boolean;
83
+ config: string;
84
+ type: 'service' | 'reporter' | 'framework' | 'plugin';
85
+ name: string;
86
+ }
87
+ export interface ConfigCommandArguments {
88
+ yarn: boolean;
89
+ yes: boolean;
90
+ }
91
+ export interface SupportedPackage {
92
+ package: string;
93
+ short: string;
94
+ }
95
+ export interface OnCompleteResult {
96
+ finished: number;
97
+ passed: number;
98
+ retries: number;
99
+ failed: number;
100
+ }
101
+ /** Extracted from @types/lodash@4.14.168 */
102
+ export declare type ValueKeyIteratee<T> = ((value: T, key: string) => NotVoid) | IterateeShorthand<T>;
103
+ declare type IterateeShorthand<T> = PropertyName | [PropertyName, any] | PartialShallow<T>;
104
+ declare type PropertyName = string | number | symbol;
105
+ declare type PartialShallow<T> = {
106
+ [P in keyof T]?: T[P] extends object ? object : T[P];
107
+ };
108
+ declare type NotVoid = unknown;
109
+ export {};
110
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErF,aAAK,OA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CAAC,CAAC,CAAC;CACvD,CAAC;AACF,aAAK,OAAO,GAAG,OAAO,CAAC"}
package/build/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,82 @@
1
+ import type { Options, Capabilities, Services } from '@wdio/types';
2
+ import { ReplCommandArguments, Questionnair, SupportedPackage, OnCompleteResult, ParsedAnswers } from './types';
3
+ /**
4
+ * run service launch sequences
5
+ */
6
+ export declare function runServiceHook(launcher: Services.ServiceInstance[], hookName: keyof Services.HookFunctions, ...args: any[]): Promise<undefined>;
7
+ /**
8
+ * Run hook in service launcher
9
+ * @param {Array|Function} hook - can be array of functions or single function
10
+ * @param {Object} config
11
+ * @param {Object} capabilities
12
+ */
13
+ export declare function runLauncherHook(hook: Function | Function[], ...args: any[]): Promise<void | any[]>;
14
+ /**
15
+ * Run onCompleteHook in Launcher
16
+ * @param {Array|Function} onCompleteHook - can be array of functions or single function
17
+ * @param {*} config
18
+ * @param {*} capabilities
19
+ * @param {*} exitCode
20
+ * @param {*} results
21
+ */
22
+ export declare function runOnCompleteHook(onCompleteHook: Function | Function[], config: Options.Testrunner, capabilities: Capabilities.RemoteCapabilities, exitCode: number, results: OnCompleteResult): Promise<(0 | 1)[]>;
23
+ /**
24
+ * get runner identification by caps
25
+ */
26
+ export declare function getRunnerName(caps?: Capabilities.DesiredCapabilities): string;
27
+ export declare function findInConfig(config: string, type: string): RegExpMatchArray | null;
28
+ export declare function replaceConfig(config: string, type: string, name: string): string | undefined;
29
+ export declare function addServiceDeps(names: SupportedPackage[], packages: string[], update?: boolean): void;
30
+ /**
31
+ * @todo add JSComments
32
+ */
33
+ export declare function convertPackageHashToObject(pkg: string, hash?: string): SupportedPackage;
34
+ export declare function renderConfigurationFile(answers: ParsedAnswers): Promise<void>;
35
+ export declare const validateServiceAnswers: (answers: string[]) => Boolean | string;
36
+ export declare function getCapabilities(arg: ReplCommandArguments): {
37
+ capabilities: {
38
+ deviceName: string;
39
+ platformVersion: string;
40
+ udid: string;
41
+ platformName: string;
42
+ automationName: string;
43
+ app: string;
44
+ browserName?: undefined;
45
+ };
46
+ } | {
47
+ capabilities: {
48
+ deviceName: string;
49
+ platformVersion: string;
50
+ udid: string;
51
+ platformName: string;
52
+ automationName: string;
53
+ browserName: string;
54
+ };
55
+ } | {
56
+ capabilities: {
57
+ browserName: string;
58
+ };
59
+ };
60
+ /**
61
+ * Check if file exists in current work directory
62
+ * @param {string} filename to check existance for
63
+ */
64
+ export declare function hasFile(filename: string): boolean;
65
+ /**
66
+ * Check if package is installed
67
+ * @param {string} package to check existance for
68
+ */
69
+ export declare function hasPackage(pkg: string): boolean;
70
+ /**
71
+ * generate test files based on CLI answers
72
+ */
73
+ export declare function generateTestFiles(answers: ParsedAnswers): Promise<void>;
74
+ export declare function getAnswers(yes: boolean): Promise<Questionnair>;
75
+ export declare function getPathForFileGeneration(answers: Questionnair): {
76
+ destSpecRootPath: string;
77
+ destStepRootPath: string;
78
+ destPageObjectRootPath: string;
79
+ relativePath: string;
80
+ };
81
+ export declare function getDefaultFiles(answers: Partial<Questionnair>, filePath: string): string;
82
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAQ/G;;GAEG;AACH,wBAAsB,cAAc,CAChC,QAAQ,EAAE,QAAQ,CAAC,eAAe,EAAE,EACpC,QAAQ,EAAE,MAAM,QAAQ,CAAC,aAAa,EACtC,GAAG,IAAI,EAAE,GAAG,EAAE,sBA2BjB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,QAA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