jason328 jason328 - 2 months ago 25
Ruby Question

What does page.driver.reset! do?

I'm running a Capybara(poltergeist) test that is sensitive to cached files in the browser. I want to test to ensure that if a user is visiting the page without a cache, they can see a form.

context 'when user on page with empty cache' do
scenario 'sees form' do
page.driver.reset!
visit home_path
# test to see if form exists
end
end


My question is this. Does
page.driver.reset!
reset the browser cache?

Answer

When using Poltergeist Driver#reset! doesn't clear the browser cache, but as long as you're running Poltergeist 1.10+ you can make sure it's cleared for your test by calling

page.driver.clear_memory_cache