我想整合黃瓜量角器,雖然安裝程序按預期工作(測試失敗並正常成功),我得到令人討厭的ECONNREFUSED錯誤,使我的反饋不可讀。量角器 - 黃瓜:令人討厭的ECONNFIFED錯誤,雖然按預期工作
問題1:ECONNFRESED錯誤的確切含義是什麼?我不太瞭解反饋意見,也找不到好的文檔。
問題2:我的設置有什麼問題?我的設置是否正確?
問題3:有人在量角器上用黃瓜在流浪箱中進行BDD測試嗎?示例代碼,請:)
依賴
npm i protractor cucumber selenium-webdriver chai chai-as-promised express grunt-protractor-runner protractor-cucumber --save-dev
正如你看到的,我通過咕嚕運行的流浪漢盒內我的命令。流浪者箱子只有firefox,我不確定這是個問題,量角器之前運行得很好。
終端反饋
[[email protected] web-src]$ grunt protractor:singlerun
Running "protractor:singlerun" (protractor) task
Using the selenium server at http://localhost:4444/wd/hub
Feature: Blog
As a user
I want to visit blog
So that I can stay informed about a topic
Scenario: A disclaimer scenario # tests/e2e/cucumber/features/Blog.feature:6
/var/www/miyagi/web-src/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131
var session = webdriver.promise.controlFlow().execute(function() {
^
Error: ECONNREFUSED connect ECONNREFUSED
at <anonymous>
at <anonymous>
at <anonymous>
at <anonymous>
at <anonymous>
at <anonymous>
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/var/www/miyagi/web-src/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131:49)
at Function.webdriver.WebDriver.createSession (/var/www/miyagi/web-src/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:111:30)
at Builder.build (/var/www/miyagi/web-src/node_modules/protractor/node_modules/selenium-webdriver/builder.js:106:20)
at HostedDriverProvider.getDriver (/var/www/miyagi/web-src/node_modules/protractor/lib/driverProviders/hosted.js:63:9)
at /var/www/miyagi/web-src/node_modules/protractor/lib/runner.js:241:41
at _fulfilled (/var/www/miyagi/web-src/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/var/www/miyagi/web-src/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/var/www/miyagi/web-src/node_modules/protractor/node_modules/q/q.js:759:13)
at /var/www/miyagi/web-src/node_modules/protractor/node_modules/q/q.js:573:44
>>
>> Test failed but keep the grunt process alive.
Done, without errors.
[[email protected] web-src]$
量角器配置
// conf.js
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['../cucumber/features/*.feature'],
multiCapabilities: [{
browserName: 'firefox'
}],
onPrepare: function() {
var width = 1024;
var height = 600;
browser.driver.manage().window().setSize(width, height);
// implicit and page load timeouts
browser.manage().timeouts().pageLoadTimeout(40000);
browser.manage().timeouts().implicitlyWait(25000);
// for non-angular page
browser.ignoreSynchronization = true;
},
framework: 'cucumber',
cucumberOpts: {
require: '../cucumber/features/*.steps.js',
format: 'pretty'
}
};
咕嚕任務
protractor: {
options: {
configFile: '<%=tests %>/e2e/protractor/config.js', // Default config file
noColor: false, // If true, protractor will not use colors in its output
keepAlive: true
},
auto : {
keepAlive: true // If false, the grunt process stops when the test fails.
},
singlerun: {}
},
功能
Feature: Blog
As a user
I want to visit blog
So that I can stay informed about a topic
Scenario: A disclaimer scenario
Given I visit blog
Then I should see a disclaimer
步驟
//http://chaijs.com/
var chai = require('chai');
//https://github.com/domenic/chai-as-promised/
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
module.exports = function() {
var url = 'http://dev.com/search',
searched = url + '#/?q=food&page_number=1&sort=relevance',
driver,
resultsA, resultsB, resultsC,
page,
site;
this.Given(/^I visit blog$/, function(callback) {
browser.get(url);
driver = browser.driver;
browser.getTitle()
.then(function (title) {
expect(browser.getTitle()).to.eventually.equal(arg1).and.notify(callback);
});
});
this.Then(/^I should see a disclaimer$/, function(callback) {
element(by.css ('.disclaimer'))
.isDisplayed()
.then(function (el) {
expect(el).to.have.length(1);
callback();
});
});
};
乾杯
謝謝你的回答,它恰好從vagrant自動設置一個硒服務器,當我運行我得到的兩個命令'錯誤:沒有顯示指定',我不是得到任何結果,沒有運行命令我得到我的結果,但我也得到ECONNREFUSED錯誤 – 2014-09-23 09:23:59
如果你在一個虛擬機,你可能需要運行['xvfb'](http://en.wikipedia .org/wiki/Xvfb),一個「xserver虛擬幀緩衝區」,用於在無GUI的服務器環境中運行無頭firefox/chrome瀏覽器。 – Droogans 2014-09-29 15:20:23
我會仔細檢查一下,但我認爲我們已經這樣做了。 – 2014-10-01 15:58:44