Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium RSpec、水豚和硒与Rails 4_Selenium_Ruby On Rails 4_Capybara_Rspec Rails - Fatal编程技术网

Selenium RSpec、水豚和硒与Rails 4

Selenium RSpec、水豚和硒与Rails 4,selenium,ruby-on-rails-4,capybara,rspec-rails,Selenium,Ruby On Rails 4,Capybara,Rspec Rails,我已经将我的应用程序从Rails 3.2升级到Rails 4。我正在使用RSpec、Capybara和seleniumwebdriver 我所有的测试用例都是用Rails 3.2运行的,但我一升级Rails,我的集成测试就停止运行了。所有控制器和模型测试运行良好 这是我的密码 require 'spec_helper' describe "Describe your business to the system (Sunny Day Scenario)", :js => true do

我已经将我的应用程序从Rails 3.2升级到Rails 4。我正在使用RSpec、Capybara和seleniumwebdriver

我所有的测试用例都是用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

当我运行集成测试时,Selenium会在Mozilla浏览器中运行它们,并成功执行所有步骤。当它到达行
page.current\u path.should eq(“/enroll/business loan calculator”)
时,或者如果我将
page.should有内容('some content…)
,这些语句不会执行。浏览器会自动关闭(应该关闭),但我看不到测试是否通过

检查您之前的语句是否通过

fill_in "reported_monthly_income", with: attributes.fetch(:reported_monthly_income)
select(attributes[:time_in_business], from: 'time_in_business')
click_button 'Get Started'
如果它没有过去,那么前面的事情就行不通了