It seems sleep or wait_until not valid using the latest versions of Capybara, according to the updates web page .
However, I have a test suite that only works on fast machines if I add a sleep(1) call to the test. That is, it looks like this:
describe "dosimeters page" do before do click_link("Dosimeter Read History", :match=>:first) end ...
becomes
describe "dosimeters page" do before do unix_wait click_link("Dosimeter Read History", :match=>:first) end ...
where I defined unix_wait as:
def unix_wait case RbConfig::CONFIG['host_os'] when /darwin/ when /linux-gnu/ sleep(1) end end
The thing is, I have an old Ubuntu 12.04 quadcore laptop that tests Jenkins, and everything works on it without unix_wait calls. Tests were not randomly run on the hexacore desktop running Ubuntu 13.10 and on the macbook pro laptop, but if I add unix_wait to the call, the tests will pass.
The tests themselves indicate download failures (i.e. css elements that are absent on some runs, but not on others), and checked things actually work when the site loads manually.
So what is the action here? Apparently, sleep not allowed during testing, nor is wait_until . However, the dream works, but for me it seems very rude. Should I look at #synchronized ? From what I am compiling from those blog posts that are already being called when I call click_link , and the tests still fail.
What is the accepted protocol here?
I have to add because I think this is important: these are all javascript tests. I am using capybara-webkit built on qt4 (not qt5). I am considering switching to poltergeist or some other javascript driver as a debugging step.
javascript ruby-on-rails sleep capybara capybara-webkit
mmr
source share