I have written a small piece of code just for launch a browser but I'm getting this error:
C:/Users/KASTURIPARIDA/RubymineProjects/Project1/features/support/driversettings.rb:6:in
<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.17/bin/cucumber:13:in
' C:/Ruby193/bin/cucumber:23:in load'
C:/Ruby193/bin/cucumber:23:in'
-e:1:in `load'
Here below are all the code:
Support:
require 'rubygems'
require 'watir-webdriver'
Selenium::WebDriver::Chrome::Service.executable_path = 'C:\Ruby193\bin\chromedriver.exe'
$driver=watir::Browser.new :Chrome
wait 5
Feature:
Feature: Application
Scenario: Login to Open
And I have account with Opencart and launch page
Step definition:
And(/^I have account with Opencart and launch page$/) do
puts "browser loading"
$driver.goto("https://www.facebook.com/")
end
Try this:
Support
require 'rubygems'
require 'watir'
Selenium::WebDriver::Chrome.driver_path = 'C:\Ruby193\bin\chromedriver.exe'
$driver = Watir::Browser.new('chrome')
Hope it helps.
Related
I want to use environment-specific variables in my non-Rails Ruby application.
I tried different file names like .env.test.local, .env.local, .env.test
I tried using the Dotenv.load and require 'dotenv/load' approaches
This is how I wrap the task
require 'rspec'
require 'rack/test'
require 'rspec/core/rake_task'
require 'dotenv/tasks'
task test: :dotenv do
RSpec::Core::RakeTask.new(:spec).run_task(verbose: true)
end
This is my server
require 'dotenv/load'
require 'sinatra'
require 'sinatra/reloader' if development?
set :bind, '0.0.0.0'
get ENV['API_URL'] do
'Hello World!'
end
My .env.test file
API_URL=/api/v1
Expected behavior
The API_URL variable should be available to the code run by the :test task (using bundle exec rake test).
Observed behavior
An error caused because ENV['API_URL'] is null.
/Users/mariogil/.rvm/rubies/ruby-2.6.3/bin/ruby -I/Users/mariogil/.rvm/gems/ruby-2.6.3/gems/rspec-core-3.8.0/lib:/Users/mariogil/.rvm/gems/ruby-2.6.3/gems/rspec-support-3.8.0/lib /Users/mariogil/.rvm/gems/ruby-2.6.3/gems/rspec-core-3.8.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
An error occurred while loading ./spec/server_spec.rb.
Failure/Error:
get ENV['API_URL'] do
'Hello World!'
end
TypeError:
NilClass can't be coerced into Mustermann::Pattern
# /Users/mariogil/.rvm/gems/ruby-2.6.3/gems/mustermann-1.0.3/lib/mustermann.rb:73:in `new'
# /Users/mariogil/.rvm/gems/ruby-2.6.3/gems/sinatra-2.0.5/lib/sinatra/base.rb:1641:in `compile'
# /Users/mariogil/.rvm/gems/ruby-2.6.3/gems/sinatra-2.0.5/lib/sinatra/base.rb:1629:in `compile!'
# /Users/mariogil/.rvm/gems/ruby-2.6.3/gems/sinatra-2.0.5/lib/sinatra/base.rb:1604:in `route'
# /Users/mariogil/.rvm/gems/ruby-2.6.3/gems/sinatra-2.0.5/lib/sinatra/base.rb:1386:in `get'
# /Users/mariogil/.rvm/gems/ruby-2.6.3/gems/sinatra-2.0.5/lib/sinatra/base.rb:1925:in `block (2 levels) in delegate'
# ./lib/server.rb:9:in `<top (required)>'
# ./spec/server_spec.rb:6:in `require'
# ./spec/server_spec.rb:6:in `<top (required)>'
No examples found.
Finished in 0.00026 seconds (files took 0.18951 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples
/Users/mariogil/.rvm/rubies/ruby-2.6.3/bin/ruby -I/Users/mariogil/.rvm/gems/ruby-2.6.3/gems/rspec-core-3.8.0/lib:/Users/mariogil/.rvm/gems/ruby-2.6.3/gems/rspec-support-3.8.0/lib /Users/mariogil/.rvm/gems/ruby-2.6.3/gems/rspec-core-3.8.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed
See the repo
I came up with this workaround
require 'dotenv'
require 'sinatra'
require 'sinatra/reloader' if development?
Dotenv.load(".env.#{ENV['APP_ENV']}") # Remember to set your app environment
set :bind, '0.0.0.0'
get ENV['API_URL'] do
'Hello World!'
end
It only works for .env.<ENVIROMENT> files. Maybe this could be wrapped in a function but I definitely would like this to be handled by the gem as in Rails applications, it makes more sense to me.
I use Watir and Watir-element-screenshot to get screenshot of elements.
Browser: Chrome and Firefox (latest versions)
My code:
require 'watir'
require 'watir/extensions/element/screenshot'
browser = Watir::Browser.new :firefox
browser.goto 'google.com.ua'
browser.text_field(id: "lst-ib").set "ruby\n"
browser.window.maximize
browser.element(id: "resultStats").screenshot("2.png")
browser.close
And take this error:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/chunky_png-1.3.8/lib/chunky_png/color.rb:968:in `scanline_bytesize': undefined method `>>' for 2439.0:Float (NoMethodError)
Did you mean? >
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/chunky_png-1.3.8/lib/chunky_png/canvas/png_encoding.rb:207:in `encode_png_image_pass_to_stream'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/chunky_png-1.3.8/lib/chunky_png/canvas/png_encoding.rb:174:in `encode_png_image_without_interlacing'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/chunky_png-1.3.8/lib/chunky_png/canvas/png_encoding.rb:161:in `encode_png_pixelstream'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/chunky_png-1.3.8/lib/chunky_png/canvas/png_encoding.rb:85:in `to_datastream'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/chunky_png-1.3.8/lib/chunky_png/image.rb:62:in `to_datastream'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/chunky_png-1.3.8/lib/chunky_png/canvas/png_encoding.rb:35:in `write'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/chunky_png-1.3.8/lib/chunky_png/canvas/png_encoding.rb:43:in `block in save'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/chunky_png-1.3.8/lib/chunky_png/canvas/png_encoding.rb:43:in `open'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/chunky_png-1.3.8/lib/chunky_png/canvas/png_encoding.rb:43:in `save'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/watir-extensions-element-screenshot-0.0.3/lib/watir/extensions/element/screenshot.rb:12:in `screenshot'
from 2.rb:11:in `<main>'
What the reason of this message and how can i repair it?
You can use this code to take screen shot and save in specific location.
browser.screenshot.save("path to save image/2.png")
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.
I would take a look at the answer to this question as it your error is the same save for the different port number
Opening several threads with watir-webdriver results in 'Connection refused' error
It looks like you maybe have multiple browsers trying to access the same port at the same time. Adding a sleep might fix it, but is not a best-practice solution. I would more clearly define your port numbers that each browser connects to.
How to run Cucumber headless tests on Jenkins Server (Linux)?
What's the proper way to use the 'headless' gem executing Cucumber/Watir-Webdriver tests on Jenkins?
First attempt:
I have this in my env.rb:
require 'rubygems'
require 'cucumber'
require 'rest_client'
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'
require 'phantomjs'
ENVT = FigNewton.load('staging.yml')
DATA = DataMagic.load('data.yml')
KBA = YAML.load_file('config/data/kba.yml')
#Actions performed before each scenario
headless = Headless.new
headless.start
browser = Watir::Browser.start
Before do
#browser = browser
end
at_exit do
browser.close
headless.destroy
end
World(PageObject::PageFactory)
And this is the output I get:
wrong number of arguments (0 for 1+) (ArgumentError)
/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:28:in `start'
/var/lib/jenkins/jobs/idme_revelator/workspace/features/support/env.rb:24:in `<top (required)>'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cucumber-1.3.18/lib/cucumber/rb_support/rb_language.rb:95:in `load'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cucumber-1.3.18/lib/cucumber/rb_support/rb_language.rb:95:in `load_code_file'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:180:in `load_file'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:82:in `each'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:184:in `load_step_definitions'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:42:in `run!'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cucumber-1.3.18/lib/cucumber/cli/main.rb:47:in `execute!'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cucumber-1.3.18/bin/cucumber:13:in `<top (required)>'
/var/lib/jenkins/.rbenv/versions/2.1.0/bin/cucumber:23:in `load'
/var/lib/jenkins/.rbenv/versions/2.1.0/bin/cucumber:23:in `<main>'
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Second Attempt:
When I make ONE change in the env file on this line:
browser = Watir::Browser.start
to
browser = Watir::Browser.new
Then I get this output, but still error:
Could not find Firefox binary (os=linux). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path= (Selenium::WebDriver::Error::WebDriverError)
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.45.0.dev3/lib/selenium/webdriver/firefox/binary.rb:127:in `path'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.45.0.dev3/lib/selenium/webdriver/firefox/binary.rb:60: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/firefox/binary.rb:34:in `start_with'
/var/lib/jenkins/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.45.0.dev3/lib/selenium/webdriver/firefox/launcher.rb:70:in `start_silent_and_wait'
Third Attempt:
If I change my env.rb file to:
require 'rubygems'
require 'cucumber'
require 'rest_client'
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'
require 'phantomjs'
ENVT = FigNewton.load('staging.yml')
DATA = DataMagic.load('data.yml')
KBA = YAML.load_file('config/data/kba.yml')
#Actions performed before each scenario
headless = Headless.new
headless.start
# browser = Watir::Browser.start
Before do
#browser = headless
end
at_exit do
#browser.close
headless.destroy
end
World(PageObject::PageFactory)
It looks a lot better but still fails:
WARN: Unresolved specs during Gem::Specification.reset:
mini_portile (~> 0.6.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Using the default profile...
#regression #hlp #hlp_admin
Feature: Test the HLP DocumentPage functionality
Background: # features/HLP_features/hlp_DocumentPage.feature:4
* I visit the Hosted Landing Page Admin tool # features/step_definitions/hlp/hlp_admin/hlp_admin_step_defs.rb:1
Unable to pick a platform for the provided browser. (RuntimeError)
./features/step_definitions/hlp/hlp_admin/hlp_admin_step_defs.rb:2:in `/^I visit the Hosted Landing Page Admin tool$/'
features/HLP_features/hlp_DocumentPage.feature:5:in `* I visit the Hosted Landing Page Admin tool'
* I login to the Hosted Landing Page Admin # features/step_definitions/hlp/hlp_admin/hlp_admin_step_defs.rb:5
* I visit the Add DocumentPage page # features/step_definitions/hlp/hlp_admin/hlp_admin_document_step_defs.rb:1
undefined method `window' for #<Headless:0x007f47cb1854b0> (NoMethodError)
/var/lib/jenkins/jobs/revelator/workspace/features/support/hooks.rb:23:in `After'
undefined method `driver' for #<Headless:0x007f47cb1854b0> (NoMethodError)
/var/lib/jenkins/jobs/revelator/workspace/features/support/hooks.rb:16:in `After'
Scenario: Add a new DocumentPage # features/HLP_features/hlp_DocumentPage.feature:9
* I create a new DocumentPage # features/step_definitions/hlp/hlp_admin/hlp_admin_document_step_defs.rb:5
* I should see DocumentPage edit page elements # features/step_definitions/hlp/hlp_admin/hlp_admin_document_step_defs.rb:10
* I delete the "DocumentPage" # features/step_definitions/hlp/hlp_admin/hlp_admin_edit_shared_step_defs.rb:1
So what's the proper way to use the 'headless' gem executing Cucumber/Watir-Webdriver tests on Jenkins?
UPDATE: How to use Xvfb and Watir?
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 'phantomjs'
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
Before do
#browser = browser
end
at_exit do
#browser.close
end
World(PageObject::PageFactory)
The last place I worked we did not use the headless gem, we just started up XVFB in the Jenkins script that ran the tests, before it issued the cucumber command that started the tests. And used Firefox as the browser. Thaat also allowed us to take screenshots on failing tests to aid with debugging the failures.
If I still worked there I would try using phantomjs also and see if it worked, then use whichever was more reliable, and/or faster.
Nothing was different in env.rb, same file we used for local runs we used on jenkins also.
EDIT: Update for late 2017.. with recent changes the current recommended best solution for headless browsing is using chrome along with chromedriver and chrome's new headless option.
The third error is because Headless is not a browser, just a virtual frame buffer. #browser = headless will not work, because it should be a Watir::Browser object. The virtual frame buffer is where your browser, like Firefox or Chrome draws objects.
Based on your list of requires, it looks like you're trying to run with PhantomJS. Watir::Browser.start requires a URL to navigate to as an argument, and will try to start Firefox by default, if you do not pass in :phantomjs, in addition to a url as an argument.
#base_url = "https://my-test-domain.com"
#browser = Watir::Browser.start #base_url, :phantomjs
Watir::Browser.new runs the browser as :firefox by default. If you want to use PhantomJS, pass :phantomjs as an argument.
browser = Watir::Browser.new :phantomjs
If you intend to use PhantomJS as your browser, you likely don't need the Headless gem, and can remove that from your env.rb.
Setup with cucumber, capybara and selenium but some scenarios works only randomly.
Running
ruby 1.8.6 on rvm
rails 2.3.8
selenium pops open firefox 3.6
I have tried to add this with no luck:
with_scope(selector) do
click_button(button)
selenium.wait_for_page_to_load
end
The error output is sometimes:
> Given I am logged in and have created newsletter and subscribers # features/step_definitions/newsletter_send_steps.rb:108
end of file reached (EOFError)
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/net/protocol.rb:133:in `sysread'
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill'
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/timeout.rb:62:in `timeout'
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/timeout.rb:93:in `timeout'
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/net/protocol.rb:126:in `readline'
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/net/http.rb:2020:in `read_status_line'
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/net/http.rb:2009:in `read_new'
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/net/http.rb:1050:in `request_without_fakeweb'
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/net/http.rb:1037:in `request_without_fakeweb'
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/net/http.rb:543:in `start'
/Users/christianhager/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/1.8/net/http.rb:1035:in `request_without_fakeweb'
./features/step_definitions/web_steps.rb:24:in `__instance_exec2'
./features/step_definitions/web_steps.rb:9:in `with_scope'
./features/step_definitions/web_steps.rb:9:in `with_scope'
./features/step_definitions/web_steps.rb:23:in `/^(?:|I )press "([^\"]*)"(?: within "([^\"]*)")?$/'
features/enhanced/newsletter_send1.feature:7:in `Given I am logged in and have created newsletter and subscribers'
And othertimes:
> no button with value or id or text 'create_user_button' found (Capybara::ElementNotFound)
./features/step_definitions/web_steps.rb:24:in `__instance_exec2'
./features/step_definitions/web_steps.rb:9:in `with_scope'
./features/step_definitions/web_steps.rb:9:in `with_scope'
./features/step_definitions/web_steps.rb:23:in `/^(?:|I )press "([^\"]*)"(?: within "([^\"]*)")?$/'
features/enhanced/newsletter_send1.feature:7:in `Given I am logged in and have created newsletter and subscribers'
And sometimes it just works....
This is how my env.rb looks like
ENV["RAILS_ENV"] ||= "cucumber"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
require 'cucumber/rails/world'
require 'cucumber/rails/active_record'
require 'cucumber/web/tableish'
require 'capybara/rails'
require 'capybara/cucumber'
require 'capybara/session'
require 'cucumber/rails/capybara_javascript_emulation'
require "selenium-webdriver"
Capybara.default_driver = :selenium
Capybara.default_wait_time = 5
Capybara.ignore_hidden_elements = false
Capybara.default_selector = :css
ActionController::Base.allow_rescue = false
require 'database_cleaner'
DatabaseCleaner.strategy = :truncation
Before do
Capybara.reset_sessions!
DatabaseCleaner.clean
end
Cucumber::Rails::World.use_transactional_fixtures = false
Cucumber-steps:
Given I am on the signup page
And I fill in "user_login" with "jeppsipeppsi#arcticelvis.com" within "body"
And I fill in "user_password" with "secret" within "body"
And I fill in "user_password_confirmation" with "secret" within "body"
And I check "terms_of_use" within "body"
And I press "create_user_button" within "body"
Any insight would be great :)
It's HTTP mocking, if you remove fakeweb or webmock from your environment (entirely), it should all work again.
The last comment by Adam Greene DOES WORK regarding setting up Curb with:
Selenium::WebDriver.for :firefox, :http_client => Selenium::WebDriver::Remote::Http::Curb
Read the thread on the Capybara group.
The problem we're having is playing back recorded http traffic using fakeweb or webmock since web driver is now Curb. So if you're goal was to fake out traffic over Capybara, you'll get browser testing to work again but you won't be able to play the traffic back over the same browser. (We're using VCR to record.)
Adding Curb support is listed as a "ticket" on the Fakeweb's Github Issues site.
I bumped into this in a Rails 2.3 app with cucumber/capybara/akephalos/fakeweb recently, but ultimately got to resolve this by completely killing all gems in my bundle (they where kept in .bundle/ and reinstalling.