Comments (4)
Hi,
Well, for me this can definitely be a full replacement. I am not testing complex javascript pages, but rather clicking links and filling out basic forms.
So here is the situation:
With the help of someone at the Capybara group, I realized that this:
Capybara.register_driver :mechanize do |app|
Capybara::Mechanize::Driver.new app
end
should be changed to this:
Capybara.register_driver :mechanize do |app|
Capybara::Mechanize::Driver.new(proc {})
end
And then things are working without a rack app.
Here is the most minimal example repo I have created for the occasion.
Perhaps the initializer for Capybara::Mechanize::Driver.new
can have its "app" argument optional, and default to proc {}
? Or, if not, maybe something in the README to mention how to use this without a rack app?
Also, as for the default app that you pointed me to - yes, I am aware of this, but I only care about testing fully qualified external URLs, so I guess it will not come into play.
from capybara-mechanize.
I understand, assuming that my understanding is also correct when saying that even when using relative URLs, it will still bypass the default Rack::Test if Capybara.app_host
is set.
What I am saying (now that there is a solution) is this:
The original intention of Capybara-Mechanize (so it seems) was to be a "Rack::Test + external links" driver.
I think that it can also act as a very lightweight way to do general purpose acceptance tests on sites that are external (to the point of view of the feature definitions).
I have this kind of setup, and up until now I was working with the heavy weights webkit / selenium / poltergeist.
For this to be fully true, it should be able to initialize without a rack app. Right now it sort of does, by using the proc {}
app above, I wish this "implementation detail" would be hidden.
In other words, would it make sense to change line 6 here:
to something like:
def initialize(app=nil, **options)
app ||= proc {}
#...
from capybara-mechanize.
Hi @DannyBen, I don't know if this project is a full replacement for webkit/poltergesit, but I think mechanize should accept any URL. I believe this is described in the README here: https://github.com/jeroenvandijk/capybara-mechanize/#remote-testing
Can you share your current configuration or an example that is't working?
from capybara-mechanize.
TL;DR; It's not that capybara-mechanize requires an app, it's that the rack-test driver does.
The issue here is that capybara-mechanize derives from the rack-test driver, and the rack-test driver requires an app. If the user sticks to only visiting fully qualified urls then only the capybara-mechanize version of visit is used, and the rack-test driver version of visit (which is what requires the app to route to) is never called and therefore the app isn't strictly necessary.
from capybara-mechanize.
Related Issues (20)
- Issue with capybara 1.1.2 HOT 2
- Remote site with not empty path in app root fails to follow links HOT 1
- Turning Off SSL HOT 2
- Accessing popup windows HOT 13
- Incompatibility with capybara-email gem HOT 3
- Support for attach_file? HOT 3
- Capybara 2.0 Support HOT 1
- Running `rake db:create` throws up an `undefined method `today' for Date:Class (NoMethodError)` HOT 1
- Support for capturing exceptions / HTTP 401 HOT 5
- exception using capybara-mechanize with cucumber HOT 3
- Capybara 2.1 support HOT 1
- Should demand Capybara 2.1 is used HOT 3
- Mechanize returns first form value instead of last when they have the same name HOT 8
- 1.1.0 of this gem downgraded capybara HOT 3
- Mechanize does not load nested resources (js, css, images)
- Net::HTTP::Persistent::Error: too many connection resets (due to closed stream - IOError) after 0 requests on 70134061992860, last used 4.616483 seconds ago HOT 2
- Capybara::Mechanize::Node#click is broken on Ruby 3.0 HOT 2
- Mechoanize < 2.8.5 has vulnerability CVE-2022-31033 HOT 7
- Support Capybara >= 3.37 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capybara-mechanize.