mardi 7 janvier 2020

Capybara::ExpectationNotMet: Timed out waiting for Selenium session reset

I'm having an issue with Capybara (2.18.0) and Webdrivers (4.1.2) on Rails 3.22.2.5.

My tests are meeting their expectations but it seems Selenium hangs when trying to close or reset causing the test to fail. Weirdly I had this test working just fine before, and now with no changes, I'm getting this.

2018-01-12 00:00:00 WARN Selenium [DEPRECATION] Selenium::WebDriver::Error::UnhandledAlertError is deprecated. Use Selenium::WebDriver::Error::UnexpectedAlertOpenError (ensure the driver supports W3C WebDriver specification) instead.
        lists only periods that are semesters (FAILED - 1)
************************************************************************
Factory Bot Payload
{:pay_seniority=>{:create=>1}, :assignment_note=>{:create=>1}, :user=>{:create=>1}, :period=>{:create=>2}}
************************************************************************

Failures:

  1) looking at your shifts new unavailability specific time create by semester lists only periods that are semesters
     Failure/Error: example.run

     Capybara::ExpectationNotMet:
       Timed out waiting for Selenium session reset
     # /home/jforgue/.rvm/gems/ruby-2.3.8/gems/capybara-2.18.0/lib/capybara/selenium/driver.rb:145:in `reset!'
     # /home/jforgue/.rvm/gems/ruby-2.3.8/gems/capybara-2.18.0/lib/capybara/session.rb:127:in `reset!'
     # /home/jforgue/.rvm/gems/ruby-2.3.8/gems/capybara-2.18.0/lib/capybara.rb:314:in `block in reset_sessions!'
     # /home/jforgue/.rvm/gems/ruby-2.3.8/gems/capybara-2.18.0/lib/capybara.rb:314:in `reverse_each'
     # /home/jforgue/.rvm/gems/ruby-2.3.8/gems/capybara-2.18.0/lib/capybara.rb:314:in `reset_sessions!'
     # /home/jforgue/.rvm/gems/ruby-2.3.8/gems/capybara-2.18.0/lib/capybara/rspec.rb:22:in `block (2 levels) in <top (required)>'
     # ./spec/features/your_shifts_spec.rb:6:in `block (3 levels) in <top (required)>'
     # /home/jforgue/.rvm/gems/ruby-2.3.8/gems/timecop-0.9.1/lib/timecop/timecop.rb:201:in `travel'
     # /home/jforgue/.rvm/gems/ruby-2.3.8/gems/timecop-0.9.1/lib/timecop/timecop.rb:129:in `send_travel'
     # /home/jforgue/.rvm/gems/ruby-2.3.8/gems/timecop-0.9.1/lib/timecop/timecop.rb:51:in `freeze'
     # ./spec/features/your_shifts_spec.rb:5:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:104:in `block (2 levels) in <top (required)>'

I'm pretty confident the deprecation warning is because Capybara is out of date but because this is Rails 3.22.2.5 Capybara and Webdrivers can't be updated to a higher version.

This is my test:

it 'lists only periods that are semesters' do
  create :period, :semester, name: 'fall'
  create :period, name: 'not fall'
  visit current_path
  click_link 'New Unavailability'
  click_link 'Specific time'
  click_link 'Create by Semester'
  expect(page).to have_select 'unavailability_period_id', options: ['fall']
end

And here is how I'm setting my driver in my spec_helper:

Capybara.javascript_driver = :selenium_chrome_headless

Aucun commentaire:

Enregistrer un commentaire