def wait_for
Timeout.timeout(Capybara.default_wait_time) do
loop until
begin
yield
rescue MiniTest::Assertion
end
end
yield
end
What this method does is wait for a few seconds for the assertions in the provided code block to run sucessfully. I use it by calling it with the assertion(s) I want to check on the page after a Javascript-related change, like so:
visit frontend_magazine_path(magazine_id: @magazine.id)
click_link 'Read latest issue'
wait_for do
assert_equal "20 min left to read", page.find('#reader5-timer').text
end
Right now it's working pretty well, I was able to remove those pesky sleep n calls, and my tests feel sturdier and cleaner now.
Thanks to share these details it’s truly nice.
ReplyDeletehttp://mediaonlines.com/
It’s true that SEO results aren’t instant. And it’s for that reason that at AIM we always say: SEO is a marathon, not a sprint.
ReplyDeletexenforo config.php
Personally I think overjoyed I discovered the blogs.
ReplyDeleteSex Toys