ruby on rails - Capybara rspec test takes a long time to execute - why? -
i have rails project using rspec 3.4.0
capybara 2.6.2
, capybara-webkit 1.8.0
.
i have simple feature test follows:
require 'rails_helper' rspec.feature "seller features", type: :feature let!(:sub_category) { factorygirl.create(:sub_category) } #all tests create user - sign them in , land them on homepage background sign_in_as end scenario "buyer creates seller profile", :js => true click_link("sell on site",match: :first) expect(page).to have_text("reach thousands of customers in area") click_link("create activity",match: :first) expect(current_path).to eql (new_seller_profile_path) fill_in "seller_profile[business_name]", :with => "test company" fill_in "seller_profile[business_email]", :with => "test@email.com" fill_in "seller_profile[business_phone_number]", :with => "07771330510" fill_in "seller_profile[business_description]", :with => "this test company" find('label[for="social"]').click find("#facebook-placeholder").click fill_in "seller_profile[business_facebook_url]", :with => "https://www.facebook.com/test" click_button("create activity") fill_in "seller_profile[requested_postcode]", :with => "eh21 8pb" click_button("submit") click_link("continue") expect(page).to have_text("choose type of activity want create") end end
the test passes successfully. problem takes length of time run:
finished in 4 minutes 26.2 seconds (files took 7.19 seconds load)
this seems ridiculously long! during execution cpu idle not sure causing length of execution time? reasonable normal amount of time such simple feature test?! please help!
i don't know if spec_helper.rb file:
env["rails_env"] ||= "test" env['server_name'] = "user.myapp.com" require file.expand_path("../../config/environment", __file__) require "rspec/rails" capybara::webkit.configure |config| # enable debug mode. prints log of driver doing. config.debug = false config.allow_unknown_urls # allow pages make requests url without issuing warning. # allow specifc domain without issuing warning. config.allow_url("https://checkout.stripe.com") config.allow_url("https://checkout.stripe.com/v3/data/languages/en.json") # timeout if requests take longer 5 seconds config.timeout = 60 # don't raise errors when ssl certificates can't validated config.ignore_ssl_errors end capybara.javascript_driver = :webkit dir[rails.root.join("spec/support/**/*.rb")].each {|f| require f} rspec.configure |config| # rspec-expectations config goes here. can use alternate # assertion/expectation library such wrong or stdlib/minitest # assertions if prefer. config.use_transactional_fixtures = false config.before(:suite) databasecleaner.clean_with(:truncation) end config.before(:each) |example| databasecleaner.strategy= example.metadata[:js] ? :truncation : :transaction databasecleaner.start end config.after(:each) databasecleaner.clean end config.include signinhelpers, type: :feature config.mock_with :rspec config.expect_with :rspec |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true end # rspec-mocks config goes here. can use alternate test double # library (such bogus or mocha) changing `mock_with` option here. config.mock_with :rspec |mocks| # prevents mocking or stubbing method not exist on # real object. recommended, , default # `true` in rspec 4. mocks.verify_partial_doubles = true end end
it waiting 3rd party javascripts - debug mode turned on key finding out hanging capybara webkit. tom walpole.
Comments
Post a Comment