deadlock detected with capybara-webkit

后端 未结 4 712
梦谈多话
梦谈多话 2021-02-09 12:04

I\'m trying to pass this spec :

scenario \"Edit a service\", js: true do
  service = create_service_for(provider, title: \"First service\")
  fill_edit_service_f         


        
4条回答
  •  不知归路
    2021-02-09 12:26

    The most probable reason is there must be some query going on through ajax / database cleaner is truncating the database prematurely while sql query is running. One of the method is to make webkit driver wait till the ajax request is finished. Add this method in the test helpers and call it after clicking the button / submitting the ajax form.

        def wait_for_ajax_to_finish
        looping = true
        loop do
          sleep 1
          begin
            count = page.evaluate_script('window.running_ajax_calls').to_i
            looping = false if count == 0
          rescue => e
            if e.message.include? 'HTMLunitCorejsJavascript::Undefined'
              raise "For 'wait for the AJAX call to finish' to work, please include culerity.js after including jQuery."
            else
              raise e
            end
          end
        end
      end
    

提交回复
热议问题