capybara-webkit

NameError: uninitialized constant Capybara::Webkit.configure

我的梦境 提交于 2020-01-23 09:59:11
问题 I must not be understanding correctly where to place this method call. I have this test_helper.rb file ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' require 'minitest/rails/capybara' require 'capybara' require 'capybara/rails' require 'capybara/webkit' Dir[Rails.root.join('test/support/**/*.rb')].each { |f| require f } Capybara::Webkit.configure do |config| config.allow_unknown_urls end And I get this error when I run rake

Error while building native extensions for capybara-webkit

流过昼夜 提交于 2020-01-11 05:43:13
问题 I'm trying to install the webkit driver for capybara on Windows, and I'm getting the following error: $ gem install capybara-webkit-0.12.1.gem Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing capybara-webkit-0.12.1.gem: ERROR: Failed to build gem native extension. c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb Gem files will remain installed in c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/capybara

Capybara-webkit raises Capybara::Driver::Webkit::WebkitInvalidResponseError

醉酒当歌 提交于 2020-01-03 15:18:06
问题 I got following message from webkit driver in my rspec: Capybara::Driver::Webkit::WebkitInvalidResponseError: Unable to load URL: http://127.0.0.1:44923/posts Few days ago it worked. The problem is with save_page method. What could be wrong? 回答1: I've had similar error messages when my page was raising an error. You should check manually that this is not the case by starting a server in testing mode ( rails s -e test ) and accessing the page yourself. 回答2: Check if you don't have any other

$.ajax delete request not sending data parameters in capybara-webkit

走远了吗. 提交于 2020-01-02 05:46:13
问题 I'm finding that my ajax DELETE requests are not sending data parameters to the controller when I execute them through capybara-webkit. However, the data parameters do get sent (and the test passes) when I run the test suite by using selenium. My code looks like the following: $(document).on 'click', 'a.delete_contact', -> if confirm "Are you sure you want to delete this contact?" id = $('a.delete_contact').data('id') name = $('a.delete_contact').data('name') $.ajax '/contacts', type: 'DELETE

Upload file to an input area using FileApi

痞子三分冷 提交于 2019-12-24 16:19:25
问题 I'm using Capybara + RSpec and the capybara_webkit as driver. And a JS uploader with FileApi. I'm trying to upload three images here: <input type="file" name="image" multiple="" accept="image/*"> When I click on the "Select photos" button (on the browser), it opens the typical window where I can select 3 files from my computer . I'd like to know how to reproduce it on capybara, as when the photos selector opens, I don't have the control on it. I tried to add the pictures to my tests folder

Rspec Capybara test with ajax call not updating record

社会主义新天地 提交于 2019-12-24 05:31:31
问题 I have a form where when a user submits an ajax form with a single name field, a record is created that belongs to a Template object. This all works fine manually, but for some reason when I test this via rspec its telling me that the association was not created. Why isn't the template object updated here? describe "edit page" do before(:each) do visit edit_admin_template_path(template) end context "form sections", js: true do it "allows admin to create one" do find("#btn-add-section").click

Why does visiting my root path require warmup time to make my test data available?

两盒软妹~` 提交于 2019-12-24 02:06:14
问题 I am in the process of switching from capybara-webkit to poltergeist/phantomjs. I'm experiencing a timing problem and I've determined which line of code needs warmup time, but I can't determine why this is or how to solve it. I have a 225 line spec file with a couple dozen tests. On any given test run, 1 or 2 of them will consistently fail. It can be any of them, it's not consistent. This before block applies to all the tests. I've annotated the code to explain the situation. before do # -->

Using Capybara-Webkit, Inject Javascript before client code runs

喜你入骨 提交于 2019-12-24 00:03:19
问题 Is there a way to inject the javascript sooner? visit("/path/to/my/page") page.execute_script("document.getElementsByTagName('html')[0].className += ' hybrid-app';") I'm testing some things that only effect a web app when it is used from within a hybrid mobile app. My hybrid app related code does not run unless this class exists. From the native iOS code I inject some javascript which adds a class to the HTML tag before the page loads. The problem is that when do the same from the Capybara

Deprecation warning for capybara-webkit requiring Qt version 5

自闭症网瘾萝莉.ら 提交于 2019-12-23 22:13:33
问题 When I run rspec, I get the following message: The next major version of capybara-webkit will require at least version 5.0 of Qt. You're using version 4.8.6. I was not aware I was using Qt, so know nothing of the implications of upgrading it. How do I upgrade it and what precautions should I take before doing so? 回答1: equaleffect's comment above led me to ImNaN answer, i.e. Comment out the capybara and capybara-webkit gems from your gemfile. Then: bundle gem uninstall capybara-webkit gem