puffing-billy | A rewriting web proxy for testing interactions between your browser and external sites. Works with | Proxy library
kandi X-RAY | puffing-billy Summary
kandi X-RAY | puffing-billy Summary
Billy spawns an EventMachine-based proxy server, which it uses to intercept requests sent by your browser. It has a simple API for configuring which requests need stubbing and what they should return.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Sends a request to the server
- Reset all cached options
- Stores the cache .
- Generate a hash key
- Formats an HTTP url
- main loop
- Build HTTP request
- Record an HTTP request .
- Handle HTTP request
- Handle HTTP request
puffing-billy Key Features
puffing-billy Examples and Code Snippets
Community Discussions
Trending Discussions on puffing-billy
QUESTION
Imagine I have an app that uses Twitter API. In my app I only have a textarea and a button in which if I submit the form it will tweet to my account.
In my app I have the following routes:
...ANSWER
Answered 2019-Jan-09 at 06:13Puffing Billy is a programmable proxy which can be used to stub requests from the browser. In your case the requests you are looking to stub are coming from your app instead of the browser. Generally requests from your app would be stubbed using something like WebMock or by writing a fake service. The article - https://robots.thoughtbot.com/how-to-stub-external-services-in-tests - has a good summary of stubbing requests from inside your app.
Another potential option is if whatever library you're using to communicate with twitter provides it's own test mode.
QUESTION
I have an issue due adding the puffing-billy to my capybara-webkit features. I followed by instructions:
rails_helper.rb:
...ANSWER
Answered 2018-Feb-06 at 21:43This is most likely because you're using a very old version of capybara-webkit. If you don't need the latest Capybara lock the version of capybara-webkit in your Gemfile to ~>1.14 (latest release) If you do need the latest Capybara you'll have to tell your Gemfile to use the master branch of capybara-webkit.
QUESTION
Using the Puffing Billy instructions for rspec with capybara I created a simple test to stub a request using the :poltergeist_billy
driver resulting in error:
ANSWER
Answered 2017-Jul-28 at 04:51The errors are many here, so let's just start at the beginning
You don't have
require capybara/rails
in your spec_helper.rb or rails_helper.rb - https://github.com/teamcapybara/capybara#setup - this means Capybara.app isn't getting set and is why you're getting the "rack-test requires a rack application" - of course you don't really want to be using therack-test
driver for your current test which #3 will deal with.Capybara already includes Capybara::DSL into feature specs, so use feature specs, and remove the
include Capybara::DSL
from your RSpec config shown above. This requires either putting your spec file intospec/features/my_spec.rb
and enabling the RSpec config to determine test type by directory, or manually specifying that the test is a feature spec
QUESTION
Many things on the web seem to suggest that VCR can be used with Capybara.
I have three problems.
- This doesn't make much sense to me, because the test driver and the application code don't share memory.
- I'm not finding full recipes on how to set this up.
- I'm finding bits and pieces of how people have set this up, but it's outside of the context of rails 5.1, which does the capybara setup behind the scenes.
How do I configure a Rails 5.1 app, Capybara, and VCR to work together for system tests?
(My headless browser is phantomjs, driven by poltergeist. But I don't need to intercept requests from the browser, only server-side requests. If I needed to intercept from the browser I would probably use a full http proxy server, like puffing-billy.)
...ANSWER
Answered 2017-May-25 at 22:09I'm assuming you mean Rails 5.1 since Rails 5 doesn't have system tests.
The copy of the application Capybara runs for testing is run in a separate thread, not a separate process. This means they do have access to the same memory, and loaded classes
There is nothing special required for configuring WebMock or VCR beyond what their READMEs already provide
The setup of Capybara and how Rails handles it is irrelevant to the configuration of WebMock or VCR. Additionally, even when using Rails 5.1 system tests all of the normal Capybara configuration options are still usable.
That all being said, there are a couple of things to be aware of here. Firstly, WebMock/VCR can only deal with requests made by your app (not from the browser which you stated you don't need) and it's generally better to use faked services (if possible) rather than WebMock/VCR when doing end to end system tests since there is less interference with the code under test.
If this doesn't answer your issues, post a question with a specific issue you're having, the code that's causing your issue, and the error you're getting.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install puffing-billy
Note: :poltergeist_billy doesn't support proxying any localhosts, so you must use :webkit_billy, :apparition_billy, or a custom headless selenium registration for headless specs when using puffing-billy for other local rack apps. See this phantomjs issue for any updates.
It's good practice to reset the driver after each scenario, so having an @billy tag switches the drivers on for a given scenario. Also note that stubs are reset after each step, so any usage of a stub should be in the same step that it was created in.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page