RSpec:失败Cabybara Webkit InvalidResponseError

时间:2015-04-08 23:33:46

标签: ruby-on-rails angularjs rspec-rails filepicker.io capybara-webkit

我在十几个失败的规格上收到此错误。我团队中的其他开发人员(以及我们的CI)没有看到这些失败的规范,所以这是我的工具包的本地问题。

编辑:前6行是capybara-webkit的摘录:webkit_debug驱动程序:

...
Started request to "https://dialog.filepicker.io/dialog/comm_iframe/"
Started request to "https://www.filepicker.io/dialog/comm_iframe/"
Received "Evaluate((typeof angular !== 'undefined') && angular.element(document.querySelector('[ng-app]')).length > 0)"
"TimeoutCommand" waiting for load to finish
Received 0 from "https://dialog.filepicker.io/dialog/comm_iframe/"
Page finished with false
...

  1) User edits profile information
     Failure/Error: click_on t('users.edit')
     Capybara::Webkit::InvalidResponseError:
       Unable to load URL: http://127.0.0.1:53899/myprofile?as=1089 because of error loading https://dialog.filepicker.io/dialog/comm_iframe/: Unknown error
     # ./spec/features/users_spec.rb:30:in `block (2 levels) in <top (required)>'
     # ./spec/support/background_jobs.rb:14:in `block (3 levels) in <top (required)>'
     # ./spec/support/background_jobs.rb:5:in `run_background_jobs_immediately'
     # ./spec/support/background_jobs.rb:13:in `block (2 levels) in <top (required)>'

我该如何解决这个问题?这与AngularJS有何关联?!?

Edit2:在visit路径上抛出错误(见下文)。在打开空页面之前添加save_and_open_page一行。在第30行之后放置任何内容都不会因为错误而被调用。在29上添加binding.pry让我进入控制台,但我不确定我应该寻找什么来排除故障。

     25:   scenario 'edits profile information', js: true do
     26:     new_avatar = 'http://example.com/avatar.png'
     27:     user = create(:user)
     28:
  => 29:     binding.pry
     30:     visit myprofile_path(as: user)
     31:     click_on t('users.edit')
     32:     edit_profile(name: 'Edit User', avatar: new_avatar)
     33:     visit myprofile_path
     34:
     35:     expect(page).to have_text('Edit User')

1 个答案:

答案 0 :(得分:3)

完全阻止这些请求spec_helper.rb

  config.before :each, js: true do
    page.driver.browser.url_blacklist = [
      "https://dialog.filepicker.io",
      "https://www.filepicker.io"
    ]
  end