Ok, so guys at PhantomJS are working on enabling localStorage support, it hasn't been merged yet.
Enabling HTML5 cache manifest in Poltergeist/PhantomJS tests
-
23-09-2022 - |
Pregunta
My app is using HTML5 cache manifest file and caches several js/css/html files on the client side. We are having problems with Poltergeist testing - same tests run with Selenium pass. With Poltergeist the first test passes (the files are not yet cached) but the second and all the rest fail, the page is blank as if the cache is not working. I tried to enable the PhantomJS disk cache by passing options to Poltergeist, in test_helper.rb (Rails' Test::Unit) I declared the poltergeist driver as:
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(MyRailsAppName, { phantomjs_options: ['--disk-cache=true' ] } )
end
Capybara.javascript_driver = :poltergeist
But this doesn't help. Any ideas?
[edit]: don't know if this is relevant but when I pause the test in the failing run and manually visit the page with cached content with
visit '/mobile'
=> {"status"=>"fail"}
status is failing, but when I visit a non-cached page, it works.
Solución