wdio.conf.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. exports.config = {
  2. //
  3. // ====================
  4. // Runner Configuration
  5. // ====================
  6. //
  7. // WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
  8. // on a remote machine).
  9. runner: 'local',
  10. //
  11. // ==================
  12. // Specify Test Files
  13. // ==================
  14. // Define which test specs should run. The pattern is relative to the directory
  15. // from which `wdio` was called. Notice that, if you are calling `wdio` from an
  16. // NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
  17. // directory is where your package.json resides, so `wdio` will be called from there.
  18. //
  19. specs: ['./test/wdio/**/*.js'],
  20. // Patterns to exclude.
  21. exclude: [
  22. // 'path/to/excluded/files'
  23. ],
  24. //
  25. // ============
  26. // Capabilities
  27. // ============
  28. // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
  29. // time. Depending on the number of capabilities, WebdriverIO launches several test
  30. // sessions. Within your capabilities you can overwrite the spec and exclude options in
  31. // order to group specific specs to a specific capability.
  32. //
  33. // First, you can define how many instances should be started at the same time. Let's
  34. // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
  35. // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
  36. // files and you set maxInstances to 10, all spec files will get tested at the same time
  37. // and 30 processes will get spawned. The property handles how many capabilities
  38. // from the same test should run tests.
  39. //
  40. maxInstances: 10,
  41. //
  42. // If you have trouble getting all important capabilities together, check out the
  43. // Sauce Labs platform configurator - a great tool to configure your capabilities:
  44. // https://docs.saucelabs.com/reference/platforms-configurator
  45. //
  46. capabilities: [
  47. {
  48. // maxInstances can get overwritten per capability. So if you have an in-house Selenium
  49. // grid with only 5 firefox instances available you can make sure that not more than
  50. // 5 instances get started at a time.
  51. maxInstances: 5,
  52. //
  53. browserName: 'chrome',
  54. acceptInsecureCerts: true
  55. // If outputDir is provided WebdriverIO can capture driver session logs
  56. // it is possible to configure which logTypes to include/exclude.
  57. // excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
  58. // excludeDriverLogs: ['bugreport', 'server'],
  59. },
  60. {
  61. browserName: 'firefox',
  62. 'moz:firefoxOptions': {
  63. binary: `/Applications/Firefox.app/Contents/MacOS/firefox`
  64. }
  65. }
  66. ],
  67. //
  68. // ===================
  69. // Test Configurations
  70. // ===================
  71. // Define all options that are relevant for the WebdriverIO instance here
  72. //
  73. // Level of logging verbosity: trace | debug | info | warn | error | silent
  74. logLevel: 'info',
  75. //
  76. // Set specific log levels per logger
  77. // loggers:
  78. // - webdriver, webdriverio
  79. // - @wdio/applitools-service, @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service
  80. // - @wdio/mocha-framework, @wdio/jasmine-framework
  81. // - @wdio/local-runner
  82. // - @wdio/sumologic-reporter
  83. // - @wdio/cli, @wdio/config, @wdio/sync, @wdio/utils
  84. // Level of logging verbosity: trace | debug | info | warn | error | silent
  85. // logLevels: {
  86. // webdriver: 'info',
  87. // '@wdio/applitools-service': 'info'
  88. // },
  89. //
  90. // If you only want to run your tests until a specific amount of tests have failed use
  91. // bail (default is 0 - don't bail, run all tests).
  92. bail: 0,
  93. //
  94. // Set a base URL in order to shorten url command calls. If your `url` parameter starts
  95. // with `/`, the base url gets prepended, not including the path portion of your baseUrl.
  96. // If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
  97. // gets prepended directly.
  98. baseUrl: 'http//localhost:4000',
  99. //
  100. // Default timeout for all waitFor* commands.
  101. waitforTimeout: 10000,
  102. //
  103. // Default timeout in milliseconds for request
  104. // if browser driver or grid doesn't send response
  105. connectionRetryTimeout: 120000,
  106. //
  107. // Default request retries count
  108. connectionRetryCount: 3,
  109. //
  110. // Test runner services
  111. // Services take over a specific job you don't want to take care of. They enhance
  112. // your test setup with almost no effort. Unlike plugins, they don't add new
  113. // commands. Instead, they hook themselves up into the test process.
  114. services: ['chromedriver'],
  115. // Framework you want to run your specs with.
  116. // The following are supported: Mocha, Jasmine, and Cucumber
  117. // see also: https://webdriver.io/docs/frameworks.html
  118. //
  119. // Make sure you have the wdio adapter package for the specific framework installed
  120. // before running any tests.
  121. framework: 'mocha',
  122. //
  123. // The number of times to retry the entire specfile when it fails as a whole
  124. // specFileRetries: 1,
  125. //
  126. // Delay in seconds between the spec file retry attempts
  127. // specFileRetriesDelay: 0,
  128. //
  129. // Whether or not retried specfiles should be retried immediately or deferred to the end of the queue
  130. // specFileRetriesDeferred: false,
  131. //
  132. // Test reporter for stdout.
  133. // The only one supported by default is 'dot'
  134. // see also: https://webdriver.io/docs/dot-reporter.html
  135. reporters: ['spec'],
  136. //
  137. // Options to be passed to Mocha.
  138. // See the full list at http://mochajs.org/
  139. mochaOpts: {
  140. ui: 'bdd',
  141. timeout: 60000
  142. }
  143. //
  144. // =====
  145. // Hooks
  146. // =====
  147. // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
  148. // it and to build services around it. You can either apply a single function or an array of
  149. // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
  150. // resolved to continue.
  151. /**
  152. * Gets executed once before all workers get launched.
  153. * @param {Object} config wdio configuration object
  154. * @param {Array.<Object>} capabilities list of capabilities details
  155. */
  156. // onPrepare: function (config, capabilities) {
  157. // },
  158. /**
  159. * Gets executed before a worker process is spawned and can be used to initialise specific service
  160. * for that worker as well as modify runtime environments in an async fashion.
  161. * @param {String} cid capability id (e.g 0-0)
  162. * @param {[type]} caps object containing capabilities for session that will be spawn in the worker
  163. * @param {[type]} specs specs to be run in the worker process
  164. * @param {[type]} args object that will be merged with the main configuration once worker is initialised
  165. * @param {[type]} execArgv list of string arguments passed to the worker process
  166. */
  167. // onWorkerStart: function (cid, caps, specs, args, execArgv) {
  168. // },
  169. /**
  170. * Gets executed just before initialising the webdriver session and test framework. It allows you
  171. * to manipulate configurations depending on the capability or spec.
  172. * @param {Object} config wdio configuration object
  173. * @param {Array.<Object>} capabilities list of capabilities details
  174. * @param {Array.<String>} specs List of spec file paths that are to be run
  175. */
  176. // beforeSession: function (config, capabilities, specs) {
  177. // },
  178. /**
  179. * Gets executed before test execution begins. At this point you can access to all global
  180. * variables like `browser`. It is the perfect place to define custom commands.
  181. * @param {Array.<Object>} capabilities list of capabilities details
  182. * @param {Array.<String>} specs List of spec file paths that are to be run
  183. */
  184. // before: function (capabilities, specs) {
  185. // },
  186. /**
  187. * Runs before a WebdriverIO command gets executed.
  188. * @param {String} commandName hook command name
  189. * @param {Array} args arguments that command would receive
  190. */
  191. // beforeCommand: function (commandName, args) {
  192. // },
  193. /**
  194. * Hook that gets executed before the suite starts
  195. * @param {Object} suite suite details
  196. */
  197. // beforeSuite: function (suite) {
  198. // },
  199. /**
  200. * Function to be executed before a test (in Mocha/Jasmine) starts.
  201. */
  202. // beforeTest: function (test, context) {
  203. // },
  204. /**
  205. * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
  206. * beforeEach in Mocha)
  207. */
  208. // beforeHook: function (test, context) {
  209. // },
  210. /**
  211. * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
  212. * afterEach in Mocha)
  213. */
  214. // afterHook: function (test, context, { error, result, duration, passed, retries }) {
  215. // },
  216. /**
  217. * Function to be executed after a test (in Mocha/Jasmine).
  218. */
  219. // afterTest: function(test, context, { error, result, duration, passed, retries }) {
  220. // },
  221. /**
  222. * Hook that gets executed after the suite has ended
  223. * @param {Object} suite suite details
  224. */
  225. // afterSuite: function (suite) {
  226. // },
  227. /**
  228. * Runs after a WebdriverIO command gets executed
  229. * @param {String} commandName hook command name
  230. * @param {Array} args arguments that command would receive
  231. * @param {Number} result 0 - command success, 1 - command error
  232. * @param {Object} error error object if any
  233. */
  234. // afterCommand: function (commandName, args, result, error) {
  235. // },
  236. /**
  237. * Gets executed after all tests are done. You still have access to all global variables from
  238. * the test.
  239. * @param {Number} result 0 - test pass, 1 - test fail
  240. * @param {Array.<Object>} capabilities list of capabilities details
  241. * @param {Array.<String>} specs List of spec file paths that ran
  242. */
  243. // after: function (result, capabilities, specs) {
  244. // },
  245. /**
  246. * Gets executed right after terminating the webdriver session.
  247. * @param {Object} config wdio configuration object
  248. * @param {Array.<Object>} capabilities list of capabilities details
  249. * @param {Array.<String>} specs List of spec file paths that ran
  250. */
  251. // afterSession: function (config, capabilities, specs) {
  252. // },
  253. /**
  254. * Gets executed after all workers got shut down and the process is about to exit. An error
  255. * thrown in the onComplete hook will result in the test run failing.
  256. * @param {Object} exitCode 0 - success, 1 - fail
  257. * @param {Object} config wdio configuration object
  258. * @param {Array.<Object>} capabilities list of capabilities details
  259. * @param {<Object>} results object containing test results
  260. */
  261. // onComplete: function(exitCode, config, capabilities, results) {
  262. // },
  263. /**
  264. * Gets executed when a refresh happens.
  265. * @param {String} oldSessionId session ID of the old session
  266. * @param {String} newSessionId session ID of the new session
  267. */
  268. //onReload: function(oldSessionId, newSessionId) {
  269. //}
  270. };