2 /* eslint no-undef: "error" */
3 /* eslint-disable no-console, comma-dangle */
6 const password
= 'vagrant',
7 path
= require( 'path' ),
10 function relPath( foo
) {
11 return path
.resolve( __dirname
, '../..', foo
);
22 // Define any custom variables.
25 // Use if from tests with:
26 // browser.options.username
27 username
: process
.env
.MEDIAWIKI_USER
=== undefined ?
29 process
.env
.MEDIAWIKI_USER
,
30 password
: process
.env
.MEDIAWIKI_PASSWORD
=== undefined ?
32 process
.env
.MEDIAWIKI_PASSWORD
,
38 services
: [ 'sauce' ],
39 user
: process
.env
.SAUCE_USERNAME
,
40 key
: process
.env
.SAUCE_ACCESS_KEY
,
45 // Define which test specs should run. The pattern is relative to the directory
46 // from which `wdio` was called. Notice that, if you are calling `wdio` from an
47 // NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
48 // directory is where your package.json resides, so `wdio` will be called from there.
51 relPath( './tests/selenium/specs/**/*.js' ),
52 relPath( './extensions/*/tests/selenium/specs/**/*.js' ),
53 relPath( './extensions/VisualEditor/modules/ve-mw/tests/selenium/specs/**/*.js' ),
54 relPath( './skins/*/tests/selenium/specs/**/*.js' ),
56 // Patterns to exclude.
58 // 'path/to/excluded/files'
64 // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
65 // time. Depending on the number of capabilities, WebdriverIO launches several test
66 // sessions. Within your capabilities you can overwrite the spec and exclude options in
67 // order to group specific specs to a specific capability.
69 // First, you can define how many instances should be started at the same time. Let's
70 // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
71 // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
72 // files and you set maxInstances to 10, all spec files will get tested at the same time
73 // and 30 processes will get spawned. The property handles how many capabilities
74 // from the same test should run tests.
78 // If you have trouble getting all important capabilities together, check out the
79 // Sauce Labs platform configurator - a great tool to configure your capabilities:
80 // https://docs.saucelabs.com/reference/platforms-configurator
82 // For Chrome/Chromium https://sites.google.com/a/chromium.org/chromedriver/capabilities
84 // maxInstances can get overwritten per capability. So if you have an in-house Selenium
85 // grid with only 5 firefox instances available you can make sure that not more than
86 // 5 instances get started at a time.
89 browserName
: 'chrome',
90 // Since Chrome v57 https://bugs.chromium.org/p/chromedriver/issues/detail?id=1625
92 args
: [ '--enable-automation' ]
96 // ===================
97 // Test Configurations
98 // ===================
99 // Define all options that are relevant for the WebdriverIO instance here
101 // By default WebdriverIO commands are executed in a synchronous way using
102 // the wdio-sync package. If you still want to run your tests in an async way
103 // e.g. using promises you can set the sync option to false.
106 // Level of logging verbosity: silent | verbose | command | data | result | error
109 // Enables colors for log output.
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 "/", then the base url gets prepended.
118 process
.env
.MW_SERVER
=== undefined ?
119 'http://127.0.0.1:8080' :
120 process
.env
.MW_SERVER
122 process
.env
.MW_SCRIPT_PATH
=== undefined ?
124 process
.env
.MW_SCRIPT_PATH
127 // Default timeout for all waitFor* commands.
128 waitforTimeout
: 20000,
130 // Default timeout in milliseconds for request
131 // if Selenium Grid doesn't send response
132 connectionRetryTimeout
: 90000,
134 // Default request retries count
135 connectionRetryCount
: 3,
137 // Initialize the browser instance with a WebdriverIO plugin. The object should have the
138 // plugin name as key and the desired plugin options as properties. Make sure you have
139 // the plugin installed before running any tests. The following plugins are currently
141 // WebdriverCSS: https://github.com/webdriverio/webdrivercss
142 // WebdriverRTC: https://github.com/webdriverio/webdriverrtc
143 // Browserevent: https://github.com/webdriverio/browserevent
146 // screenshotRoot: 'my-shots',
147 // failedComparisonsRoot: 'diffs',
148 // misMatchTolerance: 0.05,
149 // screenWidth: [320,480,640,1024]
155 // Test runner services
156 // Services take over a specific job you don't want to take care of. They enhance
157 // your test setup with almost no effort. Unlike plugins, they don't add new
158 // commands. Instead, they hook themselves up into the test process.
160 // Framework you want to run your specs with.
161 // The following are supported: Mocha, Jasmine, and Cucumber
162 // see also: http://webdriver.io/guide/testrunner/frameworks.html
164 // Make sure you have the wdio adapter package for the specific framework installed
165 // before running any tests.
168 // Test reporter for stdout.
169 // The only one supported by default is 'dot'
170 // see also: http://webdriver.io/guide/testrunner/reporters.html
171 reporters
: [ 'spec' ],
173 // Options to be passed to Mocha.
174 // See the full list at http://mochajs.org/
183 // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
184 // it and to build services around it. You can either apply a single function or an array of
185 // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
186 // resolved to continue.
188 // Gets executed once before all workers get launched.
189 // onPrepare: function ( config, capabilities ) {
192 // Gets executed before test execution begins. At this point you can access all global
193 // variables, such as `browser`. It is the perfect place to define custom commands.
194 // before: function (capabilities, specs) {
197 // Hook that gets executed before the suite starts
198 // beforeSuite: function (suite) {
201 // Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
202 // beforeEach in Mocha)
203 // beforeHook: function () {
206 // Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
207 // afterEach in Mocha)
209 // Function to be executed before a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
210 // beforeTest: function (test) {
213 // Runs before a WebdriverIO command gets executed.
214 // beforeCommand: function (commandName, args) {
217 // Runs after a WebdriverIO command gets executed
218 // afterCommand: function (commandName, args, result, error) {
221 // Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
222 // from https://github.com/webdriverio/webdriverio/issues/269#issuecomment-306342170
223 afterTest: function ( test
) {
224 var filename
, filePath
;
225 // if test passed, ignore, else take and save screenshot
229 // get current test title and clean it, to use it as file name
230 filename
= encodeURIComponent( test
.title
.replace( /\s+/g, '-' ) );
232 filePath
= this.screenshotPath
+ filename
+ '.png';
234 browser
.saveScreenshot( filePath
);
235 console
.log( '\n\tScreenshot location:', filePath
, '\n' );
238 // Hook that gets executed after the suite has ended
239 // afterSuite: function (suite) {
242 // Gets executed after all tests are done. You still have access to all global variables from
244 // after: function (result, capabilities, specs) {
247 // Gets executed after all workers got shut down and the process is about to exit. It is not
248 // possible to defer the end of the process using a promise.
249 // onComplete: function(exitCode) {