diff options
author | Željko Filipin <zeljko.filipin@gmail.com> | 2016-12-19 17:39:29 +0100 |
---|---|---|
committer | Željko Filipin <zeljko.filipin@gmail.com> | 2017-03-14 12:20:32 +0100 |
commit | 7aee98758a97cde1e111297b2e3706544d3fe2c8 (patch) | |
tree | d612eaa8560eaec118d2200b7b7571927794714d /Gruntfile.js | |
parent | 1949b15d1a762464186c7ce658a6a9d3c33cab06 (diff) | |
download | mediawikicore-7aee98758a97cde1e111297b2e3706544d3fe2c8.tar.gz mediawikicore-7aee98758a97cde1e111297b2e3706544d3fe2c8.zip |
Selenium tests in Node.js using WebdriverIO
Introduce the WebdriverIO browser testing framework driven by Node.js.
The overall intents are:
* have MediaWiki core to provide a platform to run tests that is shared
between core and the extensions.
* phase out ruby driven browser tests eventually.
Code is namespaced in sub directory /tests/selenium
The 'pages' sub directory provides helper representing a MediaWiki page
such as Special:Login and human friendly helpers to interact with the
elements.
Add Grunt task webdriver:test.
Provide a npm script to easily spawn/dispose chromedriver and run above
grunt task.
wdio.conf.js provides all the configuration. It defaults to point to a
MediaWiki-Vagrant installation on http://127.0.0.1:8080. Can be
overriden with environment settings as needed.
glob patterns (specs) are made absolute paths from MediaWiki root path
that let us run the tests either from the root path (eg the npm
wrapper or from the tests/selenium directory when invoking wdio
directly. wdio assumes they are relative to the current working
directory, hence the normalization.
wdio.conf.jenkins.js extends the configuration and is used solely for
Jenkins. The switch is done from the Gruntfile.js whenever JENKINS_HOME
is set. Specially we want junit reports to be generated.
Provide a more specific eslint configuration.
References:
* MALU https://phabricator.wikimedia.org/source/malu/
* T151442 Research WebdriverIO
* T151443 Research Nightwatch.js
Bug: T139740
Signed-off-by: Antoine Musso <hashar@free.fr>
Change-Id: Ibe7a004a120e82af637ab3e31b725de743134c99
Diffstat (limited to 'Gruntfile.js')
-rw-r--r-- | Gruntfile.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Gruntfile.js b/Gruntfile.js index 0e1c8cb2c282..1ecc2c032fab 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,6 +4,7 @@ module.exports = function ( grunt ) { var wgServer = process.env.MW_SERVER, wgScriptPath = process.env.MW_SCRIPT_PATH, + WebdriverIOconfigFile, karmaProxy = {}; grunt.loadNpmTasks( 'grunt-banana-checker' ); @@ -13,12 +14,19 @@ module.exports = function ( grunt ) { grunt.loadNpmTasks( 'grunt-jsonlint' ); grunt.loadNpmTasks( 'grunt-karma' ); grunt.loadNpmTasks( 'grunt-stylelint' ); + grunt.loadNpmTasks( 'grunt-webdriver' ); karmaProxy[ wgScriptPath ] = { target: wgServer + wgScriptPath, changeOrigin: true }; + if ( process.env.JENKINS_HOME ) { + WebdriverIOconfigFile = './tests/selenium/wdio.conf.jenkins.js'; + } else { + WebdriverIOconfigFile = './tests/selenium/wdio.conf.js'; + } + grunt.initConfig( { eslint: { all: [ @@ -105,7 +113,15 @@ module.exports = function ( grunt ) { return require( 'path' ).join( dest, src.replace( 'resources/', '' ) ); } } + }, + + // Configure WebdriverIO task + webdriver: { + test: { + configFile: WebdriverIOconfigFile + } } + } ); grunt.registerTask( 'assert-mw-env', function () { |