0
我已经将我的应用程序从Rails 3.2升级到了Rails 4.我使用RSpec,Capybara和selenium-webdriver。RSpec,Capybara和Selenium with Rails 4
我所有的测试用例都使用Rails 3.2运行,但是当我升级Rails后,我的集成测试就停止运行。所有的控制器和模型测试运行良好。
这里是我的代码
require 'spec_helper'
describe "Describe your business to the system (Sunny Day Scenario)", :js => true do
before do
FactoryGirl.create(:feature_industry)
FactoryGirl.create(:feature_synonym)
visit simulation_path
end
it "Fill out the intro page form" do
attributes = saucey_cranberry
click_start_test_button(true)
expect(page).to have_content "See what a business loan through CAN Capital can do:"
fill_in "reported_business_industry_selected", with: "food"
sleep(2)
page.execute_script(%Q[$(".dropdown_list_sic:first").trigger('mouseenter').click();])
fill_in "desired_funding_amount", with: attributes[:desired_funding_amount]
fill_in "funding_reason", with: attributes[:funding_reason]
fill_in "get_reported_business_name", with: attributes[:reported_business_name]
fill_in "reported_monthly_income", with: attributes.fetch(:reported_monthly_income)
select(attributes[:time_in_business], from: 'time_in_business')
click_button 'Get Started'
page.current_path.should eq('/enroll/business-loan-calculator')
#have_content 'Enter your gross monthly sales'
end
end
当我运行我的集成测试,硒它们运行Mozilla浏览器中,并成功执行所有步骤。当它到达行page.current_path.should eq('/enroll/business-loan-calculator')
或者如果我把page.should have_content('some content...')
,这些语句不执行。浏览器自动关闭(它应该),但我看不到测试通过还是失败。