wdio.base.conf.js 4.8 KB

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