poltergeist

Webshot gem is not capturing the finished page

半世苍凉 提交于 2019-12-13 18:45:44
问题 I am attempting to take screen shots of maps generated with mapbox. I successfully took screenshots until I started storing my data in a file, which mapbox recommends if you have a lot of data. (https://www.mapbox.com/help/working-with-large-geojson-data/#store-geojson-at-url) Now I get a white screen. I've added a timeout. It doesn't seem to matter how long I wait. I believe the data should be loaded via Ajax. I'm running this against a locally running web server. When I view the page using

How to run Capybara against a Rails server?

删除回忆录丶 提交于 2019-12-13 04:44:34
问题 I have a test that uses OAuth2 gem to make make an HTTP request: token = client.auth_code.get_token( code, redirect_uri:redirect_uri ) Capybara does not seem to be running the Rails app as a server: Faraday::ConnectionFailed: Connection refused - connect(2) for "localhost" port 3000 Here is the config: Capybara.app_host = "http://localhost:3000" Capybara.run_server = true Capybara.server_port = 3000 Capybara.register_driver :rack_test do |app| Capybara::RackTest::Driver.new app, follow

Triggering click event with modifier keys on input element

拜拜、爱过 提交于 2019-12-12 12:25:57
问题 I'm writing a test for some functionality that involves user shift-clicking on a checkbox. I'm using $('input').trigger($.Event('click', { shiftKey: true })); to simulate that. But when the event listener gets called, event.shiftKey property always gets reported as false when originating from my synthetic events, while real clicks produce the desired effect. What's more confusing, triggering the same event on a non- input element seems to work just fine. See http://jsfiddle.net/huskssk1/ for

Poltergeist Stripe checkout.js

不问归期 提交于 2019-12-12 07:59:45
问题 I'm trying to test in my Rails app the Stripe checkout popup (http://www.stripe.com/checkout). I was using Capybara + selenium-driver and everything worked well. When the page is loaded, the checkout.js adds an iframe, and I was able to access it within_frame('stripe_checkout_app') do do something end Now, switching to Poltergeist, I get this error: Failure/Error: within_frame('stripe_checkout_app') do Capybara::Poltergeist::FrameNotFound: The frame 'stripe_checkout_app' was not found. and if

Does poltergeist support capybara's should_not RSpec matchers correctly?

℡╲_俬逩灬. 提交于 2019-12-12 03:53:20
问题 According to capybara's README: The two following statements are functionally equivalent: page.should_not have_xpath('a') page.should have_no_xpath('a') However, when trying this out, that does not appear to be true. This seems to work fine when using capybara-webkit: visit dashboard_accounting_reports_path click_link 'Delete' page.should_not have_css('#reports .report') But when using poltergeist, it often fails with this, which seems to say it's using #has_css? under the covers, which won't

How does one test the content of confirm dialogs using poltergeist?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 14:21:36
问题 The capybara-webkit driver allows you to test the content of any confirm dialog messages that are triggered by the app. Is there a way to do this in poltergeist? 回答1: It's not supported in poltergeist now but there's a workaround to check the content manually. In our project we use a helper method to override the javascript confirm function, store the message and check the content. # helper method def handle_js_confirm page.evaluate_script 'window.confirmMsg = null' page.evaluate_script

Permission denied error with phantomjs

泄露秘密 提交于 2019-12-11 06:46:11
问题 I am using Rails 4.0.2, Guard 2.2.4, guard-rspec 4.2.4, rspec-rails 2.14.0, Capybara 2.2.1 and Poltergeist 1.5.0 on Ruby 2.0.0-p353 and OSX Mavericks. When I run bundle exec guard I got a lot of failure with this error message : An error occurred in an after hook Errno::EACCES: Permission denied - /usr/local/Cellar/phantomjs occurred at /Users/gillesmath/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/open3.rb:211:in `spawn' I checked the permission on /usr/local/Cellar/phantomjs and didn't notice

Net::ReadTimeout: Net::ReadTimeout and Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start on Rails 5.1.beta System Test

我与影子孤独终老i 提交于 2019-12-10 16:44:24
问题 Enthusiastic about the baking of Capybara into the new version of Rails (5.1) cf http://weblog.rubyonrails.org/2017/2/23/Rails-5-1-beta1/ I have run into a problem though. Here are my steps. Any clue welcome. Brand new install of: Linux Ubuntu Desktop 16.10 (VM on Hyper-V), with Chrome installed and running fine; Ruby 2.4; Rails 5.1.beta. 1.- Create a simple app: ~$ ruby -v ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux] ~$ rails -v Rails 5.1.0.beta1 ~$ mkdir railsapps ~$ cd railsapps

How can I test in Capybara that a page has *not* reloaded (JavaScript onClick intercept has worked)?

回眸只為那壹抹淺笑 提交于 2019-12-10 14:46:04
问题 I am using Capybara, Cucumber and Poltergeist. I am testing a JavaScript function that is attached to a form submit button, which is intended to catch the submit event and prevent it (doing an AJAX request in the background). With and without AJAX, the page will end up looking the same, but the AJAX approach is much faster and does not interrupt the browsing experience etc. What can I do to test that the form was indeed not submitted, and that the changes are the result of a dynamic AJAX call

@javascript cucumber tests pass using selenium driver but fail when using poltergiest

十年热恋 提交于 2019-12-09 16:50:17
问题 I'm trying to test an jquery UI autocomplete, I've got the tests passing using the selenium driver. I want to switch to poltergiest for some headless testing, but now my tests are now failing. It doesn't seem to select the autocomplete option for some reason that I have yet been able to figure out Step When /^select contract$/ do VCR.use_cassette("contract") do selector = '.ui-menu-item a:contains("John Smith (123456)")' within("div#review") do fill_in("contract", with: "john") end sleep 2