1 /// <reference types="wdio-electron-service" />
2 import type { Options } from '@wdio/types';
4 export const config: Options.Testrunner = {
6 // ====================
7 // Runner Configuration
8 // ====================
9 // WebdriverIO supports running e2e tests as well as unit and component tests.
14 project: './tsconfig.json',
23 // Define which test specs should run. The pattern is relative to the directory
24 // of the configuration file being run.
26 // The specs are defined as an array of spec files (optionally using wildcards
27 // that will be expanded). The test for each spec file will be run in a separate
28 // worker process. In order to have a group of spec files run in the same worker
29 // process simply enclose them in an array within the specs array.
31 // The path of the spec files will be resolved relative from the directory of
32 // of the config file unless it's absolute.
34 specs: ['./tests/**/*.spec.ts'],
35 // Patterns to exclude.
36 // FIXME: Remove the following exclusions once the tests are ported to WDIO
38 'tests/gui/modules/image-writer.spec.ts',
39 'tests/gui/os/window-progress.spec.ts',
40 'tests/gui/models/available-drives.spec.ts',
41 'tests/gui/models/flash-state.spec.ts',
42 'tests/gui/models/selection-state.spec.ts',
43 'tests/gui/models/settings.spec.ts',
44 'tests/shared/drive-constraints.spec.ts',
45 'tests/shared/messages.spec.ts',
46 'tests/gui/modules/progress-status.spec.ts',
52 // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
53 // time. Depending on the number of capabilities, WebdriverIO launches several test
54 // sessions. Within your capabilities you can overwrite the spec and exclude options in
55 // order to group specific specs to a specific capability.
57 // First, you can define how many instances should be started at the same time. Let's
58 // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
59 // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
60 // files and you set maxInstances to 10, all spec files will get tested at the same time
61 // and 30 processes will get spawned. The property handles how many capabilities
62 // from the same test should run tests.
66 // If you have trouble getting all important capabilities together, check out the
67 // Sauce Labs platform configurator - a great tool to configure your capabilities:
68 // https://saucelabs.com/platform/platform-configurator
72 browserName: 'electron',
73 // Electron service options
74 // see https://webdriver.io/docs/desktop-testing/electron/configuration/#service-options
75 'wdio:electronServiceOptions': {
76 appArgs: process.platform === 'linux' ? ['headless'] : [],
82 // ===================
83 // Test Configurations
84 // ===================
85 // Define all options that are relevant for the WebdriverIO instance here
87 // Level of logging verbosity: trace | debug | info | warn | error | silent
90 // Set specific log levels per logger
92 // - webdriver, webdriverio
93 // - @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service
94 // - @wdio/mocha-framework, @wdio/jasmine-framework
95 // - @wdio/local-runner
96 // - @wdio/sumologic-reporter
97 // - @wdio/cli, @wdio/config, @wdio/utils
98 // Level of logging verbosity: trace | debug | info | warn | error | silent
100 // webdriver: 'info',
101 // '@wdio/appium-service': 'info'
104 // If you only want to run your tests until a specific amount of tests have failed use
105 // bail (default is 0 - don't bail, run all tests).
108 // Set a base URL in order to shorten url command calls. If your `url` parameter starts
109 // with `/`, the base url gets prepended, not including the path portion of your baseUrl.
110 // If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
111 // gets prepended directly.
112 // baseUrl: 'http://localhost:8080',
114 // Default timeout for all waitFor* commands.
115 waitforTimeout: 10000,
117 // Default timeout in milliseconds for request
118 // if browser driver or grid doesn't send response
119 connectionRetryTimeout: 120000,
121 // Default request retries count
122 connectionRetryCount: 3,
124 // Test runner services
125 // Services take over a specific job you don't want to take care of. They enhance
126 // your test setup with almost no effort. Unlike plugins, they don't add new
127 // commands. Instead, they hook themselves up into the test process.
128 services: ['electron'],
130 // Framework you want to run your specs with.
131 // The following are supported: Mocha, Jasmine, and Cucumber
132 // see also: https://webdriver.io/docs/frameworks
134 // Make sure you have the wdio adapter package for the specific framework installed
135 // before running any tests.
139 // The number of times to retry the entire specfile when it fails as a whole
140 // specFileRetries: 1,
142 // Delay in seconds between the spec file retry attempts
143 // specFileRetriesDelay: 0,
145 // Whether or not retried spec files should be retried immediately or deferred to the end of the queue
146 // specFileRetriesDeferred: false,
148 // Test reporter for stdout.
149 // The only one supported by default is 'dot'
150 // see also: https://webdriver.io/docs/dot-reporter
153 // Options to be passed to Mocha.
154 // See the full list at http://mochajs.org/
164 // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
165 // it and to build services around it. You can either apply a single function or an array of
166 // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
167 // resolved to continue.
169 * Gets executed once before all workers get launched.
170 * @param {object} config wdio configuration object
171 * @param {Array.<Object>} capabilities list of capabilities details
173 // onPrepare: function (config, capabilities) {
176 * Gets executed before a worker process is spawned and can be used to initialize specific service
177 * for that worker as well as modify runtime environments in an async fashion.
178 * @param {string} cid capability id (e.g 0-0)
179 * @param {object} caps object containing capabilities for session that will be spawn in the worker
180 * @param {object} specs specs to be run in the worker process
181 * @param {object} args object that will be merged with the main configuration once worker is initialized
182 * @param {object} execArgv list of string arguments passed to the worker process
184 // onWorkerStart: function (cid, caps, specs, args, execArgv) {
187 * Gets executed just after a worker process has exited.
188 * @param {string} cid capability id (e.g 0-0)
189 * @param {number} exitCode 0 - success, 1 - fail
190 * @param {object} specs specs to be run in the worker process
191 * @param {number} retries number of retries used
193 // onWorkerEnd: function (cid, exitCode, specs, retries) {
196 * Gets executed just before initialising the webdriver session and test framework. It allows you
197 * to manipulate configurations depending on the capability or spec.
198 * @param {object} config wdio configuration object
199 * @param {Array.<Object>} capabilities list of capabilities details
200 * @param {Array.<String>} specs List of spec file paths that are to be run
201 * @param {string} cid worker id (e.g. 0-0)
203 // beforeSession: function (config, capabilities, specs, cid) {
206 * Gets executed before test execution begins. At this point you can access to all global
207 * variables like `browser`. It is the perfect place to define custom commands.
208 * @param {Array.<Object>} capabilities list of capabilities details
209 * @param {Array.<String>} specs List of spec file paths that are to be run
210 * @param {object} browser instance of created browser/device session
212 // before: function (capabilities, specs) {
215 * Runs before a WebdriverIO command gets executed.
216 * @param {string} commandName hook command name
217 * @param {Array} args arguments that command would receive
219 // beforeCommand: function (commandName, args) {
222 * Hook that gets executed before the suite starts
223 * @param {object} suite suite details
225 // beforeSuite: function (suite) {
228 * Function to be executed before a test (in Mocha/Jasmine) starts.
230 // beforeTest: function (test, context) {
233 * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
234 * beforeEach in Mocha)
236 // beforeHook: function (test, context, hookName) {
239 * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
240 * afterEach in Mocha)
242 // afterHook: function (test, context, { error, result, duration, passed, retries }, hookName) {
245 * Function to be executed after a test (in Mocha/Jasmine only)
246 * @param {object} test test object
247 * @param {object} context scope object the test was executed with
248 * @param {Error} result.error error object in case the test fails, otherwise `undefined`
249 * @param {*} result.result return object of test function
250 * @param {number} result.duration duration of test
251 * @param {boolean} result.passed true if test has passed, otherwise false
252 * @param {object} result.retries information about spec related retries, e.g. `{ attempts: 0, limit: 0 }`
254 // afterTest: function(test, context, { error, result, duration, passed, retries }) {
258 * Hook that gets executed after the suite has ended
259 * @param {object} suite suite details
261 // afterSuite: function (suite) {
264 * Runs after a WebdriverIO command gets executed
265 * @param {string} commandName hook command name
266 * @param {Array} args arguments that command would receive
267 * @param {number} result 0 - command success, 1 - command error
268 * @param {object} error error object if any
270 // afterCommand: function (commandName, args, result, error) {
273 * Gets executed after all tests are done. You still have access to all global variables from
275 * @param {number} result 0 - test pass, 1 - test fail
276 * @param {Array.<Object>} capabilities list of capabilities details
277 * @param {Array.<String>} specs List of spec file paths that ran
279 // after: function (result, capabilities, specs) {
282 * Gets executed right after terminating the webdriver session.
283 * @param {object} config wdio configuration object
284 * @param {Array.<Object>} capabilities list of capabilities details
285 * @param {Array.<String>} specs List of spec file paths that ran
287 // afterSession: function (config, capabilities, specs) {
290 * Gets executed after all workers got shut down and the process is about to exit. An error
291 * thrown in the onComplete hook will result in the test run failing.
292 * @param {object} exitCode 0 - success, 1 - fail
293 * @param {object} config wdio configuration object
294 * @param {Array.<Object>} capabilities list of capabilities details
295 * @param {<Object>} results object containing test results
297 // onComplete: function(exitCode, config, capabilities, results) {
300 * Gets executed when a refresh happens.
301 * @param {string} oldSessionId session ID of the old session
302 * @param {string} newSessionId session ID of the new session
304 // onReload: function(oldSessionId, newSessionId) {
307 * Hook that gets executed before a WebdriverIO assertion happens.
308 * @param {object} params information about the assertion to be executed
310 // beforeAssertion: function(params) {
313 * Hook that gets executed after a WebdriverIO assertion happened.
314 * @param {object} params information about the assertion that was executed, including its results
316 // afterAssertion: function(params) {