Last active
August 10, 2023 17:48
-
-
Save lewispb/8e5d1d5a940f914d0fda16f41f2e3154 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SessionSystemTestHelper | |
def sign_in_as(user) | |
visit root_url # any fast-to-load page will do | |
cookie_jar = ActionDispatch::TestRequest.create.cookie_jar | |
cookie_jar.signed[:session_token] = user.sessions.create.token | |
page.driver.browser.manage.add_cookie(name: "session_token", value: cookie_jar[:session_token], sameSite: :Lax, httpOnly: true) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For the initial page load you can use a blank html page, so it's as fast as possible.
Something like
visit root_url + "blank.html"
where blank.html is a file served from /public.