Trying to run Cucumber/Watir-Webdriver on Jenkins using Xvfb (headless gem)
This is my env.rb:
require 'rubygems'
require 'cucumber'
require 'json'
require 'watir-webdriver'
require 'page-object'
require 'page-object/page_factory'
require 'allure-cucumber'
require 'rspec'
require 'data_magic'
require 'fig_newton'
require 'yaml'
require 'headless'
ENVT = FigNewton.load('staging.yml')
DATA = DataMagic.load('data.yml')
KBA = YAML.load_file('config/data/kba.yml')
headless = Headless.new
headless.start
browser = Watir::Browser.new :firefox
Before do
@browser = browser
end
at_exit do
@browser.close
headless.destroy
end
World(PageObject::PageFactory)
This is the error I'm getting:
end of file reached (EOFError)
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/2.1.0/net/protocol.rb:153:in `read_nonblock'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/2.1.0/net/protocol.rb:153:in `rbuf_fill'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/2.1.0/net/protocol.rb:134:in `readuntil'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/2.1.0/net/protocol.rb:144:in `readline'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/2.1.0/net/http/response.rb:39:in `read_status_line'
/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.45.0.dev3/lib/selenium/webdriver/remote/bridge.rb:640:in `raw_execute'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.45.0.dev3/lib/selenium/webdriver/remote/bridge.rb:618:in `execute'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.45.0.dev3/lib/selenium/webdriver/remote/bridge.rb:112:in `get'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.45.0.dev3/lib/selenium/webdriver/common/navigation.rb:14:in `to'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/browser.rb:77:in `goto'
/var/lib/jenkins/jobs/idme_revelator/workspace/features/support/hooks.rb:32:in `Before'
* I resize the browser # features/step_definitions/misc_step_defs.rb:1
Connection refused - connect(2) for "127.0.0.1" port 7055 (Errno::ECONNREFUSED)
./features/step_definitions/misc_step_defs.rb:2:in `/^I resize the browser$/'
How do I need to setup my env file to correctly run Cucumber/Watir-Webdriver using the headless gem (Xvfb)?
In some other attempts, errors have been related to undefined method 'goto', etc. In my tests other places like hooks.rb I use the variable @browser or @browser.driver, so I need those to work as well.
hooks.rb
(andmisc_step_def.rb
), you should edit your question and show that file. – orde