railsware / rack_session_access

Rack middleware that provides access to rack.session environment
MIT License
257 stars 29 forks source link

Updating rack session fails in Firefox #35

Open rosemichaele opened 4 years ago

rosemichaele commented 4 years ago

I am trying to use this gem while testing Firefox through a remote selenium webdriver session, and am having problems with the Capybara step that fills in the session hash on the rack session edit screen. See what's going in the first 30 seconds of this test recording:

https://automate.browserstack.com/builds/dc63e64abd1dd845e696780be5060e7ce4474bca/sessions/a2617f6ad2ba5bc1bb2d863a2c53f34709813f7a?auth_token=230388c501523ccc9d4f62d3bb17b1ba0d6bfdb11daaa3b8dcb36f1f7dd9bd25

I was able to work around the issue by replacing the fill_in method as below in lib/rack_session_access/capybara.rb. There may be a more concise way of writing this. Happy to open a pull request if it passes the 👀test.

def set_rack_session(hash)
  data = ::RackSessionAccess.encode(hash)

  visit ::RackSessionAccess.edit_path
  has_content?("Update rack session")
  fill_in "data", :with => data
  click_button "Update"
  has_content?("Rack session data")
end
def set_rack_session(hash)
  data = ::RackSessionAccess.encode(hash)

  visit ::RackSessionAccess.edit_path
  has_content?("Update rack session")
  textarea = find_field('data')
  textarea.native.clear
  textarea.send_keys(data)
  click_button "Update"
  has_content?("Rack session data")
end
ayanko commented 4 years ago

native does not work for rack_test driver. Actually fill_in is pretty base helper in capybara and I wonder why it "does not" work for FF now.