wdio.shared.conf.ts 9.5 KB

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