2013-11-21 4 views
0

Я обновил свое приложение от Rails 3.2 до Rails 4. Я использую RSpec, Capybara и selenium-webdriver.RSpec, Capybara и Selenium с 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...'), эти утверждения не выполняются. Браузер автоматически закрывается (что ему нужно), , но я не вижу, проходят ли тесты или не проходят.

ответ

0

Проверьте ваши предыдущие заявления проходят

fill_in "reported_monthly_income", with: attributes.fetch(:reported_monthly_income) 
select(attributes[:time_in_business], from: 'time_in_business') 
click_button 'Get Started' 

Если его не проходит, то вещи вперед не будут работать.

Смежные вопросы