我对验收测试有一个奇怪的问题,水豚只向我展示了浏览器中的第一个场景,所有其他的只是在后端运行,并且由于某种原因我看到一个空白页面(但它们通过并正常失败)。我的配置是:
require 'capybara'
Capybara.register_driver :selenium_chrome do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
Capybara.current_driver = :selenium_chrome
Capybara.javascript_driver = :selenium_chrome
Capybara.run_server = true
Capybara.server_port = 7000
Capybara.app_host = "http://localhost:#{Capybara.server_port}"
tests
:
feature 'f1' do
background do
@user = create(:user)
visit "/"
fill_in 'Email', :with => @user.email
fill_in 'Password', :with => 'password'
click_button 'Sign In'
end
scenario "sc1" do
click_link '1'
click_link '2'
click_link '3'
page.should have_content('120')
end
scenario "sc2" do
click_link '4'
click_link '5'
click_link '6'
page.should have_content('110')
end
end
gemfile
:
group :test do
gem 'rspec', '~> 2.8.0'
gem 'rspec-rails', '~> 2.8.0'
gem 'shoulda', '~> 2.11.3'
gem 'shoulda-matchers'
gem 'capybara', '~> 1.1.2'
gem 'nokogiri', '~> 1.5.2'
gem 'database_cleaner'
end
所以我只能看到sc1
在浏览器中运行,sc2
而所有其他人都只是在后台运行,我在 chrome 中看到一个空白页面。有什么建议么?