Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Capybara.configure do |config|
- # we must force the value of the capybara server port. We have to do that because puffing-billy
- # saves everything locally for a specific host and port. But, capybara starts your rack application
- # on a new port each time you run your tests. The consequence is puffing-billy
- # is not able to reuse the created cache files and tries to do all the API call again.
- # source - kevin.disneur.me/archives/2015-03-05-end-to-end-tests-in-javascript.html
- config.server_port = 60001
- # source: comments in coderwall.com/p/jsutlq, enable to load save_and_open page with css and js
- config.asset_host = 'http://localhost:3000'
- end
- require 'billy/capybara/rspec'
- Billy.configure do |c|
- c.cache = true
- c.cache_request_headers = false
- c.persist_cache = true
- c.non_successful_cache_disabled = true
- c.non_successful_error_level = :warn
- c.whitelist = ['localhost', '127.0.0.1', 'https://res.cloudinary.com']
- c.ignore_cache_port = true
- c.cache_path = "spec/support/http_cache/billy/"
- # Only set non_whitelisted_requests_disabled **temporarily**
- # to false when first recording a 3rd party interaction. After
- # the recording has been stored to cache_path, then set
- # non_whitelisted_requests_disabled back to true.
- c.non_whitelisted_requests_disabled = true
- end
- context "non signed in visitor", js: true, billy: true do
- describe "Spinner shows while waiting then disappears" do
- it "should work" do proxy.stub("https://res.cloudinary.com/demo/image/upload/sample.jpg").and_return(
- Proc.new { |params, headers, body|
- sleep 10
- {code: 200}
- }
- )
- visit actual_deal_page_path(deal)
- # detect spinner
- expect(page).to have_css('div#fullPageLoadingSpinner', visible: :visible)
- # check subsequent image elements not yet visible
- expect(page).to have_no_css("img[src*='https://res.cloudinary.com/demo/image/upload/sample.jpg']")
- # then after 15 seconds, the cloudinary image finally is loaded and
- # the spinner disappears
- sleep 15
- expect(page).to have_css('div#fullPageLoadingSpinner', visible: :hidden)
- expect(page).to have_css("img[src*='https://res.cloudinary.com/demo/image/upload/sample.jpg']", visible: :visible)
- end
- end
- end
- <section
- id="introImg"
- <img src="https://res.cloudinary.com/demo/image/upload/sample.jpg" class="cld-responsive deal-page-bckdImgCover"
- </section>
- puffing-billy: CACHE KEY for 'https://res.cloudinary.com:443/demo/image/upload/sample.jpg' is 'get_res.cloudinary.com_2c4fefdac8978387ee341535c534e21e2588ed76'
- puffing-billy: Connection to https://res.cloudinary.com:443/demo/image/upload/sample.jpg not cached and new http connections are disabled
- puffing-billy: CACHE KEY for 'https://res.cloudinary.com:443/demo/image/upload/sample.jpg' is 'get_res.cloudinary.com_2c4fefdac8978387ee341535c534e21e2588ed76'
- puffing-billy: Connection to https://res.cloudinary.com:443/demo/image/upload/sample.jpg not cached and new http connections are disabled
- puffing-billy: CACHE KEY for 'https://res.cloudinary.com:443/demo/image/upload/sample.jpg' is 'get_res.cloudinary.com_2c4fefdac8978387ee341535c534e21e2588ed76'
- puffing-billy: Connection to https://res.cloudinary.com:443/demo/image/upload/sample.jpg not cached and new http connections are disabled
- puffing-billy: CACHE KEY for 'https://res.cloudinary.com:443/demo/image/upload/sample.jpg' is 'get_res.cloudinary.com_2c4fefdac8978387ee341535c534e21e2588ed76'
- puffing-billy: Connection to https://res.cloudinary.com:443/demo/image/upload/sample.jpg not cached and new http connections are disabled
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement