grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-karma' );
grunt.loadNpmTasks( 'grunt-stylelint' );
- grunt.loadNpmTasks( 'grunt-webdriver' );
karmaProxy[ wgScriptPath ] = {
target: wgServer + wgScriptPath,
return require( 'path' ).join( dest, src.replace( 'resources/', '' ) );
}
}
- },
-
- // Configure WebdriverIO task
- webdriver: {
- test: {
- configFile: './tests/selenium/wdio.conf.js'
- }
}
-
} );
grunt.registerTask( 'assert-mw-env', function () {
"doc": "jsduck",
"postdoc": "grunt copy:jsduck",
"selenium": "./tests/selenium/selenium.sh",
- "selenium-test": "grunt webdriver:test"
+ "selenium-test": "wdio ./tests/selenium/wdio.conf.js"
},
"devDependencies": {
"bluebird": "3.5.1",
"grunt-jsonlint": "1.1.0",
"grunt-karma": "2.0.0",
"grunt-stylelint": "0.10.0",
- "grunt-webdriver": "2.0.3",
"karma": "1.7.1",
"karma-chrome-launcher": "2.2.0",
"karma-firefox-launcher": "1.0.1",
"browser": false
},
"rules":{
- "no-console":0
+ "no-console": 0
}
}
- [Chrome](https://www.google.com/chrome/)
- [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/)
- [Node.js](https://nodejs.org/en/)
-- [MediaWiki-Vagrant](https://www.mediawiki.org/wiki/MediaWiki-Vagrant)
-Set up MediaWiki-Vagrant:
+If using MediaWiki-Vagrant:
cd mediawiki/vagrant
vagrant up
By default, Chrome will run in headless mode. If you want to see Chrome, set DISPLAY
environment variable to any value:
- DISPLAY=:1 npm run selenium
+ DISPLAY=1 npm run selenium
To run only one file (for example page.js), you first need to spawn the chromedriver:
#!/usr/bin/env bash
set -euo pipefail
+# Check the command before running in background so
+# that it can actually fail and have a descriptive error
+hash chromedriver
chromedriver --url-base=/wd/hub --port=4444 &
# Make sure it is killed to prevent file descriptors leak
function kill_chromedriver() {