GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
sessionStorage and localStorage are not cleared on reset, but I think they should, in the same way that cookies are being reset.
For example here the second scenario fails when running both specs together:
feature "reset sessionStorage", :js do
scenario "first" do
page.execute_script "sessionStorage.setItem('test', 'foo')"
scenario "second" do
page.evaluate_script("sessionStorage.getItem('test')").should == ""
I got this working locally with the following snippet tossed into support:
next if @local_storage_has_been_cleared
next unless current_url =~ /localhost/ || current_url =~ /127.0.0.1/
next unless page.present?
@local_storage_has_been_cleared = true
page.execute_script('if (localStorage && localStorage.clear) localStorage.clear()')
You'll have to adjust the current_url check as appropriate for your setup.
Hope this helps somebody!
I'm running into this issue as well. Is this just not considered a bug? I will gladly take a stab at submitting a patch if I can.
+1 for this issue. Is this the expected behavior and calling code should deal with it? Or is it a bug
@levicole yeah, I'd say this is a bug. A tested patch would be most welcome.
@jferris I've pushed a pull request for resetting localStorage in #515
This is fixed on master. Thanks, @levicole.