3 const password
= 'vagrant',
4 path
= require( 'path' ),
7 function relPath( foo
) {
8 return path
.resolve( __dirname
, '../..', foo
);
15 // Define any custom variables.
18 // Use if from tests with:
19 // browser.options.username
20 username
: process
.env
.MEDIAWIKI_USER
=== undefined ?
22 process
.env
.MEDIAWIKI_USER
,
23 password
: process
.env
.MEDIAWIKI_PASSWORD
=== undefined ?
25 process
.env
.MEDIAWIKI_PASSWORD
,
31 services
: [ 'sauce' ],
32 user
: process
.env
.SAUCE_USERNAME
,
33 key
: process
.env
.SAUCE_ACCESS_KEY
,
38 // Define which test specs should run. The pattern is relative to the directory
39 // from which `wdio` was called. Notice that, if you are calling `wdio` from an
40 // NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
41 // directory is where your package.json resides, so `wdio` will be called from there.
44 relPath( './tests/selenium/specs/**/*.js' ),
45 relPath( './extensions/*/tests/selenium/specs/**/*.js' ),
46 relPath( './extensions/VisualEditor/modules/ve-mw/tests/selenium/specs/**/*.js' ),
47 relPath( './skins/*/tests/selenium/specs/**/*.js' )
49 // Patterns to exclude.
51 // 'path/to/excluded/files'
57 // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
58 // time. Depending on the number of capabilities, WebdriverIO launches several test
59 // sessions. Within your capabilities you can overwrite the spec and exclude options in
60 // order to group specific specs to a specific capability.
62 // First, you can define how many instances should be started at the same time. Let's
63 // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
64 // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
65 // files and you set maxInstances to 10, all spec files will get tested at the same time
66 // and 30 processes will get spawned. The property handles how many capabilities
67 // from the same test should run tests.
71 // If you have trouble getting all important capabilities together, check out the
72 // Sauce Labs platform configurator - a great tool to configure your capabilities:
73 // https://docs.saucelabs.com/reference/platforms-configurator
75 // For Chrome/Chromium https://sites.google.com/a/chromium.org/chromedriver/capabilities
77 // maxInstances can get overwritten per capability. So if you have an in-house Selenium
78 // grid with only 5 firefox instances available you can make sure that not more than
79 // 5 instances get started at a time.
82 browserName
: 'chrome',
83 // Since Chrome v57 https://bugs.chromium.org/p/chromedriver/issues/detail?id=1625
85 args
: [ '--enable-automation' ]
89 // ===================
90 // Test Configurations
91 // ===================
92 // Define all options that are relevant for the WebdriverIO instance here
94 // By default WebdriverIO commands are executed in a synchronous way using
95 // the wdio-sync package. If you still want to run your tests in an async way
96 // e.g. using promises you can set the sync option to false.
99 // Level of logging verbosity: silent | verbose | command | data | result | error
102 // Enables colors for log output.
105 // Warns when a deprecated command is used
106 deprecationWarnings
: true,
108 // If you only want to run your tests until a specific amount of tests have failed use
109 // bail (default is 0 - don't bail, run all tests).
112 // Saves a screenshot to a given path if a command fails.
113 screenshotPath
: './log/',
115 // Set a base URL in order to shorten url command calls. If your `url` parameter starts
116 // with `/`, the base url gets prepended, not including the path portion of your baseUrl.
117 // If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
118 // gets prepended directly.
120 process
.env
.MW_SERVER
=== undefined ?
121 'http://127.0.0.1:8080' :
122 process
.env
.MW_SERVER
124 process
.env
.MW_SCRIPT_PATH
=== undefined ?
126 process
.env
.MW_SCRIPT_PATH
129 // Default timeout for all waitFor* commands.
130 waitforTimeout
: 20000,
132 // Default timeout in milliseconds for request
133 // if Selenium Grid doesn't send response
134 connectionRetryTimeout
: 90000,
136 // Default request retries count
137 connectionRetryCount
: 3,
139 // Initialize the browser instance with a WebdriverIO plugin. The object should have the
140 // plugin name as key and the desired plugin options as properties. Make sure you have
141 // the plugin installed before running any tests. The following plugins are currently
143 // WebdriverCSS: https://github.com/webdriverio/webdrivercss
144 // WebdriverRTC: https://github.com/webdriverio/webdriverrtc
145 // Browserevent: https://github.com/webdriverio/browserevent
148 // screenshotRoot: 'my-shots',
149 // failedComparisonsRoot: 'diffs',
150 // misMatchTolerance: 0.05,
151 // screenWidth: [320,480,640,1024]
157 // Test runner services
158 // Services take over a specific job you don't want to take care of. They enhance
159 // your test setup with almost no effort. Unlike plugins, they don't add new
160 // commands. Instead, they hook themselves up into the test process.
162 // Framework you want to run your specs with.
163 // The following are supported: Mocha, Jasmine, and Cucumber
164 // see also: http://webdriver.io/guide/testrunner/frameworks.html
166 // Make sure you have the wdio adapter package for the specific framework installed
167 // before running any tests.
170 // Test reporter for stdout.
171 // The only one supported by default is 'dot'
172 // see also: http://webdriver.io/guide/testrunner/reporters.html
173 reporters
: [ 'spec' ],
175 // Options to be passed to Mocha.
176 // See the full list at http://mochajs.org/
185 // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
186 // it and to build services around it. You can either apply a single function or an array of
187 // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
188 // resolved to continue.
190 * Gets executed once before all workers get launched.
191 * @param {Object} config wdio configuration object
192 * @param {Array.<Object>} capabilities list of capabilities details
194 // onPrepare: function (config, capabilities) {
197 * Gets executed just before initialising the webdriver session and test framework. It allows you
198 * to manipulate configurations depending on the capability or spec.
199 * @param {Object} config wdio configuration object
200 * @param {Array.<Object>} capabilities list of capabilities details
201 * @param {Array.<String>} specs List of spec file paths that are to be run
203 // beforeSession: function (config, capabilities, specs) {
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
211 // before: function (capabilities, specs) {
214 * Runs before a WebdriverIO command gets executed.
215 * @param {String} commandName hook command name
216 * @param {Array} args arguments that command would receive
218 // beforeCommand: function (commandName, args) {
221 * Hook that gets executed before the suite starts
222 * @param {Object} suite suite details
224 // beforeSuite: function (suite) {
227 * Function to be executed before a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
228 * @param {Object} test test details
230 // beforeTest: function (test) {
233 * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
234 * beforeEach in Mocha)
236 // beforeHook: function () {
239 * Hook that gets executed _after_ a hook within the suite ends (e.g. runs after calling
240 * afterEach in Mocha)
242 // afterHook: function () {
245 * Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) ends.
246 * @param {Object} test test details
248 // from https://github.com/webdriverio/webdriverio/issues/269#issuecomment-306342170
249 afterTest: function ( test
) {
250 var filename
, filePath
;
251 // if test passed, ignore, else take and save screenshot
255 // get current test title and clean it, to use it as file name
256 filename
= encodeURIComponent( test
.title
.replace( /\s+/g, '-' ) );
258 filePath
= this.screenshotPath
+ filename
+ '.png';
260 browser
.saveScreenshot( filePath
);
261 console
.log( '\n\tScreenshot location:', filePath
, '\n' );
265 * Hook that gets executed after the suite has ended
266 * @param {Object} suite suite details
268 // afterSuite: function (suite) {
271 * Runs after a WebdriverIO command gets executed
272 * @param {String} commandName hook command name
273 * @param {Array} args arguments that command would receive
274 * @param {Number} result 0 - command success, 1 - command error
275 * @param {Object} error error object if any
277 // afterCommand: function (commandName, args, result, error) {
280 * Gets executed after all tests are done. You still have access to all global variables from
282 * @param {Number} result 0 - test pass, 1 - test fail
283 * @param {Array.<Object>} capabilities list of capabilities details
284 * @param {Array.<String>} specs List of spec file paths that ran
286 // after: function (result, capabilities, specs) {
289 * Gets executed right after terminating the webdriver session.
290 * @param {Object} config wdio configuration object
291 * @param {Array.<Object>} capabilities list of capabilities details
292 * @param {Array.<String>} specs List of spec file paths that ran
294 // afterSession: function (config, capabilities, specs) {
297 * Gets executed after all workers got shut down and the process is about to exit.
298 * @param {Object} exitCode 0 - success, 1 - fail
299 * @param {Object} config wdio configuration object
300 * @param {Array.<Object>} capabilities list of capabilities details
302 // onComplete: function(exitCode, config, capabilities) {