Skip to content

Instantly share code, notes, and snippets.

@DylanLacey
Last active February 17, 2017 02:46
Show Gist options
  • Save DylanLacey/7727d3f053d7b613e52a03c0491ad5d8 to your computer and use it in GitHub Desktop.
Save DylanLacey/7727d3f053d7b613e52a03c0491ad5d8 to your computer and use it in GitHub Desktop.
Log Session ID
# REMOVE ME
# This is a hacky monkeypatch for diagnosing
# https://saucelabs.zendesk.com/agent/tickets/35719
# It isn't needed once that issue is resolved
# And is kinda gross. Dylan from Sauce is sorry for what he's done.
module RackSessionAccess
module Capybara
alias_method :original_set_rack_session, :set_rack_session
alias_method :original_get_rack_session, :get_rack_session
def set_rack_session(hash)
original_set_rack_session(hash)
STDERR.puts "The session ID used by set_rack_session is #{driver.browser.session_id}"
end
def get_rack_session
rack_session_data = original_get_rack_session
STDERR.puts "The session ID used by get_rack_session is #{driver.browser.session_id}"
return rack_session_data
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment