capybara

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:

capybara - Clicking a button without an id

纵然是瞬间 提交于 2019-12-23 12:23:14
问题 I'm trying to to click the button in this html code <div class="modal-footer"><button class="btn" data-dismiss="modal">Kapat</button></div> I've already tried find with various combinations, the closest I came to success was with this code: click_on "Kapat" The problem is that there are 3 copies of the same button in the page, so my question is; is there a way to specify this particular div ? 回答1: If the button has a specific path, you could use within or a find down to that path, but that

Capture video with Poltergeist, PhantomJS and Capybara

淺唱寂寞╮ 提交于 2019-12-23 09:52:50
问题 Is it possible to capture video with PhantomJS in combination with the gems Poltergeist, Capybara and Cucumber? I have used the Headless gem previously, which put a video in a specific folder in case a scenario failed. If all went well, no video was stored. Headless uses Xvfb and ffmpeg. Can ffmpeg also be used to provide the same functionality as shown here: https://github.com/leonid-shevtsov/headless/blob/master/lib/headless/video/video_recorder.rb I basically need the same functionality,

How to click radio button with capybara in ruby on rails app

醉酒当歌 提交于 2019-12-23 09:41:10
问题 I'm trying to select a radio button with capybara and it can't find the radio button. Here is my rspec test, view and error. Please note that I am using factories for user, skills, etc. Rspec test scenario "user chooses a couple skills and moves on to bio" do user = create(:user) skill = create(:skill) skill_two = create(:skill) skill_three = create(:skill) sign_in(user) visit onboard_skills_path choose(skill.name) end View <%= form_for(:onboard_skill, url: onboard_skills_path) do |f| %> <ul>

Capybara increase max allowed page load time

半城伤御伤魂 提交于 2019-12-23 09:32:08
问题 I have a page that sometimes loads in over a minute. Assume this is the expected behavior and wont change. In these cases, I get Net::ReadTimeout . Note that this is after navigating to a page by clicking a button on the previous page, not an ajax request. Therefore Capybara.using_wait_time doesn't help. I have tried a number of radical things (some of which I knew wouldn't work) like: Setting page.driver.browser.manage.timeouts 's implicit_wait , script_timeout and page_load . Looping

Running capybara with nginx

和自甴很熟 提交于 2019-12-23 09:31:54
问题 Is is possible to run capybara with nginx and passenger? instead or webrick? Capybara is installed with cucumber in a rails app. 回答1: It is easy - the only thing you have to do is to switch your mind - neither capybara nor cucumber are not tied to local environment you can test application that is located in internet and it will not care about it - you can even test google.com if you want. For your particular problem you'll have to set Capybara.run_server = false Capybara.server_port = 8000 #

How to include Capybara into module in Cucumber project

与世无争的帅哥 提交于 2019-12-23 09:15:48
问题 I defined a module: module Support include Capybara::DSL def self.do_something click_link 'Questions' end end It's situated at features/support/support.rb My env.rb: require 'capybara' require 'cucumber' require 'capybara/cucumber' Capybara.app_host = "http://www.stackoverflow.com" Capybara.run_server = false Capybara.default_driver = :selenium I invoke function of module in steps.rb: Support::do_something And I have exception: undefined method `click_link' for Support:Module (NoMethodError)

Rails3 Google Maps testing with selenium

こ雲淡風輕ζ 提交于 2019-12-23 07:29:32
问题 I'm trying to test a google maps app with Rails3. I'm using cucumber with capybara and selenium for JavaScript testing. I have a map where I wait for google maps to be loaded, and then send an ajax request to my server, where I get locations that I'm inserting into the map. I'm wondering if it's possible with selenium to wait until google maps is loaded, the ajax call to my server is finished and the marker are placed inside the map. The other issue is, how to select this marker within google

Can't find element to click on using Capybara + Rails3

☆樱花仙子☆ 提交于 2019-12-23 06:48:24
问题 Background : I'm using Capybara with Rspec to test a Rails 3 app. Driver used : Selenium Problem : I can't find the "Sign in" button in order to click on from within my test. HTML code: <form accept-charset="UTF-8" action="/" class="filter_form" id="login" method="post"> <fieldset> <div class="modal-body"> <div class="clearfix login-fields"> <label for="user_email">Email</label> <div class="input login-inputs"> <input class="input-text" id="user_email" name="user[email]" placeholder="email"

Undescriptive error when running spec, occurs dependent on seed

核能气质少年 提交于 2019-12-23 05:11:45
问题 I have written a feature spec to test for correct multitenancy behaviour within my application. It signs in as two different users, creates a new Presentation by filling in a form and submitting it as each user, and confirms every time that only the tenant's own Presentations are visible to them. This spec passes fine sometimes, and sometimes doesn't. What is really confusing is the error that occurs: Failure/Error: click_button "Präsentation erstellen" TypeError: can't cast ActiveSupport: