我想知道是否有人可以帮我向我解释为什么我在测试页面上看到该元素时会收到此错误。我正在编写一个测试,基本上允许存档条目。在这一点上,这更像是一个单独的保存机制来清理显示页面或至少允许它。测试如下。
it "can archive a diagnostic report" do
diagnostic_info = FG.create(:diagnostic_info)
diagnostic_info.save!
visit admin_diagnostics_path
page.should have_content("test message")
click_button "Save"
end
视图
= form_for [:admin, @diagnostic], url: admin_diagnostic_path do |f|
.field
= link_to :raw_json, admin_diagnostic_path(@diagnostic, format: :json)
.field
= label_tag :device
= label_tag do
%pre= JSON.pretty_generate(@diagnostic.data["device"])
.field
= label_tag :localStorage
= simple_format(@diagnostic.notes)
-if @diagnostic.data["localStorage"]
= label_tag do
%pre= JSON.pretty_generate(@diagnostic.data["localStorage"])
= submit_tag 'Save', method: :put, data: { confirm: "Are you sure?" }
= link_to 'Delete', admin_diagnostic_path(@diagnostic), method: :delete, data: { confirm: 'really?' }
= link_to 'Edit', edit_admin_diagnostic_path
我的错误在下面 - 在我添加点击按钮保存部分
之前传递确定 1) /admin/diagnostics can archive a diagnostic report
Failure/Error: click_button "Save"
Capybara::ElementNotFound:
Unable to find button "Save"
# ./spec/features/admin/diagnostics_spec.rb:28:in `block (2 levels) in <top (required)>'