wdio.local.conf.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. exports.config = {
  2. //
  3. // ==================
  4. // Specify Test Files
  5. // ==================
  6. // Define which test specs should run. The pattern is relative to the directory
  7. // from which `wdio` was called. Notice that, if you are calling `wdio` from an
  8. // NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
  9. // directory is where your package.json resides, so `wdio` will be called from there.
  10. //
  11. specs: [
  12. 'test/endtoend/specs/**/*.js'
  13. ],
  14. // Patterns to exclude.
  15. exclude: [
  16. // 'path/to/excluded/files'
  17. ],
  18. //
  19. // ============
  20. // Capabilities
  21. // ============
  22. // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
  23. // time. Depending on the number of capabilities, WebdriverIO launches several test
  24. // sessions. Within your capabilities you can overwrite the spec and exclude options in
  25. // order to group specific specs to a specific capability.
  26. //
  27. // First, you can define how many instances should be started at the same time. Let's
  28. // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
  29. // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
  30. // files and you set maxInstances to 10, all spec files will get tested at the same time
  31. // and 30 processes will get spawned. The property handles how many capabilities
  32. // from the same test should run tests.
  33. //
  34. maxInstances: 5,
  35. //
  36. // If you have trouble getting all important capabilities together, check out the
  37. // Sauce Labs platform configurator - a great tool to configure your capabilities:
  38. // https://docs.saucelabs.com/reference/platforms-configurator
  39. //
  40. capabilities: [
  41. { browserName: 'firefox' }
  42. // { browserName: 'MicrosoftEdge', version: '14.14393', platform: 'Windows 10' },
  43. // { browserName: 'safari', version: '11.0', platform: 'macOS 10.12' }
  44. ],
  45. //
  46. // ===================
  47. // Test Configurations
  48. // ===================
  49. // Define all options that are relevant for the WebdriverIO instance here
  50. //
  51. // By default WebdriverIO commands are executed in a synchronous way using
  52. // the wdio-sync package. If you still want to run your tests in an async way
  53. // e.g. using promises you can set the sync option to false.
  54. sync: true,
  55. //
  56. // Level of logging verbosity: silent | verbose | command | data | result | error
  57. logLevel: 'silent',
  58. //
  59. // Enables colors for log output.
  60. coloredLogs: true,
  61. //
  62. // If you only want to run your tests until a specific amount of tests have failed use
  63. // bail (default is 0 - don't bail, run all tests).
  64. bail: 0,
  65. //
  66. // Saves a screenshot to a given path if a command fails.
  67. // screenshotPath: './endtoend/screenshots',
  68. //
  69. // Set a base URL in order to shorten url command calls. If your url parameter starts
  70. // with "/", then the base url gets prepended.
  71. baseUrl: 'http://localhost',
  72. //
  73. // Default timeout for all waitFor* commands.
  74. waitforTimeout: 10000,
  75. //
  76. // Default timeout in milliseconds for request
  77. // if Selenium Grid doesn't send response
  78. connectionRetryTimeout: 90000,
  79. //
  80. // Default request retries count
  81. connectionRetryCount: 3,
  82. //
  83. // Initialize the browser instance with a WebdriverIO plugin. The object should have the
  84. // plugin name as key and the desired plugin options as properties. Make sure you have
  85. // the plugin installed before running any tests. The following plugins are currently
  86. // available:
  87. // WebdriverCSS: https://github.com/webdriverio/webdrivercss
  88. // WebdriverRTC: https://github.com/webdriverio/webdriverrtc
  89. // Browserevent: https://github.com/webdriverio/browserevent
  90. // plugins: {
  91. // webdrivercss: {
  92. // screenshotRoot: 'my-shots',
  93. // failedComparisonsRoot: 'diffs',
  94. // misMatchTolerance: 0.05,
  95. // screenWidth: [320,480,640,1024]
  96. // },
  97. // webdriverrtc: {},
  98. // browserevent: {}
  99. // },
  100. //
  101. // Test runner services
  102. // Services take over a specific job you don't want to take care of. They enhance
  103. // your test setup with almost no effort. Unlike plugins, they don't add new
  104. // commands. Instead, they hook themselves up into the test process.
  105. services: ['static-server'],
  106. staticServerFolders: [
  107. { mount: '/', path: './test/endtoend/dist' }
  108. ],
  109. //
  110. // Framework you want to run your specs with.
  111. // The following are supported: Mocha, Jasmine, and Cucumber
  112. // see also: http://webdriver.io/guide/testrunner/frameworks.html
  113. //
  114. // Make sure you have the wdio adapter package for the specific framework installed
  115. // before running any tests.
  116. framework: 'mocha',
  117. //
  118. // Test reporter for stdout.
  119. // The only one supported by default is 'dot'
  120. // see also: http://webdriver.io/guide/testrunner/reporters.html
  121. // reporters: ['dot'],
  122. //
  123. // Options to be passed to Mocha.
  124. // See the full list at http://mochajs.org/
  125. mochaOpts: {
  126. ui: 'dot',
  127. timeout: 30000
  128. },
  129. //
  130. // =====
  131. // Hooks
  132. // =====
  133. // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
  134. // it and to build services around it. You can either apply a single function or an array of
  135. // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
  136. // resolved to continue.
  137. /**
  138. * Gets executed once before all workers get launched.
  139. * @param {Object} config wdio configuration object
  140. * @param {Array.<Object>} capabilities list of capabilities details
  141. */
  142. // onPrepare: function (config, capabilities) {
  143. // },
  144. /**
  145. * Gets executed just before initialising the webdriver session and test framework. It allows you
  146. * to manipulate configurations depending on the capability or spec.
  147. * @param {Object} config wdio configuration object
  148. * @param {Array.<Object>} capabilities list of capabilities details
  149. * @param {Array.<String>} specs List of spec file paths that are to be run
  150. */
  151. // beforeSession: function (config, capabilities, specs) {
  152. // },
  153. /**
  154. * Gets executed before test execution begins. At this point you can access to all global
  155. * variables like `browser`. It is the perfect place to define custom commands.
  156. * @param {Array.<Object>} capabilities list of capabilities details
  157. * @param {Array.<String>} specs List of spec file paths that are to be run
  158. */
  159. before: function (capabilities, specs) {
  160. var chai = require('chai')
  161. global.expect = chai.expect
  162. global.capabilities = capabilities
  163. chai.Should()
  164. }
  165. //
  166. /**
  167. * Hook that gets executed before the suite starts
  168. * @param {Object} suite suite details
  169. */
  170. // beforeSuite: function (suite) {
  171. // },
  172. /**
  173. * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
  174. * beforeEach in Mocha)
  175. */
  176. // beforeHook: function () {
  177. // },
  178. /**
  179. * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
  180. * afterEach in Mocha)
  181. */
  182. // afterHook: function () {
  183. // },
  184. /**
  185. * Function to be executed before a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
  186. * @param {Object} test test details
  187. */
  188. // beforeTest: function (test) {
  189. // },
  190. /**
  191. * Runs before a WebdriverIO command gets executed.
  192. * @param {String} commandName hook command name
  193. * @param {Array} args arguments that command would receive
  194. */
  195. // beforeCommand: function (commandName, args) {
  196. // },
  197. /**
  198. * Runs after a WebdriverIO command gets executed
  199. * @param {String} commandName hook command name
  200. * @param {Array} args arguments that command would receive
  201. * @param {Number} result 0 - command success, 1 - command error
  202. * @param {Object} error error object if any
  203. */
  204. // afterCommand: function (commandName, args, result, error) {
  205. // },
  206. /**
  207. * Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
  208. * @param {Object} test test details
  209. */
  210. // afterTest: function (test) {
  211. // },
  212. /**
  213. * Hook that gets executed after the suite has ended
  214. * @param {Object} suite suite details
  215. */
  216. // afterSuite: function (suite) {
  217. // },
  218. /**
  219. * Gets executed after all tests are done. You still have access to all global variables from
  220. * the test.
  221. * @param {Number} result 0 - test pass, 1 - test fail
  222. * @param {Array.<Object>} capabilities list of capabilities details
  223. * @param {Array.<String>} specs List of spec file paths that ran
  224. */
  225. // after: function (result, capabilities, specs) {
  226. // },
  227. /**
  228. * Gets executed right after terminating the webdriver session.
  229. * @param {Object} config wdio configuration object
  230. * @param {Array.<Object>} capabilities list of capabilities details
  231. * @param {Array.<String>} specs List of spec file paths that ran
  232. */
  233. // afterSession: function (config, capabilities, specs) {
  234. // },
  235. /**
  236. * Gets executed after all workers got shut down and the process is about to exit. It is not
  237. * possible to defer the end of the process using a promise.
  238. * @param {Object} exitCode 0 - success, 1 - fail
  239. */
  240. // onComplete: function(exitCode) {
  241. // }
  242. }