grunt-selenium-server
Start/stop a local Selenium standalon server.
Getting Started
npm install grunt-selenium-server --save-dev
Grunt config example (with default options):
module { grunt; grunt;};
Running grunt-selenium-server
Grunt task example:
grunt;
Run:
grunt devUI
Stopping grunt-selenium-server
Selenium will need to be stopped after it has started.
Set the autostop
option to true
The selenium proccess will stop when the grunt proccess ends.
'start-selenium-server': dev: options: autostop: true downloadUrl: 'https://selenium-release.storage.googleapis.com/2.46/selenium-server-standalone-2.46.0.jar'
Use grunt-force-task to force a task
Any tasks (expected) to fail will continue
grunt;
Create custom grunt.fail handler
Kill selenium in case your grunt tasks fails before we reach 'stop-selenium-server':
var seleniumChildProcesses = {};gruntevent; gruntutilhooker;
Notes:
-
If you won't handle this event, if your phpunit (for example) will fail the selenium server process will remain active in the background.
-
The "grunt.fail" event will be fired whenever any grunt task is failing. Thus you might want to consider using a more specific event related to the task that actually uses selenium server. i.e phpunit in the above example.