webdriverio 4.9.10 → 4.10.2

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 (37) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/build/lib/cli.js +13 -5
  3. package/build/lib/commands/getElementSize.js +1 -1
  4. package/build/lib/commands/getValue.js +4 -4
  5. package/build/lib/commands/touchAction.js +10 -2
  6. package/build/lib/helpers/utilities.js +8 -8
  7. package/build/lib/helpers/wdio.conf.ejs +2 -2
  8. package/build/lib/launcher.js +13 -10
  9. package/build/lib/protocol/elementIdProperty.js +44 -0
  10. package/build/lib/protocol/keys.js +0 -3
  11. package/build/lib/protocol/toggleTouchIdEnrollment.js +4 -1
  12. package/build/lib/protocol/touchId.js +4 -1
  13. package/build/lib/utils/BaseReporter.js +1 -1
  14. package/build/lib/utils/ConfigParser.js +52 -27
  15. package/build/lib/utils/ReporterStats.js +4 -1
  16. package/build/package.json +1 -1
  17. package/docs/guide/getstarted/configuration.md +1 -1
  18. package/docs/guide/reporters/allure.md +1 -1
  19. package/docs/guide/reporters/dot.md +1 -1
  20. package/docs/guide/reporters/mochawesome.md +67 -0
  21. package/docs/guide/services/docker.md +145 -0
  22. package/docs/guide/services/webpack-dev-server.md +1 -1
  23. package/docs/guide/testrunner/configurationfile.md +2 -2
  24. package/docs/guide/testrunner/gettingstarted.md +2 -2
  25. package/docs/guide/testrunner/organizesuite.md +26 -4
  26. package/docs/guide/testrunner/reporters.md +12 -4
  27. package/docs/guide/testrunner/retry.md +1 -1
  28. package/docs/guide.md +2 -1
  29. package/lib/commands/getElementSize.js +1 -1
  30. package/lib/commands/getValue.js +4 -4
  31. package/lib/commands/touchAction.js +10 -2
  32. package/lib/protocol/elementIdProperty.js +33 -0
  33. package/lib/protocol/keys.js +0 -3
  34. package/lib/protocol/toggleTouchIdEnrollment.js +4 -1
  35. package/lib/protocol/touchId.js +4 -1
  36. package/package-lock.json +182 -124
  37. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v4.10.2 (2018-02-02)
