UNPKG

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