【发布时间】:2015-04-08 23:33:46
【问题描述】:
我在十几个失败的规格上遇到了这个错误。我团队中的其他开发人员(以及我们的 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')
【问题讨论】:
-
在错误之前添加一个 save_and_open_page ,看看你是否在正确的页面上使用正确的元素。
-
save_and_open_page似乎什么也没做…… -
在您的 gemfile 中添加 gem 'launchy' 并重试
-
在你的gemfile中添加gem 'pry',在错误前添加一个binding.pry,运行测试,在控制台输入save_and_open_age,它是什么意思?
-
好的,见上面的edit2。
标签: ruby-on-rails angularjs rspec-rails filepicker.io capybara-webkit