4
+ * global changes:
5
+ * docs improvements
6
+ * bugfixes:
7
+ * better unknown command detection (#2580)
8
+
9
+ ## v4.10.1 (2018-01-12)
10
+ * bugfixes:
11
+ * fallback to old JSONWireProtocol commands when running Chromedriver
12
+
13
+ ## v4.10.0 (2018-01-10)
14
+ * bugfixes:
15
+ * Fix for error handling on before/after hooks (#2497)
16
+ * fix debug functionality when using launcher programmatically (#2492)
17
+ * Fix issue when terminal doesn't support colors (#2496)
18
+ * global changes:
19
+ * docs improvements
20
+ * fallbacks for depcrecated JsonWireProtocol commands (#2493)
21
+ * wdio changes
22
+ * Add ability to specify a spec and suite (#2505)
23
+ * Add support for filtering specs #2520
24
+
25
+ ## v4.9.11 (2017-11-29)
26
+ * bugfixes:
27
+ * better handling of failures in before hooks placed before any describe block (#2259)
28
+ * fix waitForVisible handling (#2486)
29
+ * docs:
30
+ * add Mochawesome reporter
31
+
3
32
  ## v4.9.10 (2017-11-27)
4
33
  * bugfixes:
5
34
  * fix launcher run by node script as child process (#2477)
package/build/lib/cli.js CHANGED
@@ -56,13 +56,13 @@ var SUPPORTED_FRAMEWORKS = ['mocha', // https://github.com/webdriverio/wdio-moch
56
56
  'jasmine', // https://github.com/webdriverio/wdio-jasmine-framework
57
57
  'cucumber' // https://github.com/webdriverio/wdio-cucumber-framework
58
58
  ];
59
- var SUPPORTED_REPORTER = [' dot - https://github.com/webdriverio/wdio-dot-reporter', ' spec - https://github.com/webdriverio/wdio-spec-reporter', ' junit - https://github.com/webdriverio/wdio-junit-reporter', ' allure - https://github.com/webdriverio/wdio-allure-reporter', ' teamcity - https://github.com/sullenor/wdio-teamcity-reporter', ' json - https://github.com/fijijavis/wdio-json-reporter', ' concise - https://github.com/FloValence/wdio-concise-reporter', ' testrail - https://github.com/oxynade/wdio-testrail-reporter'];
60
- var SUPPORTED_SERVICES = [' sauce - https://github.com/webdriverio/wdio-sauce-service', ' browserstack - https://github.com/itszero/wdio-browserstack-service', ' testingbot - https://github.com/testingbot/wdio-testingbot-service', ' appium - https://github.com/rhysd/wdio-appium-service', ' firefox-profile - https://github.com/webdriverio/wdio-firefox-profile-service', ' selenium-standalone - https://github.com/webdriverio/wdio-selenium-standalone-service', ' phantomjs - https://github.com/cognitom/wdio-phantomjs-service', ' static-server - https://github.com/LeadPages/wdio-static-server-service', ' visual-regression - https://github.com/zinserjan/wdio-visual-regression-service', ' webpack - https://github.com/leadpages/wdio-webpack-service', ' webpack-dev-server - https://gitlab.com/Vinnl/wdio-webpack-dev-server-service', ' chromedriver - https://github.com/atti187/wdio-chromedriver-service', ' iedriver - https://github.com/atti187/wdio-iedriver-service'];
59
+ var SUPPORTED_REPORTER = [' dot - https://github.com/webdriverio/wdio-dot-reporter', ' spec - https://github.com/webdriverio/wdio-spec-reporter', ' junit - https://github.com/webdriverio/wdio-junit-reporter', ' allure - https://github.com/webdriverio/wdio-allure-reporter', ' teamcity - https://github.com/sullenor/wdio-teamcity-reporter', ' json - https://github.com/fijijavis/wdio-json-reporter', ' concise - https://github.com/FloValence/wdio-concise-reporter', ' testrail - https://github.com/oxynade/wdio-testrail-reporter', ' mochawesome - https://github.com/fijijavis/wdio-mochawesome-reporter'];
60
+ var SUPPORTED_SERVICES = [' sauce - https://github.com/webdriverio/wdio-sauce-service', ' browserstack - https://github.com/itszero/wdio-browserstack-service', ' testingbot - https://github.com/testingbot/wdio-testingbot-service', ' appium - https://github.com/rhysd/wdio-appium-service', ' firefox-profile - https://github.com/webdriverio/wdio-firefox-profile-service', ' selenium-standalone - https://github.com/webdriverio/wdio-selenium-standalone-service', ' phantomjs - https://github.com/cognitom/wdio-phantomjs-service', ' static-server - https://github.com/LeadPages/wdio-static-server-service', ' visual-regression - https://github.com/zinserjan/wdio-visual-regression-service', ' webpack - https://github.com/leadpages/wdio-webpack-service', ' webpack-dev-server - https://gitlab.com/Vinnl/wdio-webpack-dev-server-service', ' chromedriver - https://github.com/atti187/wdio-chromedriver-service', ' iedriver - https://github.com/atti187/wdio-iedriver-service', ' docker - https://github.com/stsvilik/wdio-docker-service'];
61
61
 
62
62
  var VERSION = _package2.default.version;
63
63
  var ALLOWED_ARGV = ['host', 'port', 'path', 'user', 'key', 'logLevel', 'coloredLogs', 'screenshotPath', 'baseUrl', 'waitforTimeout', 'framework', 'reporters', 'suite', 'spec', 'cucumberOpts', 'jasmineOpts', 'mochaOpts', 'connectionRetryTimeout', 'connectionRetryCount', 'watch'];
64
64
 
65
- _optimist2.default.usage('WebdriverIO CLI runner\n\n' + 'Usage: wdio [options] [configFile]\n' + 'Usage: wdio config\n' + 'Usage: wdio repl [browserName]\n' + 'config file defaults to wdio.conf.js\n' + 'The [options] object will override values from the config file.\n' + 'An optional list of spec files can be piped to wdio that will override configured specs.').describe('help', 'prints WebdriverIO help menu').alias('help', 'h').describe('version', 'prints WebdriverIO version').alias('version', 'v').describe('host', 'Selenium server host address').describe('port', 'Selenium server port').describe('path', 'Selenium server path (default: /wd/hub)').describe('user', 'username if using a cloud service as Selenium backend').alias('user', 'u').describe('key', 'corresponding access key to the user').alias('key', 'k').describe('watch', 'watch specs for changes').describe('logLevel', 'level of logging verbosity (default: silent)').alias('logLevel', 'l').describe('coloredLogs', 'if true enables colors for log output (default: true)').alias('coloredLogs', 'c').describe('bail', 'stop test runner after specific amount of tests have failed (default: 0 - don\'t bail)').describe('screenshotPath', 'saves a screenshot to a given path if a command fails').alias('screenshotPath', 's').describe('baseUrl', 'shorten url command calls by setting a base url').alias('baseUrl', 'b').describe('waitforTimeout', 'timeout for all waitForXXX commands (default: 1000ms)').alias('waitforTimeout', 'w').describe('framework', 'defines the framework (Mocha, Jasmine or Cucumber) to run the specs (default: mocha)').alias('framework', 'f').describe('reporters', 'reporters to print out the results on stdout').alias('reporters', 'r').describe('suite', 'overwrites the specs attribute and runs the defined suite').describe('spec', 'run only a certain spec file - overrides specs piped from stdin').describe('cucumberOpts.*', 'Cucumber options, see the full list options at https://github.com/webdriverio/wdio-cucumber-framework#cucumberopts-options').describe('jasmineOpts.*', 'Jasmine options, see the full list options at https://github.com/webdriverio/wdio-jasmine-framework#jasminenodeopts-options').describe('mochaOpts.*', 'Mocha options, see the full list options at http://mochajs.org').string(['host', 'path', 'user', 'key', 'logLevel', 'screenshotPath', 'baseUrl', 'framework', 'reporters', 'suite', 'spec']).boolean(['coloredLogs', 'watch']).default({ coloredLogs: true }).check(function (arg) {
65
+ _optimist2.default.usage('WebdriverIO CLI runner\n\n' + 'Usage: wdio [options] [configFile]\n' + 'Usage: wdio config\n' + 'Usage: wdio repl [browserName]\n' + 'config file defaults to wdio.conf.js\n' + 'The [options] object will override values from the config file.\n' + 'An optional list of spec files can be piped to wdio that will override configured specs.').describe('help', 'prints WebdriverIO help menu').alias('help', 'h').describe('version', 'prints WebdriverIO version').alias('version', 'v').describe('host', 'Selenium server host address').describe('port', 'Selenium server port').describe('path', 'Selenium server path (default: /wd/hub)').describe('user', 'username if using a cloud service as Selenium backend').alias('user', 'u').describe('key', 'corresponding access key to the user').alias('key', 'k').describe('watch', 'watch specs for changes').describe('logLevel', 'level of logging verbosity (default: silent)').alias('logLevel', 'l').describe('coloredLogs', 'if true enables colors for log output (default: true)').alias('coloredLogs', 'c').describe('bail', 'stop test runner after specific amount of tests have failed (default: 0 - don\'t bail)').describe('screenshotPath', 'saves a screenshot to a given path if a command fails').alias('screenshotPath', 's').describe('baseUrl', 'shorten url command calls by setting a base url').alias('baseUrl', 'b').describe('waitforTimeout', 'timeout for all waitForXXX commands (default: 1000ms)').alias('waitforTimeout', 'w').describe('framework', 'defines the framework (Mocha, Jasmine or Cucumber) to run the specs (default: mocha)').alias('framework', 'f').describe('reporters', 'reporters to print out the results on stdout').alias('reporters', 'r').describe('suite', 'overwrites the specs attribute and runs the defined suite').describe('spec', 'specifies spec file(s) to run or filter(s) for specs defined in the specs attribute').describe('cucumberOpts.*', 'Cucumber options, see the full list options at https://github.com/webdriverio/wdio-cucumber-framework#cucumberopts-options').describe('jasmineOpts.*', 'Jasmine options, see the full list options at https://github.com/webdriverio/wdio-jasmine-framework#jasminenodeopts-options').describe('mochaOpts.*', 'Mocha options, see the full list options at http://mochajs.org').string(['host', 'path', 'user', 'key', 'logLevel', 'screenshotPath', 'baseUrl', 'framework', 'reporters', 'suite', 'spec']).boolean(['coloredLogs', 'watch']).default({ coloredLogs: true }).check(function (arg) {
66
66
  if (arg._.length > 1 && arg._[0] !== 'repl') {
67
67
  throw new Error('Error: more than one config file specified');
68
68
  }
@@ -237,7 +237,7 @@ WDIO Configuration Helper
237
237
  message: 'In which directory should the xunit reports get stored?',
238
238
  default: './',
239
239
  when: function when(answers) {
240
- return answers.reporters === 'junit';
240
+ return answers.reporters.indexOf('junit') !== -1;
241
241
  }
242
242
  }, {
243
243
  type: 'input',
@@ -245,7 +245,15 @@ WDIO Configuration Helper
245
245
  message: 'In which directory should the json reports get stored?',
246
246
  default: './',
247
247
  when: function when(answers) {
248
- return answers.reporters === 'json';
248
+ return answers.reporters.indexOf('json') !== -1;
249
+ }
250
+ }, {
251
+ type: 'input',
252
+ name: 'outputDir',
253
+ message: 'In which directory should the mochawesome json reports get stored?',
254
+ default: './',
255
+ when: function when(answers) {
256
+ return answers.reporters.indexOf('mochawesome') !== -1;
249
257
  }
250
258
  }, {
251
259
  type: 'list',
@@ -102,7 +102,7 @@ var getElementSize = function getElementSize(selector, prop) {
102
102
  *
103
103
  * @alias browser.getElementSize
104
104
  * @param {String} selector element with requested size
105
- * @param {String*} prop size to receive (optional "width|height")
105
+ * @param {String*} prop size to receive [optional] ("width" or "height")
106
106
  * @return {Object|Number} requested element size (`{ width: <Number>, height: <Number> }`) or actual width/height as number if prop param is given
107
107
  * @uses protocol/elements, protocol/elementIdSize
108
108
  * @type property
@@ -23,7 +23,7 @@ var getValue = function getValue(selector) {
23
23
  throw new _ErrorHandler.CommandError(7, selector || _this.lastResult.selector);
24
24
  }
25
25
 
26
- var elementIdAttributeCommands = [];
26
+ var elementIdPropertyCommands = [];
27
27
  var _iteratorNormalCompletion = true;
28
28
  var _didIteratorError = false;
29
29
  var _iteratorError = undefined;
@@ -32,7 +32,7 @@ var getValue = function getValue(selector) {
32
32
  for (var _iterator = (0, _getIterator3.default)(res.value), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
33
33
  var elem = _step.value;
34
34
 
35
- elementIdAttributeCommands.push(_this.elementIdAttribute(elem.ELEMENT, 'value'));
35
+ elementIdPropertyCommands.push(_this.elementIdProperty(elem.ELEMENT, 'value'));
36
36
  }
37
37
  } catch (err) {
38
38
  _didIteratorError = true;
@@ -49,7 +49,7 @@ var getValue = function getValue(selector) {
49
49
  }
50
50
  }
51
51
 
52
- return _this.unify(elementIdAttributeCommands, {
52
+ return _this.unify(elementIdPropertyCommands, {
53
53
  extractValue: true
54
54
  });
55
55
  });
@@ -73,7 +73,7 @@ var getValue = function getValue(selector) {
73
73
  * @alias browser.getValue
74
74
  * @param {String} selector input, textarea, or select element
75
75
  * @return {String} requested input value
76
- * @uses protocol/elements, protocol/elementIdAttribute
76
+ * @uses protocol/elements, protocol/elementIdProperty
77
77
  * @type property
78
78
  *
79
79
  */
@@ -67,12 +67,20 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
67
67
  'release'
68
68
  ])
69
69
 
70
+ // multi action using x y variables
71
+ // moveTo location is relative from the starting coordinate
72
+ browser.touchAction([
73
+ { action: 'press', x: 20, y: 550 },
74
+ { action: 'moveTo', x: 0, y: -500},
75
+ 'release'
76
+ ])
77
+
70
78
  // drag&drop to element
71
79
  screen.touchAction([
72
80
  'press',
73
81
  { action: 'moveTo', selector: '//UIAApplication[1]/UIAElement[2]' },
74
82
  'release'
75
- ]))
83
+ ])
76
84
  });
77
85
 
78
86
  :multiTouchAction.js
@@ -80,7 +88,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
80
88
  // drag&drop with two fingers 200px down
81
89
  browser.touchAction([
82
90
  [{action: 'press', x: 10, y: 10}, { action: 'moveTo', x: 0, y: 200 }, 'release'],
83
- [{action: 'press', x: 100, y: 10}, { action: 'moveTo', x: 0, y: 200 }, 'release']]
91
+ [{action: 'press', x: 100, y: 10}, { action: 'moveTo', x: 0, y: 200 }, 'release']
84
92
  ])
85
93
  })
86
94
  * </example>
@@ -15,13 +15,6 @@ function isSuccessfulResponse() {
15
15
  body = _ref.body,
16
16
  statusCode = _ref.statusCode;
17
17
 
18
- /**
19
- * check status code
20
- */
21
- if (statusCode === 200) {
22
- return true;
23
- }
24
-
25
18
  /**
26
19
  * response contains a body
27
20
  */
@@ -44,6 +37,13 @@ function isSuccessfulResponse() {
44
37
  return false;
45
38
  }
46
39
 
40
+ /**
41
+ * check status code
42
+ */
43
+ if (statusCode === 200) {
44
+ return true;
45
+ }
46
+
47
47
  /**
48
48
  * that has no error property (Appium only)
49
49
  */
@@ -62,7 +62,7 @@ function isUnknownCommand(err) {
62
62
  /**
63
63
  * when running browser driver directly
64
64
  */
65
- if (err.message.match(/(did not match a known command|unknown command)/)) {
65
+ if (err.message.match(/Invalid Command Method/) || err.message.match(/did not match a known command/) || err.message.match(/unknown command/) || err.message.match(/Driver info: driver\.version: unknown/) || err.message.match(/Method has not yet been implemented/) || err.message.match(/did not map to a valid resource/)) {
66
66
  return true;
67
67
  }
68
68
 
@@ -273,13 +273,13 @@ exports.config = {
273
273
  // beforeHook: function () {
274
274
  // },
275
275
  /**
276
- * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
276
+ * Hook that gets executed _after_ a hook within the suite ends (e.g. runs after calling
277
277
  * afterEach in Mocha)
278
278
  */
279
279
  // afterHook: function () {
280
280
  // },
281
281
  /**
282
- * Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
282
+ * Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) ends.
283
283
  * @param {Object} test test details
284
284
  */
285
285
  // afterTest: function (test) {
@@ -559,18 +559,21 @@ var Launcher = function () {
559
559
  var debugHost = '';
560
560
  var debugPort = process.debugPort;
561
561
  for (var i in process.execArgv) {
562
- var _process$execArgv$i$m = process.execArgv[i].match('--(debug|inspect)(?:-brk)?(?:=(.*):)?'),
563
- _process$execArgv$i$m2 = (0, _slicedToArray3.default)(_process$execArgv$i$m, 3),
564
- type = _process$execArgv$i$m2[1],
565
- host = _process$execArgv$i$m2[2];
566
-
567
- if (type) {
568
- debugType = type;
569
- }
570
- if (host) {
571
- debugHost = `${host}:`;
562
+ var _debugArgs = process.execArgv[i].match('--(debug|inspect)(?:-brk)?(?:=(.*):)?');
563
+ if (_debugArgs) {
564
+ var _debugArgs2 = (0, _slicedToArray3.default)(_debugArgs, 3),
565
+ type = _debugArgs2[1],
566
+ host = _debugArgs2[2];
567
+
568
+ if (type) {
569
+ debugType = type;
570
+ }
571
+ if (host) {
572
+ debugHost = `${host}:`;
573
+ }
572
574
  }
573
575
  }
576
+
574
577
  if (debugType) {
575
578
  debugArgs.push(`--${debugType}=${debugHost}${debugPort + processNumber}`);
576
579
  }
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = elementIdProperty;
7
+
8
+ var _ErrorHandler = require('../utils/ErrorHandler');
9
+
10
+ var _utilities = require('../helpers/utilities');
11
+
12
+ /**
13
+ *
14
+ * Get the value of an element's property.
15
+ *
16
+ * @param {String} ID ID of a WebElement JSON object to route the command to
17
+ * @param {String} propertyName property name of element you want to receive
18
+ *
19
+ * @return {String|null} The value of the property, or null if it is not set on the element.
20
+ *
21
+ * @see https://w3c.github.io/webdriver/webdriver-spec.html#dfn-get-element-property
22
+ * @type protocol
23
+ *
24
+ */
25
+
26
+ function elementIdProperty(id, propertyName) {
27
+ var _this = this;
28
+
29
+ if (typeof id !== 'string' && typeof id !== 'number' || typeof propertyName !== 'string') {
30
+ throw new _ErrorHandler.ProtocolError('number or type of arguments don\'t agree with elementIdProperty protocol command');
31
+ }
32
+
33
+ return this.requestHandler.create(`/session/:sessionId/element/${id}/property/${propertyName}`).catch(function (err) {
34
+ /**
35
+ * use old path if W3C path failed
36
+ */
37
+ if ((0, _utilities.isUnknownCommand)(err)) {
38
+ return _this.elementIdAttribute(id, propertyName);
39
+ }
40
+
41
+ throw err;
42
+ });
43
+ }
44
+ module.exports = exports['default'];
@@ -95,9 +95,6 @@ module.exports = function keys(value) {
95
95
  * [here](https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions).
96
96
  * To do that, the value has to correspond to a key from the table.
97
97
  *
98
- * This command is deprecated and will be removed soon. Make sure you don't use it in your
99
- * automation/test scripts anymore to avoid errors.
100
- *
101
98
  * @param {String|String[]} value The sequence of keys to type. An array must be provided. The server should flatten the array items to a single string to be typed.
102
99
  *
103
100
  * @see https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidkeys
@@ -23,6 +23,9 @@ exports.default = toggleTouchIdEnrollment;
23
23
  *
24
24
  */
25
25
  function toggleTouchIdEnrollment() {
26
- return this.requestHandler.create('session/:session_id/appium/simulator/toggle_touch_id_enrollment');
26
+ return this.requestHandler.create({
27
+ path: '/session/:sessionId/appium/simulator/toggle_touch_id_enrollment',
28
+ method: 'POST'
29
+ });
27
30
  }
28
31
  module.exports = exports['default'];
@@ -28,6 +28,9 @@ exports.default = touchId;
28
28
  function touchId() {
29
29
  var match = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
30
30
 
31
- return this.requestHandler.create('/session/:sessionId/appium/simulator/touch_id', { match });
31
+ return this.requestHandler.create({
32
+ path: '/session/:sessionId/appium/simulator/touch_id',
33
+ method: 'POST'
34
+ }, { match });
32
35
  }
33
36
  module.exports = exports['default'];
@@ -215,7 +215,7 @@ var BaseReporter = function (_events$EventEmitter) {
215
215
  (0, _createClass3.default)(BaseReporter, [{
216
216
  key: 'color',
217
217
  value: function color(type, str) {
218
- if (!_supportsColor2.default) return String(str);
218
+ if (!_supportsColor2.default.stdout) return String(str);
219
219
  return `\u001b[${COLORS[type]}m${str}\u001b[0m`;
220
220
  }
221
221
  }, {
@@ -4,6 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
8
+
9
+ var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
10
+
11
+ var _set = require('babel-runtime/core-js/set');
12
+
13
+ var _set2 = _interopRequireDefault(_set);
14
+
7
15
  var _getIterator2 = require('babel-runtime/core-js/get-iterator');
8
16
 
9
17
  var _getIterator3 = _interopRequireDefault(_getIterator2);
@@ -194,6 +202,8 @@ var ConfigParser = function () {
194
202
  }, {
195
203
  key: 'merge',
196
204
  value: function merge() {
205
+ var _this = this;
206
+
197
207
  var object = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
198
208
 
199
209
  this._config = (0, _deepmerge2.default)(this._config, object, MERGE_OPTIONS);
@@ -212,44 +222,59 @@ var ConfigParser = function () {
212
222
  this._capabilities = (0, _deepmerge2.default)(this._capabilities, this._config.capabilities || defaultTo, MERGE_OPTIONS);
213
223
 
214
224
  /**
215
- * run single spec file only, regardless of multiple-spec specification
225
+ * run only specified spec files, regardless of multiple-spec specification
226
+ * If spec is a file on disk, it is set as the current spec, if it is not, it
227
+ * is treated as a string match filter for the multiple-spec specification.
216
228
  */
217
229
  if (typeof object.spec === 'string') {
218
- var specs = [];
219
- var specList = object.spec.split(/,/g);
220
-
221
- var _iteratorNormalCompletion2 = true;
222
- var _didIteratorError2 = false;
223
- var _iteratorError2 = undefined;
224
-
225
- try {
226
- for (var _iterator2 = (0, _getIterator3.default)(specList), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
227
- var spec = _step2.value;
230
+ (function () {
231
+ var specs = new _set2.default();
232
+ var specList = object.spec.split(/,/g);
233
+ var specsList = ConfigParser.getFilePaths(_this._config.specs);
228
234
 
235
+ var _loop = function _loop(spec) {
229
236
  if (_fs2.default.existsSync(spec)) {
230
- specs.push(_path2.default.resolve(process.cwd(), spec));
237
+ specs.add(_path2.default.resolve(process.cwd(), spec));
238
+ } else {
239
+ specsList.forEach(function (file) {
240
+ if (file.match(spec)) {
241
+ specs.add(file);
242
+ }
243
+ });
231
244
  }
232
- }
233
- } catch (err) {
234
- _didIteratorError2 = true;
235
- _iteratorError2 = err;
236
- } finally {
245
+ };
246
+
247
+ var _iteratorNormalCompletion2 = true;
248
+ var _didIteratorError2 = false;
249
+ var _iteratorError2 = undefined;
250
+
237
251
  try {
238
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
239
- _iterator2.return();
252
+ for (var _iterator2 = (0, _getIterator3.default)(specList), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
253
+ var spec = _step2.value;
254
+
255
+ _loop(spec);
240
256
  }
257
+ } catch (err) {
258
+ _didIteratorError2 = true;
259
+ _iteratorError2 = err;
241
260
  } finally {
242
- if (_didIteratorError2) {
243
- throw _iteratorError2;
261
+ try {
262
+ if (!_iteratorNormalCompletion2 && _iterator2.return) {
263
+ _iterator2.return();
264
+ }
265
+ } finally {
266
+ if (_didIteratorError2) {
267
+ throw _iteratorError2;
268
+ }
244
269
  }
245
270
  }
246
- }
247
271
 
248
- if (specs.length === 0) {
249
- throw new Error(`spec file ${object.spec} not found`);
250
- }
272
+ if (specs.size === 0) {
273
+ throw new Error(`spec file ${object.spec} not found`);
274
+ }
251
275
 
252
- this._config.specs = specs;
276
+ _this._config.specs = [].concat((0, _toConsumableArray3.default)(specs));
277
+ })();
253
278
  }
254
279
 
255
280
  /**
@@ -380,7 +405,7 @@ var ConfigParser = function () {
380
405
  throw new Error(`The suite(s) "${suites.join('", "')}" you specified don't exist ` + 'in your config file or doesn\'t contain any files!');
381
406
  }
382
407
 
383
- specs = suiteSpecs;
408
+ specs = typeof this._config.spec === `string` ? [].concat((0, _toConsumableArray3.default)(specs), (0, _toConsumableArray3.default)(suiteSpecs)) : suiteSpecs;
384
409
  }
385
410
 
386
411
  if (Array.isArray(capSpecs)) {
@@ -448,7 +448,7 @@ var ReporterStats = function (_RunnableStats6) {
448
448
  }
449
449
 
450
450
  try {
451
- testStats = this.getTestStats(runner);
451
+ testStats = this.getTestStats(runner) || {};
452
452
  } catch (e) {
453
453
  // If a test fails during the before() or beforeEach() hook, it will not yet
454
454
  // have been 'started', so start now
@@ -502,6 +502,9 @@ var ReporterStats = function (_RunnableStats6) {
502
502
  value: function testEnd(runner) {
503
503
  this.getTestStats(runner).complete();
504
504
  this.counts.tests++;
505
+ if (runner.context) {
506
+ this.getTestStats(runner).context = runner.context;
507
+ }
505
508
  }
506
509
  }, {
507
510
  key: 'suiteEnd',
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "webdriverio",
3
3
  "description": "A Node.js bindings implementation for the W3C WebDriver protocol",
4
- "version": "4.9.10",
4
+ "version": "4.10.2",
5
5
  "homepage": "http://webdriver.io",
6
6
  "author": "Camilo Tapia <camilo.tapia@gmail.com>",
7
7
  "repository": {
@@ -122,7 +122,7 @@ Type: `Boolean`<br>
122
122
  Default: *true*
123
123
 
124
124
  ### bail
125
- If you only want to run your tests until a specific amount of tests have failed use bail (default is 0 - don't bail, run all tests).
125
+ If you only want to run your tests until a specific amount of tests have failed use bail (default is 0 - don't bail, run all tests). _Note_: Please be aware that when using a third party test runner such as Mocha, additional configuration might be required.
126
126
 
127
127
  Type: `Number`<br>
128
128
  Default: *0* (don't bail, run all tests)
@@ -60,7 +60,7 @@ Apply and restart the Jenkins server. All assets should now be served correctly.
60
60
  Install the [Allure command-line tool](https://www.npmjs.com/package/allure-commandline), and process the results directory:
61
61
 
62
62
  ```sh
63
- $ allure generate [allure_output_dir] && allure report open
63
+ $ allure generate [allure_output_dir] && allure open
64
64
  ```
65
65
 
66
66
  This will generate a report (by default in `./allure-report`), and open it in your browser:
@@ -8,7 +8,7 @@ title: WebdriverIO - Dot Reporter
8
8
  Dot Reporter
9
9
  ============
10
10
 
11
- The dot reporter is the default reporter for the WDIO test runner. It's therefor a dependency of WebdriverIO and doesn't need to get downloaded. To use the dot reporter just add `'dot'` to the `reporters` array:
11
+ The dot reporter is the default reporter for the WDIO test runner. It's therefore a dependency of WebdriverIO and doesn't need to get downloaded. To use the dot reporter just add `'dot'` to the `reporters` array:
12
12
 
13
13
  ```js
14
14
  // wdio.conf.js
@@ -0,0 +1,67 @@
1
+ name: mochawesome
2
+ category: reporters
3
+ tags: guide
4
+ index: 8
5
+ title: WebdriverIO - Mochawesome Reporter
6
+ ---
7
+
8
+ WDIO Mochawesome Reporter
9
+ =========================
10
+
11
+ Generates test results in the json formated needed to create [Mochawesome](https://github.com/adamgruber/mochawesome) reports.
12
+
13
+
14
+ ## Installation
15
+
16
+ ```shell
17
+ npm install --save wdio-mochawesome-reporter
18
+ ```
19
+
20
+ A dependency will be added to your `package.json`
21
+
22
+ ```json
23
+ {
24
+ "dependencies": {
25
+ "wdio-mochawesome-reporter": "^1.0.0"
26
+ }
27
+ }
28
+ ```
29
+
30
+ ## Using
31
+
32
+ Add to the list of reporters.
33
+
34
+ ```js
35
+ // sample wdio.conf.js
36
+ module.exports = {
37
+ // ...
38
+ reporters: ['dot', 'mochawesome'],
39
+ reporterOptions: {
40
+ outputDir: './', //json file will be written to this directory
41
+ mochawesome_filename: 'myfile.json' //will default to wdiomochawesome.json if no name is provided
42
+ },
43
+
44
+ // ...
45
+ };
46
+ ```
47
+
48
+
49
+
50
+ ## Mochawesome Report Generator
51
+ To convert the json generated by this package into a Mochawesome report you will need to use the [Mochawesome Report Generator](https://github.com/adamgruber/mochawesome-report-generator).
52
+
53
+ In summary...
54
+
55
+ * Add the package to your project
56
+ ```shell
57
+ npm install --save mochawesome-report-generator
58
+ ```
59
+
60
+ * Add a script to your package.json to generate the report
61
+ ```json
62
+ "scripts": {
63
+ "generateMochawesome":"marge path/to/results.json --reportTitle 'My Project Results'"
64
+ },
65
+ ```
66
+ 1) `path/to/results.json` = path and name of json file
67
+ 2) `--reportTitle 'My Project Results' = unique report title