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',
88 // Run headless when there is no DISPLAY
89 // --headless: since Chrome 59 https://chromium.googlesource.com/chromium/src/+/59.0.3030.0/headless/README.md
90 args
: process
.env
.DISPLAY
? [] : [ '--headless' ]
94 // ===================
95 // Test Configurations
96 // ===================
97 // Define all options that are relevant for the WebdriverIO instance here
99 // By default WebdriverIO commands are executed in a synchronous way using
100 // the wdio-sync package. If you still want to run your tests in an async way
101 // e.g. using promises you can set the sync option to false.
104 // Level of logging verbosity: silent | verbose | command | data | result | error
107 // Enables colors for log output.
110 // Saves a screenshot to a given path if a command fails.
111 screenshotPath
: './log/',
113 // Set a base URL in order to shorten url command calls. If your url parameter starts
114 // with "/", then the base url gets prepended.
116 process
.env
.MW_SERVER
=== undefined ?
117 'http://127.0.0.1:8080' :
118 process
.env
.MW_SERVER
120 process
.env
.MW_SCRIPT_PATH
=== undefined ?
122 process
.env
.MW_SCRIPT_PATH
125 // Default timeout for all waitFor* commands.
126 waitforTimeout
: 20000,
128 // Default timeout in milliseconds for request
129 // if Selenium Grid doesn't send response
130 connectionRetryTimeout
: 90000,
132 // Default request retries count
133 connectionRetryCount
: 3,
135 // Initialize the browser instance with a WebdriverIO plugin. The object should have the
136 // plugin name as key and the desired plugin options as properties. Make sure you have
137 // the plugin installed before running any tests. The following plugins are currently
139 // WebdriverCSS: https://github.com/webdriverio/webdrivercss
140 // WebdriverRTC: https://github.com/webdriverio/webdriverrtc
141 // Browserevent: https://github.com/webdriverio/browserevent
144 // screenshotRoot: 'my-shots',
145 // failedComparisonsRoot: 'diffs',
146 // misMatchTolerance: 0.05,
147 // screenWidth: [320,480,640,1024]
153 // Test runner services
154 // Services take over a specific job you don't want to take care of. They enhance
155 // your test setup with almost no effort. Unlike plugins, they don't add new
156 // commands. Instead, they hook themselves up into the test process.
158 // Framework you want to run your specs with.
159 // The following are supported: Mocha, Jasmine, and Cucumber
160 // see also: http://webdriver.io/guide/testrunner/frameworks.html
162 // Make sure you have the wdio adapter package for the specific framework installed
163 // before running any tests.
166 // Test reporter for stdout.
167 // The only one supported by default is 'dot'
168 // see also: http://webdriver.io/guide/testrunner/reporters.html
169 reporters
: [ 'spec' ],
171 // Options to be passed to Mocha.
172 // See the full list at http://mochajs.org/
181 // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
182 // it and to build services around it. You can either apply a single function or an array of
183 // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
184 // resolved to continue.
186 // Gets executed once before all workers get launched.
187 // onPrepare: function ( config, capabilities ) {
190 // Gets executed before test execution begins. At this point you can access all global
191 // variables, such as `browser`. It is the perfect place to define custom commands.
192 // before: function (capabilities, specs) {
195 // Hook that gets executed before the suite starts
196 // beforeSuite: function (suite) {
199 // Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
200 // beforeEach in Mocha)
201 // beforeHook: function () {
204 // Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
205 // afterEach in Mocha)
207 // Function to be executed before a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
208 // beforeTest: function (test) {
211 // Runs before a WebdriverIO command gets executed.
212 // beforeCommand: function (commandName, args) {
215 // Runs after a WebdriverIO command gets executed
216 // afterCommand: function (commandName, args, result, error) {
219 // Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
220 // from https://github.com/webdriverio/webdriverio/issues/269#issuecomment-306342170
221 afterTest: function ( test
) {
222 var filename
, filePath
;
223 // if test passed, ignore, else take and save screenshot
227 // get current test title and clean it, to use it as file name
228 filename
= encodeURIComponent( test
.title
.replace( /\s+/g, '-' ) );
230 filePath
= this.screenshotPath
+ filename
+ '.png';
232 browser
.saveScreenshot( filePath
);
233 console
.log( '\n\tScreenshot location:', filePath
, '\n' );
236 // Hook that gets executed after the suite has ended
237 // afterSuite: function (suite) {
240 // Gets executed after all tests are done. You still have access to all global variables from
242 // after: function (result, capabilities, specs) {
245 // Gets executed after all workers got shut down and the process is about to exit. It is not
246 // possible to defer the end of the process using a promise.
247 // onComplete: function(exitCode) {