phillbaker / capybara-mechanize Goto Github PK
View Code? Open in Web Editor NEWRackTest driver for Capybara with remote request support
License: MIT License
RackTest driver for Capybara with remote request support
License: MIT License
from '~> 2.0', '>= 2.0.1'
, which allows anything lower than 3.0
to '~> 2.1.0'
which only allows versions lower than 2.2
Hello. Your work is very good! Thank you.
But I have some trouble.
I have scenario that works with remote server. Remote server steps:
capybara-mechanize works very good with first get request, but don't work with post request.
logs:
Redirected to http://some.other.doamin.com/page
Completed 302 Found in 726ms
Started POST "/other_page" for 127.0.0.1 at 2010-10-12 13:09:47 +0400
First redirection to https://some.other.doamin.com/page is ok, but capybara did local post instead remote post.
form code on another site:
form method="post" action="other_page"
Just a heads up that a few methods need to be changed/added for Capybara 2.1 support.
An rc was recently released: teamcapybara/capybara#984
Vanilla install of cucumber-rails. Rails 3.0.20. Ruby 1.8.7.
$ bundle exec cucumber
Using the default profile...
/var/bundler/turtle/ruby/1.8/gems/activesupport-3.0.20/lib/active_support/test_case.rb:14: warning: already initialized constant Mocha
/var/bundler/turtle/ruby/1.8/gems/capybara-mechanize-0.4.0.rc1/lib/capybara/mechanize/browser.rb:38: syntax error, unexpected '=', expecting '|'
define_method(method) do |path, params = {}, env = {}, &block|
^
/var/bundler/turtle/ruby/1.8/gems/capybara-mechanize-0.4.0.rc1/lib/capybara/mechanize/browser.rb:38: syntax error, unexpected tAMPER
define_method(method) do |path, params = {}, env = {}, &block|
^
/var/bundler/turtle/ruby/1.8/gems/capybara-mechanize-0.4.0.rc1/lib/capybara/mechanize/browser.rb:171: syntax error, unexpected kEND, expecting $end (SyntaxError)
/var/bundler/turtle/ruby/1.8/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in `require'
/var/bundler/turtle/ruby/1.8/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in `require'
/var/bundler/turtle/ruby/1.8/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:227:in `load_dependency'
/var/bundler/turtle/ruby/1.8/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in `require'
/var/bundler/turtle/ruby/1.8/gems/capybara-mechanize-0.4.0.rc1/lib/capybara/mechanize/driver.rb:1
Gemfile:
group :test do
gem 'cucumber-rails', '~> 1.3.0', :require => false
gem 'capybara', '~> 2.0.2', :require => false
gem "capybara-mechanize", "~> 0.4.0.rc1", :require => false
end
You shoould add such lines to Gemfile:
gem "ruby-debug", :platforms => :ruby_18
gem "ruby-debug19", :platforms => :ruby_19
If you want you can use my pull request
Failed with such error:
And show me the page # features/step_definitions/web_steps.rb:217
"\xD0" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
./features/step_definitions/web_steps.rb:218:in `/^show me the page$/'
features/test_acquiring.feature:59:in `And show me the page'
Ruby 1.9, Rails 3
P.S. Sorry for long answer of previous ticket
Switching to the mechanize driver, which I need to test external urls, is breaking some of my capybara tests.
It looks like there's an incompatibility with this gem and the capybara-email gem. When I use click_link on an email, I get the following error. It works fine with standard capybara.
NoMethodError: undefined method `url' for #<Capybara::Mechanize::Driver:0x7f8afb0>
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/capybara-email-0.1.2/lib/capybara/email/driver.rb:14:in `follow'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/capybara-email-0.1.2/lib/capybara/email/node.rb:15:in `click'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/capybara-1.1.2/lib/capybara/node/element.rb:99:in `block in click'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/capybara-1.1.2/lib/capybara/node/base.rb:46:in `wait_until'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/capybara-1.1.2/lib/capybara/node/element.rb:99:in `click'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/capybara-1.1.2/lib/capybara/node/actions.rb:27:in `click_link'
When using Capybara-mechanize to test a remote (PHP) application that has a not empty app root url, following links on the site fails. For example, if the app is located at "http://localhost/myapp" and there's a link to a login page that goes to "/myapp/login" (which works correctly from all web browsers), this driver will follow the link to "http://localhost/myapp/myapp/login" which does not work.
The problem appears to be caused in the File.join call in lib/capybara/mechanize/browser.rb:169
I just got the following output:
Using the default profile...
---......
Failing Scenarios:
cucumber features/display_pages.feature:6 # Scenario:
cucumber features/display_pages.feature:6 # Scenario:
2 scenarios (2 failed)
6 steps (6 passed)
0m1.460s
So all steps are passing, but scenarios are failing anyway. What gives? This only happens when Capybara.default_driver
is set to :mechanize
.
Currently the code for the Capybara::Driver::Mechanize#put
looks like this:
def put(url, params = {}, headers = {})
if remote?(url)
process_remote_request(:put, url)
else
...
end
end
As you can see the params
and headers
are not sent to process_remote_request
. Since this code has been like this for a long time I am wondering if this is intentional? If so, what is the reason?
I wanted to ask first but if this is indeed a bug I would be willing to send in a pull request for this.
I was hoping Mechanize can be a replacement for the outdated webkit / poltergeist drivers, so that I can just visit "http://some.domain.com"
and it will work, even when called without any Rack application.
Was I wrong?
In standard Mechanize, I can turn off SSL as follows:
agent = Mechanize.new
agent.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE
How can I do this with capybara-mechanize?
Thanks in advance!
I have scenario with no @mechinize tags:
Scenario: Confirming a user with a wrong code
Given there are no users
And I am on the confirmation page with code "AAA"
Then I should see "Code"
When I run all cucumber features/
it failed with errors:
(::) failed steps (::)
404 => Net::HTTPNotFound (Mechanize::ResponseCodeError)
./features/step_definitions/web_steps.rb:20:in `/^(?:|I )am on (.+)$/'
features/manage_users.feature:5:in `And I am on the confirmation page with code "AAA"'
But when I run only one feature cucumber features/manage_users.feature
it is ok! No failures!
Very strange situation.
Basically I have a form that has no action on it. When the form is posted, it will not work out the absolute path, and just posts to to the Capybara.app_host default. E.g.
Received the following error for a GET request to http://dev.bbc.co.uk/: '404 => Net::HTTPNotFound' (RuntimeError)
(eval):2:in `click_button'
Thanks
Matt
I'm filling a form field of Rails type, e.g.
When I try to fill out the field with:
fill "user_email", :with => "[email protected]"
fill "user_password", :with => "pw"
Then the RackTest driver will convert this into a parameter hash the way Rails would pass it to a controller, i.e.:
{"user" => { "email" => "[email protected]", "password" => "pw"} }
This doesn't get properly flatted back to a string such as "user[email]=[email protected]", instead the default .to_s operation is used which produces the wrong result and the server gets the wrong parameters.
The upshot is that in the present form this gem doesn't seem to be usable against a Rails app with standard form fields.
The changes to make capybara-mechanize compatible with Capybara 2.1 make it incompatible with Capybara 2.0. The dependencies should reflect this.
I'm getting often this error:
Net::HTTP::Persistent::Error:
too many connection resets (due to closed stream - IOError) after 0 requests on 70134061992860, last used 4.616483 seconds ago
A fairly common practice in authentication of Twitter apps via OAuth is to redirect to the authorize endpoint in a popup window. I'm not able to use Selenium to fully test because it doesn't handle redirects (AFAIK), but mechanize doesn't handle popup windows
main, popup = page.driver.browser.window_handles
within_window(popup) do
# fill in login info here and click authorize
end
Any suggestions on how to handle this or if it would be possible to add window handling to capybara-mechanize? Thanks.
Capybara show only "Not Found". Is it possible to make it work?
Hello,
Is there any way to test for a HTTP 401 ? I'd like to have a test for making sure HTTP auth is in place on a remote site. Right now capybara-mechanize throws an exception and aborts.
I think this pull req is related:
Thanks
I bumped the mechanize dependency and ran the tests. I got a lot of failures that look like this:
Capybara::Driver::Mechanize, in local model should include the right host when remote
Failure/Error: @driver.visit("#{REMOTE_TEST_URL}/host")
Received the following error for a GET request to http://localhost/host: 'connection refused: localhost:80'
My hunch is that the new version of net-http-persistent and artifice are having trouble coexisting but I wasn't able to pin it down exactly.
Any thoughts? I'd love to resolve this.
Config:
Capybara.default_host = "myhost.com"
I send request to remote server with return_url = http://myhost.com/welcome_back . cucumber make some necessary actions on remote server and then remote server redirects user to return_url, but cucumber redirect to real myhost.com instead of local test server. And my tests fail.
Capybara DSL methods like #click_link
work on Ruby 2.7 but fail on Ruby 3.0:
% gem info capybara capybara-mechanize
*** LOCAL GEMS ***
capybara (3.35.3)
Authors: Thomas Walpole, Jonas Nicklas
Homepage: https://github.com/teamcapybara/capybara
License: MIT
Installed at: /Users/tom/.gem/ruby/3.0.0
Capybara aims to simplify the process of integration testing Rack
applications, such as Rails, Sinatra or Merb
*** LOCAL GEMS ***
capybara-mechanize (1.11.0)
Author: Jeroen van Dijk
Homepage: https://github.com/jeroenvandijk/capybara-mechanize
Installed at: /Users/tom/.gem/ruby/3.0.0
RackTest driver for Capybara with remote request support
% ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
% irb
>> require 'capybara/mechanize'
=> true
>> session = Capybara::Session.new(:mechanize, -> env { [200, {}, ['<a href="/bar">foo</a>']] })
=> #<Capybara::Session>
>> session.visit '/'
=> nil
>> session.click_link 'foo'
Traceback (most recent call last):
⋮
11: from …/gems/capybara-3.35.3/lib/capybara/session.rb:762:in `click_link'
⋮
4: from …/gems/capybara-mechanize-1.11.0/lib/capybara/mechanize/node.rb:12:in `click'
3: from …/gems/capybara-3.35.3/lib/capybara/rack_test/node.rb:131:in `click'
2: from …/gems/capybara-3.35.3/lib/capybara/rack_test/node.rb:131:in `call'
1: from …/gems/capybara-3.35.3/lib/capybara/rack_test/node.rb:67:in `click'
ArgumentError (wrong number of arguments (given 2, expected 0..1))
I think this is because we’re calling super
with implicit arguments in Capybara::Mechanize::Node#click
. This calls Capybara::RackTest::Node#click
in the superclass which accepts a single positional keys
argument and **options
keyword arguments. Ruby 3.0 has stopped silently coercing a final hash argument into keyword arguments, so the hash appears as a second positional argument and causes an ArgumentError
:
% irb
>> class A
def foo(x, **y); end
end
=> :foo
>> class B < A
def foo(x = [], y = {}); super; end
end
=> :foo
>> B.new.foo
ArgumentError (wrong number of arguments (given 2, expected 1))
Superficially the solution would appear to be to change the second Capybara::Mechanize::Node#click
argument from offset = {}
to **offset
(actually **options
now) so that it matches the signature of #click
in the superclass, but I don’t know what the implications of that might be.
I could be wrong, but it doesn't look to me like capybara-mechanize supports uploading files. I can drop into mechanize itself and accomplish the upload, e.g.:
visit '/companies'
page.should have_content company_name
click_on company_name
page.driver.browser.agent.current_page.form_with(id: 'new_file') do |form|
form.file_uploads.first.file_name = ROOT.join('spec/fixtures/apollo.pdf').to_s
end.submit
visit '/companies'
click_on company_name
page.should have_content 'apollo.pdf'
And the logs on the server confirm that a file got properly sent to the action:
Processing by CompaniesController#create_file as */*
Parameters: {"utf8"=>"✓", "authenticity_token"=>"Hl8Te6ZkbPtLcRPndAcda+CFBXAD+HqTocow3BSPQ1Q=", "file"=>{"company_id"=>"18", "asset"=>#<ActionDispatch::Http::UploadedFile:0x00000005114ea0 @original_filename="apollo.pdf", @content_type="application/pdf", @headers="Content-Disposition: form-data; name=\"file[asset]\"; filename=\"apollo.pdf\"\r\nContent-Transfer-Encoding: binary\r\nContent-Type: application/pdf\r\n", @tempfile=#<File:/tmp/RackMultipart20120809-2040-yndv4f>>}, "company_id"=>"18-system-test-at-2012-08-09-15-31-57-0400"}
But I can't seem to get the following, more desirable, all-capybara technique to work:
visit '/companies'
page.should have_content company_name
click_on company_name
attach_file 'file[asset]', ROOT.join('spec/fixtures/apollo.pdf')
click_on 'Upload'
page.should have_content 'apollo.pdf'
In that case, the last assertion fails:
Failure/Error: page.should have_content 'apollo.pdf'
expected #has_content?("apollo.pdf") to return true, got false
And the logs on the server reveal that it's a Rack::Test::UploadedFile
that got sent, rather than a ActionDispatch::Http::UploadedFile
:
Processing by CompaniesController#create_file as */*
Parameters: {"authenticity_token"=>"2x6R+LZAdl1HoQEAJ/Cq0KaThEKeZH4pFUM1SYTOZYk=", "utf8"=>"✓", "commit"=>"Upload", "file"=>{"asset"=>"#<Rack::Test::UploadedFile:0x007fe453ae4450>", "company_id"=>"19"}, "company_id"=>"19-system-test-at-2012-08-09-15-37-00-0400"}
Is it the case that it's just not supported (yet), or have others done this and I'm just doing something wrong?
Thank you for a great gem!
I'm trying to test case when client visits one domain and gets cookie for another domain via image. But i found that Mechanize does not load nested resources. Is it possible to enable in this feature?
Thanks
I had an issue with the capybara-mechanize.gemspec file when I'm running rake db:create
on a Rails project where I'm involved. Everytime I run rake db:create
, it throws up an error message listed below:
/home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/bundler/gems/capybara-mechanize-68184da411d2/capybara-mechanize.gemspec:11:in `block in <main>': undefined method `today' for Date:Class (NoMethodError)
from /home/emmanne/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1369:in `initialize'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/bundler/gems/capybara-mechanize-68184da411d2/capybara-mechanize.gemspec:5:in `new'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/bundler/gems/capybara-mechanize-68184da411d2/capybara-mechanize.gemspec:5:in `<main>'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler.rb:318:in `eval'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler.rb:318:in `eval_gemspec'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler.rb:298:in `block in load_gemspec_uncached'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler.rb:293:in `chdir'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler.rb:293:in `load_gemspec_uncached'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler.rb:283:in `load_gemspec'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler/source/path.rb:116:in `block in load_spec_files'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler/source/path.rb:115:in `each'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler/source/path.rb:115:in `load_spec_files'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler/source/git.rb:177:in `load_spec_files'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler/source/path.rb:86:in `local_specs'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler/source/git.rb:149:in `specs'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler/lazy_specification.rb:52:in `__materialize__'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler/spec_set.rb:86:in `block in materialize'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler/spec_set.rb:83:in `map!'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler/spec_set.rb:83:in `materialize'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler/definition.rb:114:in `specs'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/gems/bundler-1.3.0.pre.2/lib/bundler/environment.rb:22:in `specs'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@global/gems/rubygems-bundler-1.1.0/lib/rubygems-bundler/noexec.rb:56:in `candidate?'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@global/gems/rubygems-bundler-1.1.0/lib/rubygems-bundler/noexec.rb:74:in `setup'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@global/gems/rubygems-bundler-1.1.0/lib/rubygems-bundler/noexec.rb:89:in `<top (required)>'
from /home/emmanne/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /home/emmanne/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /home/emmanne/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/bin/ruby_noexec_wrapper:9:in `<main>'
After doing a bit of Googling, I found a temporary work-around at https://gist.github.com/Irio/1886102 wherein I added a require "date"
line just below the require "capybara/mechanize/version"
line in the capybara-mechanize.gemspec file (/home/emmanne/.rvm/gems/ruby-1.9.3-p374@et/bundler/gems/capybara-mechanize-68184da411d2/capybara-mechanize.gemspec). Afterwards running rake db:create
worked back to normal. I'm not sure how this issue came up as it wasn't like this on my development environment last month but I'll list my development environment below anyway.
VM: VMWare Workstation 9.0.1 build-894247
OS: Ubuntu 12.10 (32 bit)
RVM 1.18.5 (stable) with the following default global gems:
(though I'm using Bundler 1.3.0.pre.2 on my project RVM gemset)
Ruby 1.9.3p374 (2013-01-15 revision 38858) [i686-linux]
PostgreSQL 9.1.7
Gemfile
source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.11'
gem 'bundler', '>=1.3.0.pre.2'
gem 'rake', '10.0.3'
gem 'pg','0.14.1'
gem 'make_flaggable','0.1.0', :git => 'git://github.com/cavneb/make_flaggable.git'
gem 'jquery-rails' ,'2.1.4'
#gem 'formtastic' ,'2.2.1'
gem 'formtastic-bootstrap' ,'2.0.0'
gem 'carmen-rails','1.0.0.beta3'
gem 'carrierwave' ,'0.7.1'
gem 'mini_magick' ,'3.4'
gem 'fog','1.8.0'
gem 'sendgrid','1.1.0'
gem 'geocoder','1.1.6'
gem 'meta_search','1.1.3', :git => 'git://github.com/ernie/meta_search.git'
gem 'bourbon','3.0.1'
gem 'devise','2.1.2'
gem 'kaminari','0.14.1'
gem 'inherited_resources','1.3.1'
gem 'arbre','1.0.1'
gem 'client_side_validations','3.2.1', :git => 'https://github.com/bcardarella/client_side_validations.git'
gem 'client_side_validations-formtastic','2.2.1'
gem 'remotipart','1.0.2', :git => 'https://github.com/JangoSteve/remotipart.git'
gem 'ckeditor','3.7.3', :git => 'https://github.com/artdevil/ckeditor.git'
gem 'backup-task','0.2.0'
gem 'dropbox-sdk', '~> 1.2.0'
gem 'dropbox'
gem 'whenever','0.8.1', require: false
gem 'friendly_id', '~> 4.0.9'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass','2.2.2.0'
gem 'uglifier', '>= 1.0.3'
gem 'jquery-datatables-rails','1.11.2'
end
group :development, :test do
gem 'rspec','2.12.0'
gem 'rspec-rails','2.12.0'
gem 'guard-rspec', '1.2.1'
gem 'guard-spork', '1.2.0'
gem 'spork', '0.9.2'
gem 'capybara','1.1.4'
gem 'capybara-webkit', '~> 0.12.1'
gem 'capybara-mechanize','0.3.0', :git => 'git://github.com/jeroenvandijk/capybara-mechanize.git'
gem 'launchy','2.1.2'
gem 'factory_girl_rails','4.1.0'
gem 'test-unit','2.5.3'
gem 'ruby-prof','0.12.0'
gem 'database_cleaner','0.9.1'
gem 'fakeweb','1.3.0'
gem 'debugger','1.2.3'
end
group :integration, :staging, :production do
gem 'newrelic_rpm','3.5.5.38'
end
gem 'simplecov','0.7.1', :require => false, :group => :test
# Multilanguage
gem 'tolk','1.3.4'
# so we pass the locale properly to the user in the path /en/ or /ko/
gem 'routing-filter','0.3.1'
# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'omniauth','1.1.1'
gem 'omniauth-identity','1.1.0'
gem 'omniauth-facebook' ,'1.4.1'
#To get the countries List
gem 'countries','0.8.4'
gem 'activeadmin','0.5.1'
gem 'rack-google-analytics','0.11.0'
gem 'money-rails','0.7.1'
gem 'will_paginate','3.0.3'
gem 'cancan','1.6.8'
#SEO
gem 'sitemap_generator','3.4'
gem 'activemerchant','1.29.3'
Any chance we can get an update?
Hi,
I'm having issues bundle installing capybara-mechanize
this is the error I get:
Bundler could not find compatible versions for gem "capybara":
In Gemfile:
capybara-mechanize (>= 0) ruby depends on
capybara (= 0.3.9) ruby
capybara (1.1.2)
Many thanks,
CJ
When Capybara processes a form post in Rails, it will call the process method with form attributes which are nested against the model name, like so:
{
:user => {
:username => 'foo'
:password => 'bar'
}
}
If the form is submitted as a local request the flattening of these form field values occurs in Capybara::Mechanize::Browser#post which calls #post_data.
{
'user[username]' => 'foo',
'user[password]' => 'bar'
}
However remote requests do not call #post_data and as such do not flatten the form parameters. This results in incorrect form data being passed to mechanize.
We have one failing capybara 2.1 session test. The failing test includes the following html:
<label for="form_terms_of_use">Terms of Use</label>
<input type="hidden" name="form[terms_of_use]" value="0" id="form_terms_of_use_default">
<input type="checkbox" name="form[terms_of_use]" value="1" id="form_terms_of_use">
The test asserts that the value returned is the second input with the value of "1". Mechanize is currently returning "0".
Commit 3341388 restricted Capybara versions to <= 3.36. Capybara has released 3.38 already and the Gems will get more out of sync as time progresses.
Breaking change in Capybara:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.