Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is proxy supported? #39

Closed
thbar opened this issue Jan 27, 2019 · 9 comments
Closed

Is proxy supported? #39

thbar opened this issue Jan 27, 2019 · 9 comments

Comments

@thbar
Copy link

thbar commented Jan 27, 2019

I'm trying to configure cuprite in a way that would use puffing-billy as a proxy (this is useful to mock any request, including external ones like Stripe or Recurly).

I attempted to do this:

require 'capybara/cuprite'
Capybara.javascript_driver = :cuprite

Capybara.register_driver :custom_billy do |app|
  driver = Capybara::Cuprite::Driver.new(app, {})
  driver.set_proxy(Billy.proxy.host, Billy.proxy.port)
  driver
end

Apparently the call to set_proxy raises a NotImplementedError.

Is this expected?

Many thanks!

@thbar
Copy link
Author

thbar commented Jan 27, 2019

Ah my bad - I didn't grep correctly and missed this:

https://github.com/machinio/cuprite/blob/2da175ad85066f005209b75e3f437004b70294f9/lib/capybara/cuprite/browser.rb#L123-L125

Indeed it's not supported yet.

I'm unsure how hard it would be to support this.

I'll leave this opened for now, but please feel free to close if you feel this is out of scope!

@route
Copy link
Member

route commented Jan 28, 2019

@thbar I can add proxy support pretty quick but there's one downside you can set it only when browser starts and there's no way currently to change it on fly, as Chrome doesn't support it cyrus-and/chrome-remote-interface#152

@thbar
Copy link
Author

thbar commented Jan 28, 2019

@route is the browser starting once per test suite? Or instead (as I assume) once per test? If it's once per test, it's perfectly acceptable as a limitation (& not causing any trouble in my case at least).

@route
Copy link
Member

route commented Jan 28, 2019

In general you start browser once and then reset after each test, but in this case proxy options will be passed as command line options so reset won't help, you have to restart browser after each test and this will slow down everything.

@thbar
Copy link
Author

thbar commented Jan 28, 2019

To clarify: I use multiple drivers in this test suite: one is custom_billy (specs are tagged with driver: :custom_billy), and these ones are all using a proxy. The other one will be a "regular" cuprite, so a différent driver instance etc.

If I understand well this means that each "driver type" will start a browser once, and it will be fast enough.

In all cases, I can provide feedback if you implement this (but don't feel forced to do so if you feel it's not the good moment or not a good feature! my use case is pretty exotic!).

@route
Copy link
Member

route commented Jan 28, 2019

@thbar in fact we needed proxies too, this was the beginning of cuprite we wanted too many exotic features :) will roll it out in an hour or so I think ;)

@route
Copy link
Member

route commented Jan 28, 2019

I pushed changes 9ddeddf for basic support, though it is missing auth and runtime proxy rotation

@thbar
Copy link
Author

thbar commented Jan 28, 2019

@route thanks! I will try this out & will report back.

@thbar
Copy link
Author

thbar commented Jan 28, 2019

@route I was able to set the proxy, and it mostly worked, but my suite is regressing for some weird reason at this point. I cannot pinpoint it exactly at this point, but will investigate!

I will still close, because I believe the proxy support is already in master & providing value as is. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants