Advertisement
Guest User

Untitled

a guest
Aug 14th, 2020
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.16 KB | None | 0 0
  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. hostname: 'http://login:[email protected]/hub',
  12. port: 80,
  13. path: '/',
  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: [
  24. './test/specs/**/*.js'
  25. ],
  26.  
  27. suites: {
  28. login: [
  29. './test/specs/login/*.js',
  30. ],
  31.  
  32. search: [
  33. './test/specs/search/*.js',
  34. ],
  35.  
  36. articles: [
  37. './test/specs/articles/*.js',
  38. ],
  39.  
  40. password_recovery: [
  41. './test/specs/password.recovery/*.js'
  42. ],
  43.  
  44. brands: [
  45. './test/specs/brands/*.js'
  46. ],
  47.  
  48. partners: [
  49. './test/specs/partners/*.js'
  50. ],
  51.  
  52. sale: [
  53. './test/specs/sale/*.js'
  54. ],
  55.  
  56. main: [
  57. './test/specs/main/*.js'
  58. ],
  59.  
  60. stock: [
  61. './test/specs/stock/*.js'
  62. ]
  63. },
  64.  
  65.  
  66. // Patterns to exclude.
  67. exclude: [
  68. // 'path/to/excluded/files'
  69. ],
  70. //
  71. // ============
  72. // Capabilities
  73. // ============
  74. // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
  75. // time. Depending on the number of capabilities, WebdriverIO launches several test
  76. // sessions. Within your capabilities you can overwrite the spec and exclude options in
  77. // order to group specific specs to a specific capability.
  78. //
  79. // First, you can define how many instances should be started at the same time. Let's
  80. // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
  81. // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
  82. // files and you set maxInstances to 10, all spec files will get tested at the same time
  83. // and 30 processes will get spawned. The property handles how many capabilities
  84. // from the same test should run tests.
  85. //
  86. maxInstances: 10,
  87. //
  88. // If you have trouble getting all important capabilities together, check out the
  89. // Sauce Labs platform configurator - a great tool to configure your capabilities:
  90. // https://docs.saucelabs.com/reference/platforms-configurator
  91. //
  92. capabilities: [{
  93.  
  94. // maxInstances can get overwritten per capability. So if you have an in-house Selenium
  95. // grid with only 5 firefox instances available you can make sure that not more than
  96. // 5 instances get started at a time.
  97. maxInstances: 1,
  98. //
  99. browserName: 'chrome',
  100. browserVersion: '83.0',
  101. 'goog:chromeOptions': {},
  102. 'selenoid:options' : {
  103. 'enableVNC': true,
  104. 'enableVideo': false,
  105. 'screenResolution': '1920x1080'
  106. }
  107. //},
  108. // {
  109. // browserName: 'firefox',
  110. // browserVersion: '76.0',
  111. // 'goog:chromeOptions': {},
  112. // 'selenoid:options' : {
  113. // 'enableVNC': true,
  114. // 'enableVideo': false,
  115. // 'screenResolution': '1920x1080'
  116. // }
  117. // },
  118.  
  119. // {
  120. // browserName: 'opera',
  121. // browserVersion: '68.0',
  122. // 'goog:chromeOptions': {},
  123. // 'selenoid:options' : {
  124. // 'enableVNC': true,
  125. // 'enableVideo': false,
  126. // 'screenResolution': '1920x1080'
  127. // }
  128.  
  129.  
  130.  
  131. //acceptInsecureCerts: true
  132. // If outputDir is provided WebdriverIO can capture driver session logs
  133. // it is possible to configure which logTypes to include/exclude.
  134. // excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
  135. // excludeDriverLogs: ['bugreport', 'server'],
  136. }],
  137. //
  138. // ===================
  139. // Test Configurations
  140. // ===================
  141. // Define all options that are relevant for the WebdriverIO instance here
  142. //
  143. // Level of logging verbosity: trace | debug | info | warn | error | silent
  144. logLevel: 'error',
  145. //
  146. // Set specific log levels per logger
  147. // loggers:
  148. // - webdriver, webdriverio
  149. // - @wdio/applitools-service, @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service
  150. // - @wdio/mocha-framework, @wdio/jasmine-framework
  151. // - @wdio/local-runner, @wdio/lambda-runner
  152. // - @wdio/sumologic-reporter
  153. // - @wdio/cli, @wdio/config, @wdio/sync, @wdio/utils
  154. // Level of logging verbosity: trace | debug | info | warn | error | silent
  155. // logLevels: {
  156. // webdriver: 'info',
  157. // '@wdio/applitools-service': 'info'
  158. // },
  159. //
  160. // If you only want to run your tests until a specific amount of tests have failed use
  161. // bail (default is 0 - don't bail, run all tests).
  162. bail: 0,
  163. //
  164. // Set a base URL in order to shorten url command calls. If your `url` parameter starts
  165. // with `/`, the base url gets prepended, not including the path portion of your baseUrl.
  166. // If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
  167. // gets prepended directly.
  168. baseUrl: '/',
  169. // Default timeout for all waitFor* commands.
  170. waitforTimeout: 10000,
  171. //
  172. // Default timeout in milliseconds for request
  173. // if browser driver or grid doesn't send response
  174. connectionRetryTimeout: 120000,
  175. //
  176. // Default request retries count
  177. connectionRetryCount: 3,
  178. //
  179. // Test runner services
  180. // Services take over a specific job you don't want to take care of. They enhance
  181. // your test setup with almost no effort. Unlike plugins, they don't add new
  182. // commands. Instead, they hook themselves up into the test process.
  183. services: [],
  184.  
  185. // Framework you want to run your specs with.
  186. // The following are supported: Mocha, Jasmine, and Cucumber
  187. // see also: https://webdriver.io/docs/frameworks.html
  188. //
  189. // Make sure you have the wdio adapter package for the specific framework installed
  190. // before running any tests.
  191. framework: 'mocha',
  192. //
  193. // The number of times to retry the entire specfile when it fails as a whole
  194. // specFileRetries: 1,
  195. //
  196. // Whether or not retried specfiles should be retried immediately or deferred to the end of the queue
  197. // specFileRetriesDeferred: false,
  198. //
  199. // Test reporter for stdout.
  200. // The only one supported by default is 'dot'
  201. // see also: https://webdriver.io/docs/dot-reporter.html
  202. reporters: ['spec', ['allure', {
  203. outputDir: 'allure-results',
  204. disableWebdriverStepsReporting: true,
  205. disableWebdriverScreenshotsReporting: true,
  206. }]],
  207.  
  208. //
  209. // Options to be passed to Mocha.
  210. // See the full list at http://mochajs.org/
  211. mochaOpts: {
  212. ui: 'bdd',
  213. timeout: 60000
  214. },
  215. //
  216. // =====
  217. // Hooks
  218. // =====
  219. // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
  220. // it and to build services around it. You can either apply a single function or an array of
  221. // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
  222. // resolved to continue.
  223. /**
  224. * Gets executed once before all workers get launched.
  225. * @param {Object} config wdio configuration object
  226. * @param {Array.<Object>} capabilities list of capabilities details
  227. */
  228. // onPrepare: function (config, capabilities) {
  229. // },
  230. /**
  231. * Gets executed before a worker process is spawned and can be used to initialise specific service
  232. * for that worker as well as modify runtime environments in an async fashion.
  233. * @param {String} cid capability id (e.g 0-0)
  234. * @param {[type]} caps object containing capabilities for session that will be spawn in the worker
  235. * @param {[type]} specs specs to be run in the worker process
  236. * @param {[type]} args object that will be merged with the main configuration once worker is initialised
  237. * @param {[type]} execArgv list of string arguments passed to the worker process
  238. */
  239. // onWorkerStart: function (cid, caps, specs, args, execArgv) {
  240. // },
  241. /**
  242. * Gets executed just before initialising the webdriver session and test framework. It allows you
  243. * to manipulate configurations depending on the capability or spec.
  244. * @param {Object} config wdio configuration object
  245. * @param {Array.<Object>} capabilities list of capabilities details
  246. * @param {Array.<String>} specs List of spec file paths that are to be run
  247. */
  248. // beforeSession: function (config, capabilities, specs) {
  249. // },
  250. /**
  251. * Gets executed before test execution begins. At this point you can access to all global
  252. * variables like `browser`. It is the perfect place to define custom commands.
  253. * @param {Array.<Object>} capabilities list of capabilities details
  254. * @param {Array.<String>} specs List of spec file paths that are to be run
  255. */
  256. // before: function (capabilities, specs) {
  257. // },
  258. /**
  259. * Runs before a WebdriverIO command gets executed.
  260. * @param {String} commandName hook command name
  261. * @param {Array} args arguments that command would receive
  262. */
  263. // beforeCommand: function (commandName, args) {
  264. // },
  265. /**
  266. * Hook that gets executed before the suite starts
  267. * @param {Object} suite suite details
  268. */
  269. // beforeSuite: function (suite) {
  270. // },
  271. /**
  272. * Function to be executed before a test (in Mocha/Jasmine) starts.
  273. */
  274. beforeTest: function () {
  275. const chai = require('chai')
  276. const chaiWebdriver = require('chai-webdriverio').default
  277. chai.use(chaiWebdriver(browser))
  278.  
  279. global.assert = chai.assert
  280. global.should = chai.should
  281. global.expect = chai.expect
  282. },
  283. /**
  284. * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
  285. * beforeEach in Mocha)
  286. */
  287. // beforeHook: function (test, context) {
  288. // },
  289. /**
  290. * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
  291. * afterEach in Mocha)
  292. */
  293. // afterHook: function (test, context, { error, result, duration, passed, retries }) {
  294. // },
  295. /**
  296. * Function to be executed after a test (in Mocha/Jasmine).
  297. */
  298. // afterTest: function(test, context, { error, result, duration, passed, retries }) {
  299. // },
  300.  
  301.  
  302. /**
  303. * Hook that gets executed after the suite has ended
  304. * @param {Object} suite suite details
  305. */
  306. // afterSuite: function (suite) {
  307. // },
  308. /**
  309. * Runs after a WebdriverIO command gets executed
  310. * @param {String} commandName hook command name
  311. * @param {Array} args arguments that command would receive
  312. * @param {Number} result 0 - command success, 1 - command error
  313. * @param {Object} error error object if any
  314. */
  315. // afterCommand: function (commandName, args, result, error) {
  316. // },
  317. /**
  318. * Gets executed after all tests are done. You still have access to all global variables from
  319. * the test.
  320. * @param {Number} result 0 - test pass, 1 - test fail
  321. * @param {Array.<Object>} capabilities list of capabilities details
  322. * @param {Array.<String>} specs List of spec file paths that ran
  323. */
  324. // after: function (result, capabilities, specs) {
  325. // },
  326. /**
  327. * Gets executed right after terminating the webdriver session.
  328. * @param {Object} config wdio configuration object
  329. * @param {Array.<Object>} capabilities list of capabilities details
  330. * @param {Array.<String>} specs List of spec file paths that ran
  331. */
  332. // afterSession: function (config, capabilities, specs) {
  333. // },
  334. /**
  335. * Gets executed after all workers got shut down and the process is about to exit. An error
  336. * thrown in the onComplete hook will result in the test run failing.
  337. * @param {Object} exitCode 0 - success, 1 - fail
  338. * @param {Object} config wdio configuration object
  339. * @param {Array.<Object>} capabilities list of capabilities details
  340. * @param {<Object>} results object containing test results
  341. */
  342. // onComplete: function(exitCode, config, capabilities, results) {
  343. // },
  344. /**
  345. * Gets executed when a refresh happens.
  346. * @param {String} oldSessionId session ID of the old session
  347. * @param {String} newSessionId session ID of the new session
  348. */
  349. //onReload: function(oldSessionId, newSessionId) {
  350. //}
  351. }
  352.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement