3 const password
= 'vagrant',
4 path
= require( 'path' ),
7 function relPath( foo
) {
8 return path
.resolve( __dirname
, '../..', foo
);
19 // Define any custom variables.
22 // Use if from tests with:
23 // browser.options.username
24 username
: process
.env
.MEDIAWIKI_USER
=== undefined ?
26 process
.env
.MEDIAWIKI_USER
,
27 password
: process
.env
.MEDIAWIKI_PASSWORD
=== undefined ?
29 process
.env
.MEDIAWIKI_PASSWORD
,
35 services
: [ 'sauce' ],
36 user
: process
.env
.SAUCE_USERNAME
,
37 key
: process
.env
.SAUCE_ACCESS_KEY
,
42 // Define which test specs should run. The pattern is relative to the directory
43 // from which `wdio` was called. Notice that, if you are calling `wdio` from an
44 // NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
45 // directory is where your package.json resides, so `wdio` will be called from there.
48 relPath( './tests/selenium/specs/**/*.js' ),
49 relPath( './extensions/*/tests/selenium/specs/**/*.js' ),
50 relPath( './extensions/VisualEditor/modules/ve-mw/tests/selenium/specs/**/*.js' ),
51 relPath( './skins/*/tests/selenium/specs/**/*.js' )
53 // Patterns to exclude.
55 // 'path/to/excluded/files'
61 // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
62 // time. Depending on the number of capabilities, WebdriverIO launches several test
63 // sessions. Within your capabilities you can overwrite the spec and exclude options in
64 // order to group specific specs to a specific capability.
66 // First, you can define how many instances should be started at the same time. Let's
67 // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
68 // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
69 // files and you set maxInstances to 10, all spec files will get tested at the same time
70 // and 30 processes will get spawned. The property handles how many capabilities
71 // from the same test should run tests.
75 // If you have trouble getting all important capabilities together, check out the
76 // Sauce Labs platform configurator - a great tool to configure your capabilities:
77 // https://docs.saucelabs.com/reference/platforms-configurator
79 // For Chrome/Chromium https://sites.google.com/a/chromium.org/chromedriver/capabilities
81 // maxInstances can get overwritten per capability. So if you have an in-house Selenium
82 // grid with only 5 firefox instances available you can make sure that not more than
83 // 5 instances get started at a time.
86 browserName
: 'chrome',
87 // Since Chrome v57 https://bugs.chromium.org/p/chromedriver/issues/detail?id=1625
89 args
: [ '--enable-automation' ]
93 // ===================
94 // Test Configurations
95 // ===================
96 // Define all options that are relevant for the WebdriverIO instance here
98 // By default WebdriverIO commands are executed in a synchronous way using
99 // the wdio-sync package. If you still want to run your tests in an async way
100 // e.g. using promises you can set the sync option to false.
103 // Level of logging verbosity: silent | verbose | command | data | result | error
106 // Enables colors for log output.
109 // Saves a screenshot to a given path if a command fails.
110 screenshotPath
: './log/',
112 // Set a base URL in order to shorten url command calls. If your url parameter starts
113 // with "/", then the base url gets prepended.
115 process
.env
.MW_SERVER
=== undefined ?
116 'http://127.0.0.1:8080' :
117 process
.env
.MW_SERVER
119 process
.env
.MW_SCRIPT_PATH
=== undefined ?
121 process
.env
.MW_SCRIPT_PATH
124 // Default timeout for all waitFor* commands.
125 waitforTimeout
: 20000,
127 // Default timeout in milliseconds for request
128 // if Selenium Grid doesn't send response
129 connectionRetryTimeout
: 90000,
131 // Default request retries count
132 connectionRetryCount
: 3,
134 // Initialize the browser instance with a WebdriverIO plugin. The object should have the
135 // plugin name as key and the desired plugin options as properties. Make sure you have
136 // the plugin installed before running any tests. The following plugins are currently
138 // WebdriverCSS: https://github.com/webdriverio/webdrivercss
139 // WebdriverRTC: https://github.com/webdriverio/webdriverrtc
140 // Browserevent: https://github.com/webdriverio/browserevent
143 // screenshotRoot: 'my-shots',
144 // failedComparisonsRoot: 'diffs',
145 // misMatchTolerance: 0.05,
146 // screenWidth: [320,480,640,1024]
152 // Test runner services
153 // Services take over a specific job you don't want to take care of. They enhance
154 // your test setup with almost no effort. Unlike plugins, they don't add new
155 // commands. Instead, they hook themselves up into the test process.
157 // Framework you want to run your specs with.
158 // The following are supported: Mocha, Jasmine, and Cucumber
159 // see also: http://webdriver.io/guide/testrunner/frameworks.html
161 // Make sure you have the wdio adapter package for the specific framework installed
162 // before running any tests.
165 // Test reporter for stdout.
166 // The only one supported by default is 'dot'
167 // see also: http://webdriver.io/guide/testrunner/reporters.html
168 reporters
: [ 'spec' ],
170 // Options to be passed to Mocha.
171 // See the full list at http://mochajs.org/
180 // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
181 // it and to build services around it. You can either apply a single function or an array of
182 // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
183 // resolved to continue.
185 // Gets executed once before all workers get launched.
186 // onPrepare: function ( config, capabilities ) {
189 // Gets executed before test execution begins. At this point you can access all global
190 // variables, such as `browser`. It is the perfect place to define custom commands.
191 // before: function (capabilities, specs) {
194 // Hook that gets executed before the suite starts
195 // beforeSuite: function (suite) {
198 // Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
199 // beforeEach in Mocha)
200 // beforeHook: function () {
203 // Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
204 // afterEach in Mocha)
206 // Function to be executed before a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
207 // beforeTest: function (test) {
210 // Runs before a WebdriverIO command gets executed.
211 // beforeCommand: function (commandName, args) {
214 // Runs after a WebdriverIO command gets executed
215 // afterCommand: function (commandName, args, result, error) {
218 // Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
219 // from https://github.com/webdriverio/webdriverio/issues/269#issuecomment-306342170
220 afterTest: function ( test
) {
221 var filename
, filePath
;
222 // if test passed, ignore, else take and save screenshot
226 // get current test title and clean it, to use it as file name
227 filename
= encodeURIComponent( test
.title
.replace( /\s+/g, '-' ) );
229 filePath
= this.screenshotPath
+ filename
+ '.png';
231 browser
.saveScreenshot( filePath
);
232 console
.log( '\n\tScreenshot location:', filePath
, '\n' );
235 // Hook that gets executed after the suite has ended
236 // afterSuite: function (suite) {
239 // Gets executed after all tests are done. You still have access to all global variables from
241 // after: function (result, capabilities, specs) {
244 // Gets executed after all workers got shut down and the process is about to exit. It is not
245 // possible to defer the end of the process using a promise.
246 // onComplete: function(exitCode) {