Ruby on rails Rails,Capybara:rake资产:预编译后测试不再工作
我把我的项目推给了heroku,之后,我的水豚测试停止了。我想,问题在于rake资产:precompile,因为这似乎是唯一的命令,它会以某种方式影响我的本地代码 虽然我的测试按预期工作,但现在每个测试都返回相同的错误:Ruby on rails Rails,Capybara:rake资产:预编译后测试不再工作,ruby-on-rails,capybara,Ruby On Rails,Capybara,我把我的项目推给了heroku,之后,我的水豚测试停止了。我想,问题在于rake资产:precompile,因为这似乎是唯一的命令,它会以某种方式影响我的本地代码 虽然我的测试按预期工作,但现在每个测试都返回相同的错误: Capybara::Poltergeist::MouseEventFailed: Firing a click at co-ordinates [91.5, 69.5] failed. Poltergeist detected another element w
Capybara::Poltergeist::MouseEventFailed:
Firing a click at co-ordinates [91.5, 69.5] failed. Poltergeist
detected another element with CSS selector 'html body.container article.ng-scope div.ng-scope nav-bar.ng-scope nav.navbar.navbar-fixed-top.navbar-inverse div.container-fluid div#bs-example-navbar-collapse-2.collapse.navbar-collapse' at this position.
It may be overlapping the element you are trying to interact with. If you don't care about overlapping elements, try using node.trigger('click').
首先,我认为,为了使测试再次工作,我运行rake资产:clean来删除资产。但错误依然存在
然后,我删除了带有资产的公共文件。但错误依然存在
有人知道我如何解决这个问题吗
编辑1:
下面是我的一个测试示例:
scenario "User adds a comment" do
anotheruser = User.create!(email: "anotheruser@gmail.com",
password: "abcdefgh123",
password_confirmation: "abcdefgh123")
argumentation = Argumentation.create(title: "Metaphysik und Natur", content: "Man könnte meinen, Metaphysik und Naturwissenschaften haben etwas gemeinsam.", user_id: anotheruser.id)
argument = Argument.create(title: "Naturwissenschaft als Fortsetzung der Metaphysik", content:"Es gibt Leute, die sagen, Wissenschaft ist die Beantwortung von metaphysischen Fragen.", argumentation_id: argumentation.id, place: 1)
log_in(email, password)
visit "/argumentation#!/" + argumentation.id.to_s
fill_in "argumentcommenttitle", with: "Das ist mein Kommentar dazu!"
fill_in "argumentcomment", with: "Die Argumentation ist gültig, doch sind die Prämissen falsch"
click_button "Kommentar erstellen"
expect(page).to have_content("Das ist mein Kommentar dazu!")
expect(page).to have_content("Die Argumentation ist gültig, doch sind die Prämissen falsch")
end
编辑2:
一位评论员要求提供屏幕截图,如下所示:
评论者是对的,问题似乎不是关于rake资产:预编译,而是另一个。谢谢你的提示!(不过我想知道,为什么rake资产:precompile会影响capybara中屏幕的大小
错误日志中的这一行让我好奇:
It may be overlapping the element you are trying to interact with. If you don't care about overlapping elements, try using node.trigger('click').
我建议让水豚/恶灵做一些截图,看看它“看到”了什么。好奇。我会让水豚/恶灵写一些截图,看看它“看到”了什么。您不必运行
rake assets:precompile
,如果需要的话。Heroku将在提交后钩子中执行此操作-这是一个更好的解决方案,它可以消除忘记编译资产的错误部署,并减少git历史中的搅动。@Wukerplank您能写一个答案,这样我就可以接受吗?谢谢您的建议。还是应该我删除了我的问题?@Metaphysiker很高兴能帮上忙!我把答案贴在下面。