当硒失败时意味着什么?

时间:2014-08-22 00:14:10

标签: javascript selenium rspec capybara

基本上我有一个应该通过的失败规范。

  • 当我尝试在我的本地开发浏览器中触发它时,问题不会发生
  • 规范在js: false
  • 时通过

然而,一旦我更改js: true规范失败,我看到它在浏览器中失败,即使我自己做同样的事情,在测试之外,问题也没有。发生。

这是与水豚+硒+ rspec堆栈的常见问题吗?这是我的gemfile安装:

source 'https://rubygems.org'
gem 'bcrypt'
gem 'rails', '4.1.4'
gem 'pg'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'cancan'
gem 'globalize'

group :test do
    gem 'rspec-its'
    gem 'rspec-activemodel-mocks'
    gem 'selenium-webdriver'
    gem 'db-query-matchers'
    gem 'shoulda-matchers'
    gem 'capybara'
    gem 'faker'
    gem 'database_cleaner'
    gem 'factory_girl_rails'
end

我的规格:

RSpec.describe "Users", type: :feature, js: false do
    let!(:user){ FactoryGirl.create :user }
    let(:user_build){ FactoryGirl.build :user }

    subject { page }

    describe "Sign in" do
        before do
            visit authentication_path
            fill_in 'user_email', with: user.email
            fill_in 'user_password', with: user.password

            click_button 'Sign in' # can't sign in, as though the user got their password wrong
        end

        it { should have_title user.user_name }
        it { should have_link user.user_name, href: user_path(user.id) }
        it { should have_css 'css.success', "Signed in successfully. Welcome, #{user.user_name}"  }
    end
end

只是不明白它...当使用poltergeist而不是硒时,可以正常使用,而不是真正的#39;然而,当我这样做时,对于真实的'在浏览器中手动,它的工作原理。太奇怪了。

0 个答案:

没有答案