X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/categories/modifier.php?a=blobdiff_plain;f=tests%2Fselenium%2Fwdio.conf.js;h=cf9da0c1ce7453322b0adc1cb7e3315fda1f849d;hb=d6f84e825c5b2ea214b460c5a8b204927213e75c;hp=adbd8c352f8888a6be03769b793ca6d60ae5f6bc;hpb=7f3d6713e7191c476adb3d3c30344a0327b853d3;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/selenium/wdio.conf.js b/tests/selenium/wdio.conf.js index adbd8c352f..cf9da0c1ce 100644 --- a/tests/selenium/wdio.conf.js +++ b/tests/selenium/wdio.conf.js @@ -1,10 +1,11 @@ -/* eslint comma-dangle: 0 */ -/* eslint no-undef: "error" */ -/* eslint no-console: 0 */ /* eslint-env node */ +/* eslint no-undef: "error" */ +/* eslint-disable no-console, comma-dangle */ 'use strict'; -const path = require( 'path' ); +const password = 'vagrant', + path = require( 'path' ), + username = 'Admin'; function relPath( foo ) { return path.resolve( __dirname, '../..', foo ); @@ -24,10 +25,10 @@ exports.config = { // Use if from tests with: // browser.options.username username: process.env.MEDIAWIKI_USER === undefined ? - 'Admin' : + username : process.env.MEDIAWIKI_USER, password: process.env.MEDIAWIKI_PASSWORD === undefined ? - 'vagrant' : + password : process.env.MEDIAWIKI_PASSWORD, // // ====== @@ -49,7 +50,8 @@ exports.config = { specs: [ relPath( './tests/selenium/specs/**/*.js' ), relPath( './extensions/*/tests/selenium/specs/**/*.js' ), - relPath( './extensions/VisualEditor/modules/ve-mw/tests/selenium/specs/**/*.js' ) + relPath( './extensions/VisualEditor/modules/ve-mw/tests/selenium/specs/**/*.js' ), + relPath( './skins/*/tests/selenium/specs/**/*.js' ), ], // Patterns to exclude. exclude: [ @@ -114,12 +116,12 @@ exports.config = { // with "/", then the base url gets prepended. baseUrl: ( process.env.MW_SERVER === undefined ? - 'http://127.0.0.1:8080' : - process.env.MW_SERVER + 'http://127.0.0.1:8080' : + process.env.MW_SERVER ) + ( process.env.MW_SCRIPT_PATH === undefined ? - '/w' : - process.env.MW_SCRIPT_PATH + '/w' : + process.env.MW_SCRIPT_PATH ), // // Default timeout for all waitFor* commands. @@ -217,8 +219,21 @@ exports.config = { // }, // // Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts. - // afterTest: function (test) { - // }, + // from https://github.com/webdriverio/webdriverio/issues/269#issuecomment-306342170 + afterTest: function ( test ) { + var filename, filePath; + // if test passed, ignore, else take and save screenshot + if ( test.passed ) { + return; + } + // get current test title and clean it, to use it as file name + filename = encodeURIComponent( test.title.replace( /\s+/g, '-' ) ); + // build file path + filePath = this.screenshotPath + filename + '.png'; + // save screenshot + browser.saveScreenshot( filePath ); + console.log( '\n\tScreenshot location:', filePath, '\n' ); + }, // // Hook that gets executed after the suite has ended // afterSuite: function (suite) {