cuprite icon indicating copy to clipboard operation
cuprite copied to clipboard

Should we create a new browser context on reset?

Open palkan opened this issue 3 years ago • 0 comments

Problem

Currently, when using Cuprite with a typical Capybara setup with Capybara.reset_sessions! after each test, a new blank context is created after each test.

When running tests in a heady mode, it results in stale blank pages left open at the end of the test suite run.

Also, if a test uses multiple sessions, the second one is left open (while the first one is reused).

Solution

Looks like removing a call to #attach_page from here should do the trick: https://github.com/rubycdp/cuprite/blob/2bbf3634d92af4e8b8ec3026c2b66ccf1d0590ad/lib/capybara/cuprite/browser.rb#L34

The question is: what was the purpose of adding it here (and not initializing a page lazily)?

palkan avatar Jul 29 '22 00:07 palkan