2015-10-05 26 views
3

端對端測試有以下protractor.conf.js:自動運行的webdriver在咕嘟咕嘟

exports.config = { 
    framework: 'jasmine', 
    specs: ['e2e-tests/**/*.js'], 
    seleniumAddress: 'http://127.0.0.1:4444/wd/hub', 
    seleniumServerJar: './node_modules/protractor/selenium/selenium-server-standalone-2.47.1.jar' 
} 

咕嘟咕嘟任務:

gulp.task('e2e-testing', ['webdriver_standalone'], function() { 
    gulp.src([]).pipe(protractor({ configFile: "protractor.conf.js" })) 
    .on('error', function(e) { throw e }) 
}); 

此代碼的工作很好,但我必須在開始之前執行webdriver-manager start --standalonee2e任務。我怎樣才能省略它?我怎樣才能自動做到這一點?在此先感謝

回答

3

只需刪除seleniumAddress配置選項以使Protractor在啓動測試套件時自行實例化新服務器。否則,如果指定了服務器地址,則Protractor會嘗試連接到它,而不是創建一個新地址。在部分看看起價測試腳本in the docs服務器:

請注意,如果您設置seleniumAddress,爲 seleniumServerJar,seleniumPort,seleniumArgs設置,sauceUser和sauceKey 將被忽略。