Selenium测试会触发Firefox的第二个实例

时间:2014-12-04 21:20:19

标签: ruby firefox selenium

我在Mac上使用FF 33.1。测试套件以及其他宝石使用Selenium,Capybara和VCR。由于某种原因,测试会触发Firefox的第二个实例(我认为这会导致大多数测试失败):

Selenium::WebDriver::Error::WebDriverError:
       unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)

导致第二个实例的原因是什么?我能做些什么呢?我已经更新了selenium-webdriver gem并完成了一个bundle install。

以下是触发行为的示例文件:

require "spec_helper"

  describe 'Managing Sections' do
    use_vcr_cassette

    before do
      @user = FactoryGirl.create :user
      @organization = FactoryGirl.create :organization
      @membership = FactoryGirl.create :membership, :organization => @organization, :user => @user, :role => 'admin'
      @bulletin = Bulletin.create(organization: @organization, user: @user, title: 'Test Title', created: true, publish_date: '2013-5-12')
      login_user @user
      visit manage_organization_bulletin_sections_path(@organization, @bulletin)
    end

    it 'creates a organization section for mtb', js: true do
      @organization.sections.count.should eq 0
      @bulletin.included_sections.count.should eq 4
      click_link 'multi-button'
      fill_in 'Title', with: 'New MTB'
      fill_in 'Description', with: 'New MTB Desc'
      click_button 'Save'
      @organization.sections.count.should eq 1
      @bulletin.reload
      @bulletin.included_sections.count.should eq 5
    end


    it 'creates a organization section for stb', js: true do
      @organization.sections.count.should eq 0
      @bulletin.included_sections.count.should eq 4
      click_link 'single-button'
      fill_in 'Title', with: 'New STB'
      fill_in 'Description', with: 'New STB Desc'
      click_button 'Save'
      @organization.sections.count.should eq 1
      @bulletin.reload
      @bulletin.included_sections.count.should eq 5
    end



it 'creates a organization section for bis', js: true do
  @organization.sections.count.should eq 0
  @bulletin.included_sections.count.should eq 4
  click_link 'insert-button'
  fill_in 'Title', with: 'New BIS'
  fill_in 'Description', with: 'New BIS Desc'
  click_button 'Save'
  @organization.sections.count.should eq 1
  @bulletin.reload
  @bulletin.included_sections.count.should eq 5
end


it 'creates a organization section for cal', js: true do
  @organization.sections.count.should eq 0
  @bulletin.included_sections.count.should eq 4
  click_link 'calendar-button'
  fill_in 'Title', with: 'New CAL'
  fill_in 'Description', with: 'New CAL Desc'
  click_button 'Save'
  @organization.sections.count.should eq 1
  @bulletin.reload
  @bulletin.included_sections.count.should eq 5
end


describe 'Deleting MTBS' do
  before do
    visit manage_organization_bulletin_sections_path(@organization, @bulletin)
    click_link 'multi-button'
    fill_in 'Title', with: 'New MTB'
    fill_in 'Description', with: 'New MTB Desc'
    click_button 'Save'
    @bulletin.reload
    @organization.reload
  end

  it 'doesnt delete org mtb when more than one clone present', js: true do
    pending
    visit manage_organization_bulletin_sections_path(@organization, @bulletin)
    click_link 'multi-button'
    fill_in 'Title', with: 'New MTB2'
    fill_in 'Description', with: 'New MTB2 Desc'
    click_button 'Save'
    @bulletin.reload
    @organization.reload
    visit manage_organization_bulletin_sections_path(@organization, @bulletin)
    within '#multi_text_block_' + @bulletin.included_sections.last._id.to_s do
      click_link 'delete_section'
      page.driver.browser.switch_to.alert.accept
    end
    @bulletin.reload
    @organization.reload.sections.count.should eq 1
    visit manage_organization_bulletin_sections_path(@organization, @bulletin)
    within '#multi_text_block_' + @bulletin.included_sections.last._id.to_s do
      click_link 'delete_section'
      page.driver.browser.switch_to.alert.accept
    end
    @organization.reload.sections.count.should eq 0
  end

  it 'deletes org mtb when one clone present'
end


it 'doesnt delete org stb when more than one clone present'
it 'deletes org stb when one clone present'
it 'doesnt delete org bis when more than one clone present'
it 'deletes org bis when one clone present'
it 'doesnt delete org cal when more than one clone present'
it 'deletes org cal when one clone present'

1 个答案:

答案 0 :(得分:0)

我相信Firefox版本32-34会导致您正在使用的gem设置出现此问题。

https://code.google.com/p/selenium/issues/detail?id=7642