有没有办法在单个任务中使用Protractor和Gulp运行e2e测试?
现在,为了运行e2e测试,我必须打开3个单独的shell并运行以下命令:
webdriver-manager update webdriver-manager start npm start (which runs the app server) protractor protractor.conf.js (in a separate window)
必须有一种更简单的方法来运行这些测试.有什么想法吗?
这是一个可行的解决方案
原文链接:/angularjs/142166.htmlvar protractor = require("gulp-protractor").protractor; var spawn = require('child_process').spawn; //run webdriver method function runWebdriver(callback) { spawn('webdriver-manager',['start'],{ stdio: 'inherit' }).once('close',callback); } //run protractor.config method function runProtractorConfig() { gulp.src('./**/*-page.spec.js') .pipe(protractor({ configFile: 'protractor.config.js' })) .on('error',function (e) { throw e; }); } //execute protractor.config after webdriver is executed function runWebdriverProtractor(){ runWebdriver(runProtractorConfig); } //put them into gulp task gulp.task('run-protractor',runWebdriverProtractor);