capybara

selenium / capybara - Firefox profile cannot be loaded

大城市里の小女人 提交于 2019-12-21 16:58:56
问题 When I run tests using selenium the browsers repeatedly pops up stating that the firefox profile cannot be found. I have a prepared a Firefox profile for use with selenium I'm just not sure how to tell selenium where that profile located. How do I tell Selenium which firefox profile to use? 回答1: I was getting this same error. For me it turned out that it was calls to save_and_open_page within my test that were causing the problem. I removed those and the Firefox profile errors stopped. I

path not working properly when using capybara

六月ゝ 毕业季﹏ 提交于 2019-12-21 09:08:44
问题 I'm using rails 3.0.5, rspec2 with latest capybara. Routes setup like: scope "(:locale)", :locale => /de|fr|it|en/ do resources :dossiers end In application_controller I have this: def default_url_options(options={}) options[:locale] = "es" options end So in my views I can use link_to 'test', dossier_path(1) without any problems. But when I do the same in capybara's visit it tries to use the 1 for the locale and not for the id. It only works when I use visit dossier_path(nil, 1) or visit

Factory Girl / Capybara deleting records from database mid-test?

时光毁灭记忆、已成空白 提交于 2019-12-21 07:09:36
问题 Working with RSpec & Capybara, I'm getting an interesting test failure mode which goes away with a few subtle rearrangements of lines in the test case...stuff that shouldn't matter. I'm developing my own authentication system. It is currently working and I can login/out with the browser and the session works etc etc. However, trying to test this is failing. Something is going on that I don't quite understand, which seems to depend on the order of (seemingly) unrelated calls. require 'spec

Cucumber Capybara scroll to bottom of page

[亡魂溺海] 提交于 2019-12-21 06:46:58
问题 I'd like to use my Cucumber/Capybara setup to test endless scroll by driving a browser and scrolling to the bottom of the page to ensure that the new content is loaded. Is there a way to do this? 回答1: You could use javascript to achieve this: page.execute_script "window.scrollBy(0,10000)" 回答2: I solved this with visit '#footer' inside a "scroll to the bottom of the page" step. 来源: https://stackoverflow.com/questions/4424790/cucumber-capybara-scroll-to-bottom-of-page

Title test failing for request specs in Michael Hartls tutorial for Rails 3

限于喜欢 提交于 2019-12-21 06:40:09
问题 Im following the Ruby On Rails 3 tutorial by Michael Hartl and using Capybara for the integration specs. The integration specs so far are as follows require 'spec_helper' describe "StaticPages" do describe "Home page" do it "should have the h1 'Sample App'" do visit '/static_pages/home' page.should have_selector('h1',:text => 'Sample App') end it "should have the title 'Home'" do visit '/static_pages/home' page.should have_selector('title',:text => "Ruby on Rails Tutorial Sample App | Home")

Running Capybara without rack produces errors when using url parameters

风流意气都作罢 提交于 2019-12-21 04:57:23
问题 Here's my setup, based on this recommendation: How to get Cucumber/Capybara/Mechanize to work against external non-rails site It works until I add parameters to the URL. Any advice on addressing this issue? require 'rspec' require 'capybara/rspec' require 'capybara/dsl' @test_url = "test" RSpec.configure do |config| config.include Capybara::DSL end Capybara.configure do |config| config.run_server = false config.current_driver = :selenium config.app = "fake app name" config.app_host = "http:/

Dockerized selenium browser cannot access Capybara test url

情到浓时终转凉″ 提交于 2019-12-21 04:42:21
问题 I am trying to run Ruby on Rails feature tests on dockerized selenium standalone firefox browser. It seems like I am having issues with networking because the selenium instance can't connect to the url started by Capybara. Here's my sample docker-compose.yml file: ff: image: selenium/standalone-firefox:2.48.2 container_name: firefox-browser web: build: . container_name: my-app volumes: - ".:/home/ubuntu/my-app" command: /bin/bash -l scripts/docker-start-tests.sh ports: - "3000:3000" And I

What's the best way to set custom request headers when using Capybara in RSpec request specs?

大憨熊 提交于 2019-12-21 04:26:18
问题 I'm monkey patching Capybara::Session with a set_headers method that assigns to Capybara::RackTest::Browser's options attribute (which I've changed from an attr_reader to an attr_accessor). The patches: class Capybara::RackTest::Browser attr_accessor :options end class Capybara::Session def set_headers(headers) if driver.browser.respond_to?(:options=) #because we've monkey patched it above options = driver.browser.options if options.nil? || options[:headers].nil? options ||= {} options[

Turn off animations in Capybara tests

别说谁变了你拦得住时间么 提交于 2019-12-21 03:55:18
问题 I have a lot of animations on my page, which really slows down my tests in capybara because capybara often have to wait until a element has been animated, as it starts out hidden. I found this solution for all jQuery based animations: <%= javascript_tag '$.fx.off = true;' if Rails.env.test? %> However i use twitter bootstrap and most animations from bootstrap is made by CSS 3 (with javascript fallback). So my question is, is there a way to turn of CSS 3 transitions and animations in tests?

Is it possible to run capybara-webkit (i.e. forked webkit_server) on Heroku Cedar?

坚强是说给别人听的谎言 提交于 2019-12-21 03:52:24
问题 I need to run capybara-webkit inside a Rails application to enable headless web browsing with JavaScript support (i.e. not for testing/CI purposes, and webrat or other acceptance testing drivers/frameworks will not work). I'm wondering if this is possible on a Heroku deployment, specifically because it requires QtWebKit and the ability to fork the webkit_server process with socket communication. I'm open to creative ideas on how to make this work on Heroku (e.g. a pool of worker dynos). I'm