capybara-webkit

Capybara can't find select box for Semantic-ui

泪湿孤枕 提交于 2019-12-23 12:53:05
问题 I use capybara with capybara-webkit and Semantic-ui , but it seams that dropdowns doesn't work out of box, because <select> element is hidden: # feature_spec.rb select 'option1', from: 'Options' $ rspec feature_spec.rb Capybara::ElementNotFound: Unable to find select box "Options" Do you have working solutions for this? 回答1: I've created this helper: # for Semantic-ui dropdown def select_from_dropdown(item_text, options) # find dropdown selector dropdown = find_field(options[:from], visible:

capybaraWebKit is unable to visit webpages when running RSpec tests when :js => true

怎甘沉沦 提交于 2019-12-23 01:59:31
问题 On previous RSpec integration tests where :js => false (i.e., JavaScript was turned off), my tests were running just fine. However, for RSpec tests where :js => true (and therefore needing to use capybara WebKit), I consistently get the following error: Unable to load URL: http://my.server:5000/auth/identity because of error loading http://my.server:5000/auth/identity: Unknown error Noted this is happening on a line of code that was working just fine when :js => false (it is part of a method

RSpec+Capybara request specs w/ JS not working

一曲冷凌霜 提交于 2019-12-22 09:32:55
问题 I cannot get request specs working when using Javascript. My specs pass if I run them without Javascript (the page is built to work with or without JS). Specifically, the specs fail when I do assertions like Post.should have(1).record . Capybara just doesn't pick up the records from the DB, and the database is not cleaned between runs. I've tried using DatabaseCleaner with transactional fixtures disabled - the common approach to this, I guess. No dice. I've also tried (and, would ideally

Capybara: Unable to find css

两盒软妹~` 提交于 2019-12-18 18:38:06
问题 I am using capybara to click a checkbox, however it can't seem to find it no matter what I do. I am able to correctly find both the span and the label inside the span, but not the input I actually need. Here is the checkbox <span class="checkbox tos"> <input id="agreement" name="agreement" onclick="agreeValidate();" type="checkbox" value="false"> <label for="agreement">I accept the <a href="http://www.dev.com:3000/terms" target="_blank">Terms of Use</a>, <a href="http://www.dev.com:3000

Why does adding “sleep 1” in an after hook cause this Rspec/Capybara test to pass?

喜欢而已 提交于 2019-12-17 09:59:37
问题 I'm using rails 4.0.5, rspec 2.14.1, capybara 2.2.1, capybara-webkit 1.1.0 and database_cleaner 1.2.0. I'm seeing some weird behavior with the following feature test (which simulates a user viewing a comment on a post, hovering over an icon to make a menu appear, and clicking a menu item to delete the comment): let(:user){create(:user)} let(:post){create(:post, author: user)} let!(:comment){create(:comment, post: post, author: user)} ... it "can delete a comment" do assert(page.has_css? "

Access DOM from capybara-webkit #execute_script?

丶灬走出姿态 提交于 2019-12-13 19:33:21
问题 So I'm trying to test that the jQueryUI sortable library triggers an ajax request and I haven't been successful at triggering it, I've tried this with the jquery.simulate.drag-sortable.js library, but to no avail. I've also tried it with the execute script function, also to no avail. I am trying to manually trigger the sortable deactivate event because jQuery.trigger() doesn't seem to work with it even in the browser. The script that is executed is $sortable.sortable("option", "deactivate")

Undefined method accept_modal for Capybara::Webkit::Driver

て烟熏妆下的殇ゞ 提交于 2019-12-13 17:19:00
问题 In a Rails app, I'm using RSpec (with Capybara Webkit) to test that a Delete link is working. In my Rails template I have: <%= link_to 'Delete', movie_path(@movie), method: :delete, data: { confirm: 'Are you sure?' } %> And this is my spec: require 'rails_helper' describe "Deleting a movie", js: true do it "destroys the movie and shows the movie listing without the deleted movie" do movie = Movie.create(movie_attributes) visit movie_path(movie) page.accept_confirm do click_link 'Delete' end

ActionCable not connecting during capybara-webkit feature spec

混江龙づ霸主 提交于 2019-12-12 11:15:07
问题 I have a problem using actioncable with feature specs using Capybara-webkit. Actioncable is working perfectly on my development server, but when testing the javascript cant seem to connect. This is the output from the javascript console which is running during my feature spec WebSocket connection to 'ws://127.0.0.1:32789/cable' failed: Unexpected response code: 200 This is the output of my test.log at that moment GET "/cable" for 127.0.0.1 at 2017-01-26 13:33:23 +0000 GET "/cable/" for 127.0

Capybara-webkit cannot handle link with bootstrap glyphicon

安稳与你 提交于 2019-12-12 10:55:24
问题 I have a link: link_to %q(<span class='glyphicon glyphicon-trash'/>).html_safe, feed_item, data: {confirm: 'Are you sure?',toggle: 'tooltip'}, method: :delete, title: 'Delete', id: 'delete_post' and the following feature spec code page.accept_confirm do click_link 'delete_post' end and I get the following error Capybara::Webkit::ClickFailed: Failed to find position for element /html/body/div[@id='wrapper']/div[@id='page-content-wrapper']/div/div[@id='main']/div[@id='main_content']/div[4]/div

Rails3 form_for hidden_field undefined method 'merge'

穿精又带淫゛_ 提交于 2019-12-12 07:47:39
问题 My attempt to place a hidden_field within a form_for is crashing within cucumber on an ActionView helper error. Something also about FixNum which escapes me since I haven't dug through the source code. My prices_controller shows this: @price = Price.new @commodity = Commodity.find(params[:id]) I want to make the link between price and commodity with this hidden_field: <%= form_for (@price), :url => prices_path do |f| %> <% f.hidden_field :commodity_id, @commodity.id %> . . <div class="actions