wdio.base.conf.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. const glob = require('glob').sync
  2. const path = require('path')
  3. const suites = {}
  4. glob('test/endtoend/*/test.js').forEach((file) => {
  5. const name = path.basename(path.dirname(file))
  6. suites[name] = [file]
  7. })
  8. exports.config = {
  9. // ==================
  10. // Specify Test Files
  11. // ==================
  12. // Define which test specs should run. The pattern is relative to the directory
  13. // from which `wdio` was called. Notice that, if you are calling `wdio` from an
  14. // NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
  15. // directory is where your package.json resides, so `wdio` will be called from there.
  16. //
  17. specs: [
  18. 'test/endtoend/*/test.js'
  19. ],
  20. // Patterns to exclude.
  21. exclude: [
  22. // 'path/to/excluded/files'
  23. ],
  24. // Suites allows you to do `wdio config.js --suite $name` to run a subset of tests.
  25. suites,
  26. // ============
  27. // Capabilities
  28. // ============
  29. // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
  30. // time. Depending on the number of capabilities, WebdriverIO launches several test
  31. // sessions. Within your capabilities you can overwrite the spec and exclude options in
  32. // order to group specific specs to a specific capability.
  33. //
  34. // First, you can define how many instances should be started at the same time. Let's
  35. // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
  36. // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
  37. // files and you set maxInstances to 10, all spec files will get tested at the same time
  38. // and 30 processes will get spawned. The property handles how many capabilities
  39. // from the same test should run tests.
  40. maxInstances: 5,
  41. // ===================
  42. // Test Configurations
  43. // ===================
  44. // Define all options that are relevant for the WebdriverIO instance here
  45. //
  46. // By default WebdriverIO commands are executed in a synchronous way using
  47. // the wdio-sync package. If you still want to run your tests in an async way
  48. // e.g. using promises you can set the sync option to false.
  49. sync: true,
  50. // Level of logging verbosity: silent | verbose | command | data | result | error
  51. logLevel: 'silent',
  52. // Enables colors for log output.
  53. coloredLogs: true,
  54. // If you only want to run your tests until a specific amount of tests have failed use
  55. // bail (default is 0 - don't bail, run all tests).
  56. bail: 0,
  57. // Saves a screenshot to a given path if a command fails.
  58. // screenshotPath: './endtoend/screenshots',
  59. //
  60. // Set a base URL in order to shorten url command calls. If your url parameter starts
  61. // with "/", then the base url gets prepended.
  62. baseUrl: 'http://localhost',
  63. // Default timeout for all waitFor* commands.
  64. waitforTimeout: 10000,
  65. // Default timeout in milliseconds for request
  66. // if Selenium Grid doesn't send response
  67. connectionRetryTimeout: 90000,
  68. // Default request retries count
  69. connectionRetryCount: 3,
  70. // Test runner services
  71. // Services take over a specific job you don't want to take care of. They enhance
  72. // your test setup with almost no effort. Unlike plugins, they don't add new
  73. // commands. Instead, they hook themselves up into the test process.
  74. services: ['static-server'],
  75. staticServerFolders: [
  76. { mount: '/i18n-drag-drop', path: './test/endtoend/i18n-drag-drop/dist' },
  77. { mount: '/tus-drag-drop', path: './test/endtoend/tus-drag-drop/dist' },
  78. { mount: '/xhr-limit', path: './test/endtoend/xhr-limit/dist' },
  79. { mount: '/providers', path: './test/endtoend/providers/dist' },
  80. { mount: '/thumbnails', path: './test/endtoend/thumbnails/dist' },
  81. { mount: '/transloadit', path: './test/endtoend/transloadit/dist' },
  82. { mount: '/create-react-app', path: './test/endtoend/create-react-app/build' }
  83. ],
  84. // Framework you want to run your specs with.
  85. // The following are supported: Mocha, Jasmine, and Cucumber
  86. // see also: http://webdriver.io/guide/testrunner/frameworks.html
  87. //
  88. // Make sure you have the wdio adapter package for the specific framework installed
  89. // before running any tests.
  90. framework: 'mocha',
  91. // Options to be passed to Mocha.
  92. // See the full list at http://mochajs.org/
  93. mochaOpts: {
  94. ui: 'dot',
  95. timeout: 30000
  96. },
  97. /**
  98. * Gets executed before test execution begins. At this point you can access to all global
  99. * variables like `browser`. It is the perfect place to define custom commands.
  100. * @param {Array.<Object>} capabilities list of capabilities details
  101. * @param {Array.<String>} specs List of spec file paths that are to be run
  102. */
  103. before: function (capabilities, specs) {
  104. var chai = require('chai')
  105. global.expect = chai.expect
  106. global.capabilities = capabilities
  107. chai.Should()
  108. }
  109. }