0

私の例で :js => true をトグルすると、最初のテストを起動して実行するのに非常に時間がかかり、許容できるパフォーマンスになります

このサンプルは、:js なしで 0.36722 秒、:js => true で 58.15 秒で実行されます。

require 'spec_helper'

include UserAbilitiesHelper

describe "Customer Task Pages" do

  subject { page }

  describe "side panel with the history of the tasks related to customer" do
    before do
      visit root_path()
    end

    it { sould have_content(I18n.t("customers.tasks.side.title")) }


  end

  describe "side panel with the history of the tasks related to customer" do
    before do
      visit root_path()
    end

    it { sould have_content(I18n.t("customers.tasks.side.title")) }


  end


end

私のGemfile

source 'https://rubygems.org'

gem 'rails', '3.2.5'
gem 'pg', '0.12.2'

gem "meta_search"

# Bootstrap and layouting
gem 'bootstrap-sass', '2.0.3'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'rails3-jquery-autocomplete'

#test support
gem 'faker', '1.0.1'

#login rules
gem 'devise'
gem 'cancan'

#criptar
gem 'bcrypt-ruby', '3.0.1'

#BR
gem 'brazilian-rails'
gem 'rails-i18n'

group :development do
    gem 'annotate', '~> 2.4.1.beta'
    gem 'nested_scaffold'
end

group :development, :test do
  gem 'rspec-rails', '2.10.0'
  gem 'guard-rspec', '0.5.5'
  gem 'guard-spork', '0.3.2'
  gem 'spork', '0.9.0'
  gem 'ruby-debug19'
  gem 'linecache19'
  gem 'factory_girl_rails', '1.4.0'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.4'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end

gem 'jquery-rails', '2.0.0'

group :test do
  gem 'capybara', '1.1.2'
  gem "launchy"
  gem 'ZenTest'
  #MAC OS Especific
  gem 'rb-fsevent', '0.4.3.1', :require => false
  gem 'growl', '1.0.3'

  #Cucumber
  gem 'cucumber-rails', '1.2.1', require: false
  gem 'database_cleaner', '0.7.0'
end

group :production do
  #gem 'pg', '0.12.2'
end

で実行

bundle exec rspec

Bruno-Guerras-MacBook-Pro:railstutorial brunoguerra$ bundle exec rspec spec/requests/authentication_pages_spec.rb 
No DRb server is running. Running in local process instead ...
WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3
.....................

Finished in 6.07 seconds
21 examples, 0 failures
Bruno-Guerras-MacBook-Pro:railstutorial brunoguerra$ bundle exec rspec spec/requests/authentication_pages_spec.rb 
No DRb server is running. Running in local process instead ...
WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3
............F........

Failures:

  1) Authentication authorization for non-signed-in users when attempting to visit a protected page after signing in should render the desired protected page
     Failure/Error: page.should have_selector('title', text: 'Edit user')
       expected css "title" with text "Edit user" to return something
     # ./spec/requests/authentication_pages_spec.rb:65:in `block (6 levels) in <top (required)>'

Finished in 1 minute 14.18 seconds
21 examples, 1 failure

Failed examples:

rspec ./spec/requests/authentication_pages_spec.rb:64 # Authentication authorization for non-signed-in users when attempting to visit a protected page after signing in should render the desired protected page
Bruno-Guerras-MacBook-Pro:railstutorial brunoguerra$

ありがとう

4

2 に答える 2

4

DNSサーバーが遅すぎることを発見し、DNSサーバーを変更して問題を解決しました。テストの速度を向上させるために私が行ったもう1つのことは、これらのパラメーターを構成することでし 。うーん!!!

于 2012-09-26T01:32:05.827 に答える
2

また、ドライバー :webkit_debug を変更してからスペックを再実行して、ページにロードする必要のないスクリプトがあるかどうかを確認することもできます。

Capybara.javascript_driver = :webkit_debug

次に、任意の URL をブラック リストに追加します。

config.before(:each, js: true) do
   page.driver.browser.url_blacklist = ["http://use.typekit.net"]
end
于 2014-11-15T07:04:29.343 に答える