protractorを使ってテストをする際に、事前にwebdriver-manager updateを実行する必要があります。
通常は、
$ npm install -g protractor
を実行した後、
$ webdriver-manager update
を実行する。
上記をnpm install した後にgulp 経由で実行する方法です。
package.jsonの中身(devDependenciesとscriptsを抜粋したもの)
私が実際に使っているgulpfileでは、postinstall後にもう少し別のタスクを実行しているので、
webdriver-updateを別タスクとして登録し、postinstallに依存させています。
{
"devDependencies": {
"gulp": "^3.8.10",
"gulp-protractor": "0.0.12",
"protractor": "^1.5.0"
},
"scripts": {
"postinstall": "gulp postinstall"
}
}gulpfile.jsの中身
var gulp = require('gulp');
var webdriver_update = require('gulp-protractor').webdriver_update;
gulp.task('webdriver-update',webdriver_update);
gulp.task('postinstall',['bower','webdriver-update']);これで、npm installしただけで、webdriver-manager updateを実行してくれます。
参考
mllrsohn/gulp-protractor · GitHub
上記リポジトリのsampleフォルダの中のGulpfile.jsが参考になります。