-1

I am running a test on server with CI and getting below error though If I run test in local environment it passes. using gem 'capybara', '3.35.3', and gem 'rails', '6.1.3'

       1.2) Failure/Error: raise "Requests did not finish in 60 seconds: #{middleware.pending_requests}" if timer.expired?

          RuntimeError:
            Requests did not finish in 60 seconds: ["/test_metadata/digital_object_identifiers/4/register"]
          # /usr/local/bundle/gems/capybara-3.35.3/lib/capybara/server.rb:66:in `wait_for_pending_requests'
          # /usr/local/bundle/gems/capybara-3.35.3/lib/capybara/session.rb:133:in `reset!'
          # /usr/local/bundle/gems/capybara-3.35.3/lib/capybara.rb:325:in `block in reset_sessions!'
          # /usr/local/bundle/gems/capybara-3.35.3/lib/capybara.rb:325:in `reverse_each'
          # /usr/local/bundle/gems/capybara-3.35.3/lib/capybara.rb:325:in `reset_sessions!'
          # /usr/local/bundle/gems/capybara-3.35.3/lib/capybara/rspec.rb:20:in `block (2 levels) in <top (required)>'
          
          Finished in 1 minute 35.02 seconds (files took 9.12 seconds to load)
1 example, 1 failure

I did not find proper solution what to be modify exactly. Thank you

varun
  • 201
  • 1
  • 5
  • 13

1 Answers1

0

Capybara tracks all requests made to your app under test during a test. At the end of the test Capybara resets the browser and waits for all of the open requests to close. In your case the error is telling you that a request to /test_metadata/digital_object_identifiers/4/register was still open 60 seconds after the browser was reset, so you need to look at why your code is making that request, and how it's taking longer than 60 seconds to complete.

Thomas Walpole
  • 48,548
  • 5
  • 64
  • 78
  • Thanks, I looked in to that and observed that it tries to contact external URL which does not respond in 60 sec time. Now I need to mock that external service. – varun Mar 25 '21 at 15:08
  • Is this an option? I'm trying to troubleshoot using pry but it's getting interrupted by the 60 second timer, which I'm going to assume is because I'm using v3.6, with exact symptoms found [here](https://stackoverflow.com/a/56611349/6066942) – daveasdf Aug 10 '23 at 13:02
  • ... only happens in a view – daveasdf Aug 10 '23 at 13:34