本文介绍了黄瓜无头 xvfb ubuntu的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在 Amazon EC2 上设置 Jenkins 构建服务器.我计划在无头模式下运行我的黄瓜测试套件.我成功地在 IRB 中无头运行
I'm trying to setup a Jenkins build server on Amazon EC2. I'm planning on running my cucumber test suite in headless mode.I was successfully able to run headless in IRB
require 'watir-webdriver'
require 'headless'
headless = Headless.new
headless.start
b = Watir::Browser.new(:chrome)
b.goto("www.google.com")
b.title
b.close
headless.destroy
但如果我将以下内容添加到我的 env.rb
but if I add the following to my env.rb
if ENV['HEADLESS']
require 'headless'
headless = Headless.new
headless.start
at_exit do
headless.destroy
end
end
然后运行
cucumber ENV=HEADLESS features/test.feature:25
我收到以下错误.
end of file reached (EOFError)
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/protocol.rb:141:in `read_nonblock'
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill'
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request'
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/http.rb:1293:in `request'
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/http.rb:1286:in `block in request'
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/http.rb:745:in `start'
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/net/http.rb:1284:in `request'
/var/lib/jenkins/.rvm/gems/ruby-1.9.3-p286@cucumber/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:82:in `response_for'
/var/lib/jenkins/.rvm/gems/ruby-1.9.3-p286@cucumber/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:38:in `request'
/var/lib/jenkins/.rvm/gems/ruby-1.9.3-p286@cucumber/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
/var/lib/jenkins/.rvm/gems/ruby-1.9.3-p286@cucumber/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:598:in `raw_execute'
/var/lib/jenkins/.rvm/gems/ruby-1.9.3-p286@cucumber/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:92:in `create_session'
/var/lib/jenkins/.rvm/gems/ruby-1.9.3-p286@cucumber/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
/var/lib/jenkins/.rvm/gems/ruby-1.9.3-p286@cucumber/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/chrome/bridge.rb:29:in `initialize'
/var/lib/jenkins/.rvm/gems/ruby-1.9.3-p286@cucumber/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver.rb:37:in `new'
/var/lib/jenkins/.rvm/gems/ruby-1.9.3-p286@cucumber/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver.rb:37:in `for'
/var/lib/jenkins/.rvm/gems/ruby-1.9.3-p286@cucumber/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver.rb:65:in `for'
/var/lib/jenkins/.rvm/gems/ruby-1.9.3-p286@cucumber/gems/watir-webdriver-0.6.1/lib/watir-webdriver/browser.rb:35:in `initialize'
/var/lib/jenkins/automation/features/support/hooks.rb:9:in `new'
/var/lib/jenkins/automation/features/support/hooks.rb:9:in `Before'
Given I am on the login page
And login as a blogger
Then I must see the text "Blog List"
undefined method `driver' for nil:NilClass (NoMethodError)
/var/lib/jenkins/automation/features/support/hooks.rb:27:in `After'
undefined method `close' for nil:NilClass (NoMethodError)
/var/lib/jenkins/automation/features/support/hooks.rb:17:in `After'
任何帮助将不胜感激.谢谢!!
Any help will be appreciated. Thanks!!
推荐答案
问题出在命令行 env 参数中
The problem was in the command line env parameter
cucumber HEADLESS=true features/test.feature:25
而不是
cucumber ENV=HEADLESS features/test.feature:25
这篇关于黄瓜无头 xvfb ubuntu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!