我正在使用 RSpec、Capybara 和 Selenium 在 Ruby 中编写验收测试。我在输出中发现了一些我不认识的消息,而且我无法通过 Google 搜索找到这些消息。
这是我的一个测试的输出:
Authentication
with an invalid email address
gives an error message
with an invalid password
[9344:5812:1011/235445:ERROR:navigation_entry_screenshot_manager.cc(141)] Invalid entry with unique id: 22
gives an error message
with a valid email and password
[9344:5812:1011/235450:ERROR:navigation_entry_screenshot_manager.cc(141)] Invalid entry with unique id: 33
takes us to the correct page
3 examples, 0 failures
我不知道 navigation_entry_screenshot_manager.cc 是什么,只要它不会导致测试失败我就不在乎。我只想知道是否有办法阻止它出现在 RSpec 输出中。
最佳答案
我不知道它是否适合你,但这是我在我的规范中抑制 chrome 警告消息的方法:
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome, switches: ['--test-type'])
end
关于ruby - 使用 Capybara/Selenium/RSpec 抑制奇怪的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39988665/