Capybara / Ruby / Cucumber - 使命令期望在证据中突出显示
Capybara / Ruby / Cucumber - Making the command Expect to be highlighted in the evidence
每次 运行 黄瓜场景时,我都会生成证据。它运行良好,但我想进一步改进它。
我的想法是将所有 "expect" 命令突出显示到证据中以明确结果。
我正在使用一个钩子来生成证据,所以我想我必须在那里做点什么。
After do
shot_file = page.save_screenshot("log/screenshot.png")
shot_b64 = Base64.encode64(File.open(shot_file, "rb").read)
embed(shot_b64, "image/png", "Screenshot")
end
因此,当我声明一个 expect 命令时,我希望在突出显示的证据中看到它。
expect(find(".nav-a.nav-a-2.nav-truncate")).to have_content "Hello, my name"
伙计们有什么想法吗?
非常感谢!
您可以在截屏前使用下面的 javascript 突出显示元素的边框。
element.style.border = '0.5em solid red';
这是示例视频。
每次 运行 黄瓜场景时,我都会生成证据。它运行良好,但我想进一步改进它。
我的想法是将所有 "expect" 命令突出显示到证据中以明确结果。
我正在使用一个钩子来生成证据,所以我想我必须在那里做点什么。
After do
shot_file = page.save_screenshot("log/screenshot.png")
shot_b64 = Base64.encode64(File.open(shot_file, "rb").read)
embed(shot_b64, "image/png", "Screenshot")
end
因此,当我声明一个 expect 命令时,我希望在突出显示的证据中看到它。
expect(find(".nav-a.nav-a-2.nav-truncate")).to have_content "Hello, my name"
伙计们有什么想法吗?
非常感谢!
您可以在截屏前使用下面的 javascript 突出显示元素的边框。
element.style.border = '0.5em solid red';
这是示例视频。