Reputation: 819
The issue persist on Rails 4.2 with the newest capybara.
I think it is not a driver specific issue, because it slow with rack_test, capybara-webkit and even poltgeist.
Rendering takes approx. 78086ms.
Example log output:
(6.5ms) COMMIT
Started GET "/coming-soon" for 127.0.0.1 at 2015-08-07 11:53:27 +0200
Processing by FeaturesController#index as HTML
TranslationKey Load (10.0ms) SELECT "translation_keys".* FROM "translation_keys" WHERE "translation_keys"."key" = $1 LIMIT 1 [["key", "features.page-description"]]
Feature Load (0.5ms) SELECT "features".* FROM "features"
TranslationKey Load (0.5ms) SELECT "translation_keys".* FROM "translation_keys" WHERE "translation_keys"."key" = $1 LIMIT 1 [["key", "features.see_preview"]]
TranslationKey Load (0.4ms) SELECT "translation_keys".* FROM "translation_keys" WHERE "translation_keys"."key" = $1 LIMIT 1 [["key", "features.form-description"]]
Rendered features/index.html.haml within layouts/application (67.2ms)
TranslationKey Load (0.4ms) SELECT "translation_keys".* FROM "translation_keys" WHERE "translation_keys"."key" = $1 LIMIT 1 [["key", "meta.title"]]
TranslationKey Load (0.4ms) SELECT "translation_keys".* FROM "translation_keys" WHERE "translation_keys"."key" = $1 LIMIT 1 [["key", "meta.description"]]
TranslationKey Load (0.3ms) SELECT "translation_keys".* FROM "translation_keys" WHERE "translation_keys"."key" = $1 LIMIT 1 [["key", "meta.keywords"]]
MenuItem Load (6.1ms) SELECT "menu_items".* FROM "menu_items" WHERE "menu_items"."menu_category" = $1 ORDER BY position ASC [["menu_category", "3"]]
TranslationKey Load (0.2ms) SELECT "translation_keys".* FROM "translation_keys" WHERE "translation_keys"."key" = $1 LIMIT 1 [["key", "page.instagram_url"]]
TranslationKey Load (0.2ms) SELECT "translation_keys".* FROM "translation_keys" WHERE "translation_keys"."key" = $1 LIMIT 1 [["key", "page.pinterest_url"]]
Rendered shared/_header.html.haml (416.5ms)
MenuItem Load (0.2ms) SELECT "menu_items".* FROM "menu_items" WHERE "menu_items"."menu_category" = $1 ORDER BY position ASC [["menu_category", "1"]]
Rendered shared/_flash_messages.html.haml (5.4ms)
Rendered shared/_analytics.html.erb (0.5ms)
Completed 200 OK in 78086ms (Views: 78046.3ms | ActiveRecord: 21.5ms)
TransitionKeys are fast_gettext's stuff. MenuItems is a cell (cells gem).
I use the following gems for testing:
group :test do
gem 'factory_girl_rails'
gem 'mocha'
gem 'shoulda'
gem 'database_cleaner'
gem "minitest-rails-capybara"
gem 'capybara-email'
gem 'capybara-webkit'
gem 'poltergeist'
gem 'cucumber-rails', :require => false
end
I also tried changing transaction and truncation strategies.
What's wrong?
EDIT:
when I start a local server with:
RAILS_ENV=test bundle exec rails c
it is painfully slow even if config.assets.debug = false
Upvotes: 2
Views: 1589
Reputation: 49890
If this only happens for the first test that is run then this has nothing to do with Capybara and is most likely the asset pipeline compiling the assets. You can try precompiling them in the test environment before running the test and see if that speeds it up.
Upvotes: 3
Reputation: 6545
Make sure config.assets.debug = false
is set in your relevant config/environments/*.rb
files (perhaps just test.rb
).
Upvotes: 3