angularjs – 使用单个Gulp任务运行量角器

前端之家收集整理的这篇文章主要介绍了angularjs – 使用单个Gulp任务运行量角器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
有没有办法在单个任务中使用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)

必须有一种更简单的方法来运行这些测试.有什么想法吗?

这是一个可行的解决方
var 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);
原文链接:https://www.f2er.com/angularjs/142166.html

猜你在找的Angularjs相关文章