Facing weird issue when Capybara.default_driver = :selenium_headless

30 views
Skip to first unread message

Vikas Kumar

unread,
Jan 30, 2022, 10:28:06 AMJan 30
to Capybara
My configurations are as follows:
capybara -> v3.36.0
selenium-webdriver -> v4.1.0

Capybara configurations
Capybara.server = :puma, { Silent: true }
Capybara.default_max_wait_time = 5
Capybara.default_driver = :selenium_headless

I am using devise for authentication and it provides integration test helper sign_in, sign_out. Whenever I login using sign_in then I am able to just do a transition to one more page. If I try to transition one more time to another page I get unauthorized error and the user is logged out.
The test works with :rack_test driver.
It also works when I annotate my rspec feature test using js: true.
But just using Capybara.default_driver = :selenium_headless is not handling authentication properly. Is there something I am missing?

Thomas Walpole

unread,
Jan 31, 2022, 2:05:45 PMJan 31
to Capybara
Check for any before/after hooks you have installed that are triggered by :js metadata.  Capybara doesn't do anything to handle authentication it just controls the browser.  The browser receives cookies/etc from the application and then has to submit them back to the application.  If you don't have any before/after hooks that would be affected by js metadata then please post a full example test that's having issues so I can evaluate
Reply all
Reply to author
Forward
0 new messages