capybara

Having a default port when running tests in ruby on rails

断了今生、忘了曾经 提交于 2019-12-22 08:59:17
问题 Im trying to run my tests with rake spec Im using rspec,capybara with selenium as webdriver. The problem is when ever I try to run the specs It starts up the testing environment in a different port every time. I don't want this to happen as it messes up my Facebook login. How would I make the environment start in the same port every time. pls help! 回答1: Look in config/initializers/webservice.rb and try setting the config.port value to something...I'm not entirely sure this will actually do

How to use synchronize in Capybara exactly?

守給你的承諾、 提交于 2019-12-22 04:10:33
问题 If how to use wait_until is pretty clear (I've used the methods like this while creating tests through the native Webdriver methods), but not the new synchronize method (sorry:)). I've read the theme about why wait_until is deprecated, I've read the article about that, I've read the docs with method description and also read the code where the description present too. But I didn't find any example or tutorial how exactly to use this method. Anybody, please, provide few cases where I (and

How to use synchronize in Capybara exactly?

丶灬走出姿态 提交于 2019-12-22 04:10:06
问题 If how to use wait_until is pretty clear (I've used the methods like this while creating tests through the native Webdriver methods), but not the new synchronize method (sorry:)). I've read the theme about why wait_until is deprecated, I've read the article about that, I've read the docs with method description and also read the code where the description present too. But I didn't find any example or tutorial how exactly to use this method. Anybody, please, provide few cases where I (and

How to use headless chrome with capybara and selenium

依然范特西╮ 提交于 2019-12-22 04:01:24
问题 Chrome version: 59.0.3071.104 Using Cucumber, Capybara, Selenium to implement automation testing with Headless Chrome. features/support/env.rb require 'rubygems' require 'capybara/cucumber' Capybara.register_driver :selenium_chrome do |app| Capybara::Selenium::Driver.new(app, :browser => :chrome, args: ['headless']) end Capybara.default_driver = :selenium_chrome When running a cucumber test, it says: WARN Selenium [DEPRECATION] :args or :switches is deprecated. Use Selenium::WebDriver::Chrome

Rspec rendering text

[亡魂溺海] 提交于 2019-12-22 03:57:42
问题 I have this Code if @temp_user.save sign_in(:user, @temp_user) render text: "OK" else render text: render_to_string(:partial => "errors") end and I try verify with rspec the render "OK" this is my actual spec: it "render text OK" do post :create, {:agent => valid_attributes} # response.should have_content("OK") response.should render_template(:text => "OK") end but this spec respond 0 failures always, even when I put "OKI" in place "OK" anyone have one suggestion for that? 回答1: If you are

What are the options to Capybara's have_selector?

孤人 提交于 2019-12-22 03:43:32
问题 I got this error in RSpec. Are there any docs for have_selector that explain each key in the options hash and what exactly it does? invalid keys :content, should be one of :text, :visible, :between, :count, :maximum, :minimum, :exact, :match, :wait 回答1: capybara provides this method to rspec. capybara's docs don't make it easy to find the answer to your question, so let's follow the source: have_selector is in Capybara::RSpecMatchers . It delegates to the nested class HaveSelector , which

Capybara not finding meta tags

拜拜、爱过 提交于 2019-12-22 01:34:21
问题 Capybara 2.1.0 doesn't seem to find any meta tags: (rdb:1) p page.find 'meta' *** Capybara::ElementNotFound Exception: Unable to find css "meta" even when they appear in page.source : (rdb:1) p page.source "<!doctype html>\n<html>\n<head>\n<title>MyTitle</title>\n<meta charset='utf-8'>\n<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>\n<meta content='width=device-width, initial-scale=1' name='viewport'>\n<meta name='description'>\n\n..." 回答1: The solution was to use :visible =>

MiniTest, Capybara, Fixture, Database_Cleaner not passing at second time

五迷三道 提交于 2019-12-21 21:43:54
问题 The following test passed first time (after rake db:test:prepare ) but failed gave error on subsequent run. Capybara::ElementNotFound: Unable to find css "#sale_payment_btn" require "test_helper" DatabaseCleaner.strategy = :transaction class SaleFeatureTest < Capybara::Rails::TestCase include Warden::Test::Helpers Warden.test_mode! self.use_transactional_fixtures = false setup do login_as users(:admin), scope: :user Capybara.current_driver = :selenium #:webkit DatabaseCleaner.start end

Writing integration tests against external resources which are A/B testing

喜你入骨 提交于 2019-12-21 21:29:56
问题 I have a bit of a design question and I'm curious if other users have run into this and how to develop the most elegant solution. I have some integration type feature tests in Cucumber using Capybara/Celerity/Selenium. A portion of these tests drive an external website to see how well my resources integrate (cookies, Javascript, etcetera). One particular external site is undergoing their own heavy A/B testing with a similar but significantly different site design, so my tests fail with the

Capybara visit method is not working

核能气质少年 提交于 2019-12-21 17:34:59
问题 I'm not sure what's going on, but I can't get simple tests to work because Capybara's visit method is not working for me. I've been trying to finish this railscast on testing. Once I get to the point where Capybara needs to visit the login page the test fails because it's only able to visit my root_url. Here's what the failure looks like. Note that it's failing because it can't even visit the login page. It's getting stuck on the homepage: Running: spec/requests/password_resets_spec.rb