2

我有一个黄瓜测试套件,自从我搬到一台新电脑后,它无法运行。

测试套件使用Capybara (v1.1.2),Chrome Driver (v26.0.1383.0)Selenium-Webdriver (v2.27.1)在 Chrome 中运行 JavaScript 测试。

每一个测试都伴随着 Chrome 的蓝色死亡“aw snap”。如果我CTRL-C在下一次测试运行时终止当前的测试运行并且也失败了。

我完全不知所措。这个完全相同的测试套件在 Circle CI 和同事的 Mac 上运行良好。

我还尝试将Chrome 驱动程序换成其他 Capybara 驱动程序Phantom JSCapybara Webkit

Phantom JS 有点被淘汰了 :(

Capybara Webkit 更进一步,但仍然未能通过以下测试:Broken pipe (Errno::EPIPE)

我认为我的机器上的 Webkit 存在根本性的问题。

我正在运行 Mac OS X 10.8。

有什么想法吗?

更新

features/support/env.rb

require 'cucumber/rails'

Capybara.default_selector = :css

ActionController::Base.allow_rescue = false

begin
  require 'database_cleaner'
  require 'database_cleaner/cucumber'
  DatabaseCleaner.orm = 'mongoid'
  DatabaseCleaner.strategy = :truncation
rescue NameError
  raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end

Cucumber::Rails::Database.javascript_strategy = :truncation

require 'minitest/spec'
World(MiniTest::Assertions)
MiniTest::Spec.new(nil)

features/support/chrome.rb

Capybara.register_driver :chrome do |app|
  Capybara::Selenium::Driver.new(app, :browser => :chrome)
end

Capybara.javascript_driver = :chrome

Gemfile

source 'http://rubygems.org'

ruby '1.9.3'
gem 'rails', '3.2.11'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'bootstrap-sass'
  gem 'font-awesome-rails'
  gem 'uglifier', '>= 1.0.3'
  gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
end

group :test, :development do
  gem 'factory_girl_rails'
  gem 'minitest-rails'
  gem 'minitest-rails-capybara' # provides integration_test generator
  gem 'capybara_minitest_spec' # provides RSpec-like matchers
  gem 'capybara-screenshot'
  gem 'debugger' # please only enable debugger when needed
  gem 'quiet_assets'
  gem 'jasmine-rails'
end

group :test do
  gem 'minitest-matchers'
  gem 'shoulda-matchers'
  gem 'cucumber-rails', :require  => false
  gem 'capybara'
  gem 'capybara-email'
  gem 'database_cleaner'
  gem 'factory_girl_rails'
  gem 'launchy' # for save and open page
  gem 'timecop'
  gem 'mocha', :require => false
  gem 'vcr'
  gem 'webmock'
end

group :staging, :qa do
  gem 'database_cleaner'
  gem 'factory_girl_rails'
end

gem 'jquery-rails'

gem 'thin'
gem 'ey_config'

gem 'memcachier'
gem 'dalli'

gem 'mongoid'
gem 'mongoid-history', github: 'stengland/mongoid-history'
gem 'bson_ext'

gem 'devise'
gem 'devise_invitable'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'switch_user'

gem 'cancan'

gem 'simple_form', '~> 2.0'
gem 'dragonfly', '~> 0.9.12'
gem 'mongoid-grid_fs'

gem 'momentjs-rails', github: 'tkrotoff/momentjs-rails'

gem 'tabulous'

gem 'cocoon'
gem 'backbone-on-rails'

gem 'mustache'

gem 'gon'

gem 'activemerchant'
gem 'state_machine'
gem 'ruby-graphviz', :require => 'graphviz'
gem 'twilio-ruby'
gem 'twitter'

gem 'prawn'

gem "bootstrap-wysihtml5-rails", "~> 0.3.1.14"

gem 'country_select'
4

1 回答 1

1

如果你仍然可以访问旧系统,你应该检查你在那里安装的 gems 的版本;

gem list --local

然后在新系统上做同样的比较。可能有所需的宝石不存在或版本错误。

如果您为测试添加 Cucumber 输出和您的 env.rb 文件,我们可能会提供更多有用的答案。

于 2013-04-12T13:39:02.303 回答