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 | // Service Providers
|
13 | // =================
|
14 | // WebdriverIO supports Sauce Labs, Browserstack, Testing Bot and LambdaTest (other cloud providers
|
15 | // should work too though). These services define specific user and key (or access key)
|
16 | // values you need to put in here in order to connect to these services.
|
17 | //
|
18 | user: process.env.SAUCE_USERNAME,
|
19 | key: process.env.SAUCE_ACCESS_KEY,
|
20 | //
|
21 | // If you run your tests on Sauce Labs you can specify the region you want to run your tests
|
22 | // in via the `region` property. Available short handles for regions are `us` (default) and `eu`.
|
23 | // These regions are used for the Sauce Labs VM cloud and the Sauce Labs Real Device Cloud.
|
24 | // If you don't provide the region it will default for the `us`
|
25 | region: 'us',
|
26 | //
|
27 | // ==================
|
28 | // Specify Test Files
|
29 | // ==================
|
30 | // Define which test specs should run. The pattern is relative to the directory
|
31 | // from which `wdio` was called. Notice that, if you are calling `wdio` from an
|
32 | // NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
|
33 | // directory is where your package.json resides, so `wdio` will be called from there.
|
34 | //
|
35 | specs: ['./test/wdio/**/*.js'],
|
36 | // Patterns to exclude.
|
37 | exclude: [
|
38 | // 'path/to/excluded/files'
|
39 | ],
|
40 | //
|
41 | // ============
|
42 | // Capabilities
|
43 | // ============
|
44 | // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
|
45 | // time. Depending on the number of capabilities, WebdriverIO launches several test
|
46 | // sessions. Within your capabilities you can overwrite the spec and exclude options in
|
47 | // order to group specific specs to a specific capability.
|
48 | //
|
49 | // First, you can define how many instances should be started at the same time. Let's
|
50 | // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
|
51 | // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
|
52 | // files and you set maxInstances to 10, all spec files will get tested at the same time
|
53 | // and 30 processes will get spawned. The property handles how many capabilities
|
54 | // from the same test should run tests.
|
55 | //
|
56 | maxInstances: 10,
|
57 | //
|
58 | // If you have trouble getting all important capabilities together, check out the
|
59 | // Sauce Labs platform configurator - a great tool to configure your capabilities:
|
60 | // https://docs.saucelabs.com/reference/platforms-configurator
|
61 | //
|
62 | capabilities: [
|
63 | {
|
64 | browserName: 'chrome',
|
65 | platformName: 'Windows 10',
|
66 | browserVersion: 'latest',
|
67 | maxInstances: 1,
|
68 | 'sauce:options': {
|
69 | build: `Build ${Math.ceil(Date.now() / 1000)}`,
|
70 | public: 'public'
|
71 | },
|
72 | 'goog:chromeOptions': {
|
73 | args: ['--force-dark-mode=true']
|
74 | }
|
75 | },
|
76 | {
|
77 | browserName: 'MicrosoftEdge',
|
78 | platformName: 'Windows 10',
|
79 | browserVersion: '18.17763',
|
80 | maxInstances: 1,
|
81 | 'sauce:options': {
|
82 | build: `Build ${Math.ceil(Date.now() / 1000)}`,
|
83 | public: 'public'
|
84 | }
|
85 | },
|
86 | {
|
87 | browserName: 'MicrosoftEdge',
|
88 | platformName: 'Windows 10',
|
89 | browserVersion: '17.17134',
|
90 | maxInstances: 1,
|
91 | 'sauce:options': {
|
92 | build: `Build ${Math.ceil(Date.now() / 1000)}`,
|
93 | public: 'public'
|
94 | }
|
95 | },
|
96 | {
|
97 | browserName: 'MicrosoftEdge',
|
98 | platformName: 'Windows 10',
|
99 | browserVersion: '16.16299',
|
100 | maxInstances: 1,
|
101 | 'sauce:options': {
|
102 | build: `Build ${Math.ceil(Date.now() / 1000)}`,
|
103 | public: 'public'
|
104 | }
|
105 | },
|
106 | {
|
107 | browserName: 'MicrosoftEdge',
|
108 | platformName: 'Windows 10',
|
109 | browserVersion: 'latest',
|
110 | maxInstances: 1,
|
111 | 'sauce:options': {
|
112 | build: `Build ${Math.ceil(Date.now() / 1000)}`,
|
113 | public: 'public'
|
114 | }
|
115 | },
|
116 | {
|
117 | browserName: 'firefox',
|
118 | platformName: 'Windows 10',
|
119 | browserVersion: '65.0',
|
120 | maxInstances: 1,
|
121 | 'sauce:options': {
|
122 | build: `Build ${Math.ceil(Date.now() / 1000)}`,
|
123 | public: 'public'
|
124 | }
|
125 | },
|
126 | {
|
127 | browserName: 'firefox',
|
128 | platformName: 'Windows 10',
|
129 | browserVersion: '62.0',
|
130 | maxInstances: 1,
|
131 | 'sauce:options': {
|
132 | build: `Build ${Math.ceil(Date.now() / 1000)}`,
|
133 | public: 'public'
|
134 | }
|
135 | },
|
136 | {
|
137 | browserName: 'firefox',
|
138 | platformName: 'Windows 10',
|
139 | browserVersion: 'latest',
|
140 | maxInstances: 1,
|
141 | 'sauce:options': {
|
142 | build: `Build ${Math.ceil(Date.now() / 1000)}`,
|
143 | public: 'public'
|
144 | }
|
145 | },
|
146 | {
|
147 | browserName: 'safari',
|
148 | platformName: 'macOS 10.15',
|
149 | browserVersion: 'latest',
|
150 | maxInstances: 1,
|
151 | 'sauce:options': {
|
152 | build: `Build ${Math.ceil(Date.now() / 1000)}`,
|
153 | public: 'public'
|
154 | }
|
155 | }
|
156 | ],
|
157 | //
|
158 | // ===================
|
159 | // Test Configurations
|
160 | // ===================
|
161 | // Define all options that are relevant for the WebdriverIO instance here
|
162 | //
|
163 | // Level of logging verbosity: trace | debug | info | warn | error | silent
|
164 | logLevel: 'info',
|
165 | //
|
166 | // Set specific log levels per logger
|
167 | // loggers:
|
168 | // - webdriver, webdriverio
|
169 | // - @wdio/applitools-service, @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service
|
170 | // - @wdio/mocha-framework, @wdio/jasmine-framework
|
171 | // - @wdio/local-runner
|
172 | // - @wdio/sumologic-reporter
|
173 | // - @wdio/cli, @wdio/config, @wdio/sync, @wdio/utils
|
174 | // Level of logging verbosity: trace | debug | info | warn | error | silent
|
175 | // logLevels: {
|
176 | // webdriver: 'info',
|
177 | // '@wdio/applitools-service': 'info'
|
178 | // },
|
179 | //
|
180 | // If you only want to run your tests until a specific amount of tests have failed use
|
181 | // bail (default is 0 - don't bail, run all tests).
|
182 | bail: 0,
|
183 | //
|
184 | // Set a base URL in order to shorten url command calls. If your `url` parameter starts
|
185 | // with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
186 | // If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
187 | // gets prepended directly.
|
188 | baseUrl: 'http://localhost:4000',
|
189 | //
|
190 | // Default timeout for all waitFor* commands.
|
191 | waitforTimeout: 10000,
|
192 | //
|
193 | // Default timeout in milliseconds for request
|
194 | // if browser driver or grid doesn't send response
|
195 | connectionRetryTimeout: 120000,
|
196 | //
|
197 | // Default request retries count
|
198 | connectionRetryCount: 3,
|
199 | //
|
200 | // Test runner services
|
201 | // Services take over a specific job you don't want to take care of. They enhance
|
202 | // your test setup with almost no effort. Unlike plugins, they don't add new
|
203 | // commands. Instead, they hook themselves up into the test process.
|
204 | services: [
|
205 | [
|
206 | 'sauce',
|
207 | {
|
208 | sauceConnect: true
|
209 | }
|
210 | ]
|
211 | ],
|
212 |
|
213 | // Framework you want to run your specs with.
|
214 | // The following are supported: Mocha, Jasmine, and Cucumber
|
215 | // see also: https://webdriver.io/docs/frameworks.html
|
216 | //
|
217 | // Make sure you have the wdio adapter package for the specific framework installed
|
218 | // before running any tests.
|
219 | framework: 'mocha',
|
220 | //
|
221 | // The number of times to retry the entire specfile when it fails as a whole
|
222 | // specFileRetries: 1,
|
223 | //
|
224 | // Delay in seconds between the spec file retry attempts
|
225 | // specFileRetriesDelay: 0,
|
226 | //
|
227 | // Whether or not retried specfiles should be retried immediately or deferred to the end of the queue
|
228 | // specFileRetriesDeferred: false,
|
229 | //
|
230 | // Test reporter for stdout.
|
231 | // The only one supported by default is 'dot'
|
232 | // see also: https://webdriver.io/docs/dot-reporter.html
|
233 | reporters: ['spec'],
|
234 |
|
235 | //
|
236 | // Options to be passed to Mocha.
|
237 | // See the full list at http://mochajs.org/
|
238 | mochaOpts: {
|
239 | ui: 'bdd',
|
240 | timeout: 120000
|
241 | }
|
242 | //
|
243 | // =====
|
244 | // Hooks
|
245 | // =====
|
246 | // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
|
247 | // it and to build services around it. You can either apply a single function or an array of
|
248 | // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
|
249 | // resolved to continue.
|
250 | /**
|
251 | * Gets executed once before all workers get launched.
|
252 | * @param {Object} config wdio configuration object
|
253 | * @param {Array.<Object>} capabilities list of capabilities details
|
254 | */
|
255 | // onPrepare: function (config, capabilities) {
|
256 | // },
|
257 | /**
|
258 | * Gets executed before a worker process is spawned and can be used to initialise specific service
|
259 | * for that worker as well as modify runtime environments in an async fashion.
|
260 | * @param {String} cid capability id (e.g 0-0)
|
261 | * @param {[type]} caps object containing capabilities for session that will be spawn in the worker
|
262 | * @param {[type]} specs specs to be run in the worker process
|
263 | * @param {[type]} args object that will be merged with the main configuration once worker is initialised
|
264 | * @param {[type]} execArgv list of string arguments passed to the worker process
|
265 | */
|
266 | // onWorkerStart: function (cid, caps, specs, args, execArgv) {
|
267 | // },
|
268 | /**
|
269 | * Gets executed just before initialising the webdriver session and test framework. It allows you
|
270 | * to manipulate configurations depending on the capability or spec.
|
271 | * @param {Object} config wdio configuration object
|
272 | * @param {Array.<Object>} capabilities list of capabilities details
|
273 | * @param {Array.<String>} specs List of spec file paths that are to be run
|
274 | */
|
275 | // beforeSession: function (config, capabilities, specs) {
|
276 | // },
|
277 | /**
|
278 | * Gets executed before test execution begins. At this point you can access to all global
|
279 | * variables like `browser`. It is the perfect place to define custom commands.
|
280 | * @param {Array.<Object>} capabilities list of capabilities details
|
281 | * @param {Array.<String>} specs List of spec file paths that are to be run
|
282 | */
|
283 | // before: function (capabilities, specs) {
|
284 | // },
|
285 | /**
|
286 | * Runs before a WebdriverIO command gets executed.
|
287 | * @param {String} commandName hook command name
|
288 | * @param {Array} args arguments that command would receive
|
289 | */
|
290 | // beforeCommand: function (commandName, args) {
|
291 | // },
|
292 | /**
|
293 | * Hook that gets executed before the suite starts
|
294 | * @param {Object} suite suite details
|
295 | */
|
296 | // beforeSuite: function (suite) {
|
297 | // },
|
298 | /**
|
299 | * Function to be executed before a test (in Mocha/Jasmine) starts.
|
300 | */
|
301 | // beforeTest: function (test, context) {
|
302 | // },
|
303 | /**
|
304 | * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
|
305 | * beforeEach in Mocha)
|
306 | */
|
307 | // beforeHook: function (test, context) {
|
308 | // },
|
309 | /**
|
310 | * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
|
311 | * afterEach in Mocha)
|
312 | */
|
313 | // afterHook: function (test, context, { error, result, duration, passed, retries }) {
|
314 | // },
|
315 | /**
|
316 | * Function to be executed after a test (in Mocha/Jasmine).
|
317 | */
|
318 | // afterTest: function(test, context, { error, result, duration, passed, retries }) {
|
319 | // },
|
320 |
|
321 | /**
|
322 | * Hook that gets executed after the suite has ended
|
323 | * @param {Object} suite suite details
|
324 | */
|
325 | // afterSuite: function (suite) {
|
326 | // },
|
327 | /**
|
328 | * Runs after a WebdriverIO command gets executed
|
329 | * @param {String} commandName hook command name
|
330 | * @param {Array} args arguments that command would receive
|
331 | * @param {Number} result 0 - command success, 1 - command error
|
332 | * @param {Object} error error object if any
|
333 | */
|
334 | // afterCommand: function (commandName, args, result, error) {
|
335 | // },
|
336 | /**
|
337 | * Gets executed after all tests are done. You still have access to all global variables from
|
338 | * the test.
|
339 | * @param {Number} result 0 - test pass, 1 - test fail
|
340 | * @param {Array.<Object>} capabilities list of capabilities details
|
341 | * @param {Array.<String>} specs List of spec file paths that ran
|
342 | */
|
343 | // after: function (result, capabilities, specs) {
|
344 | // },
|
345 | /**
|
346 | * Gets executed right after terminating the webdriver session.
|
347 | * @param {Object} config wdio configuration object
|
348 | * @param {Array.<Object>} capabilities list of capabilities details
|
349 | * @param {Array.<String>} specs List of spec file paths that ran
|
350 | */
|
351 | // afterSession: function (config, capabilities, specs) {
|
352 | // },
|
353 | /**
|
354 | * Gets executed after all workers got shut down and the process is about to exit. An error
|
355 | * thrown in the onComplete hook will result in the test run failing.
|
356 | * @param {Object} exitCode 0 - success, 1 - fail
|
357 | * @param {Object} config wdio configuration object
|
358 | * @param {Array.<Object>} capabilities list of capabilities details
|
359 | * @param {<Object>} results object containing test results
|
360 | */
|
361 | // onComplete: function(exitCode, config, capabilities, results) {
|
362 | // },
|
363 | /**
|
364 | * Gets executed when a refresh happens.
|
365 | * @param {String} oldSessionId session ID of the old session
|
366 | * @param {String} newSessionId session ID of the new session
|
367 | */
|
368 | //onReload: function(oldSessionId, newSessionId) {
|
369 | //}
|
370 | };
|