contexts icon indicating copy to clipboard operation
contexts copied to clipboard

Stopping the session in a hard way at the end of the scenario should be opt-in

Open stof opened this issue 11 years ago • 1 comments

Currently, using the BrowserContext will always force stopping the session at the end of the scenario because of https://github.com/sanpii/behatch-contexts/blob/67de9a82d08e7355628b8d1a707bddec13f945f2/src/Context/BrowserContext.php#L21

But this is a bad idea:

  • given that the logic is not written in a smart way, if the session is already stopped, it will start it and close it immediately. This is wasting time (especially when using Selenium2 and this involves launching Firefox and closing it)
  • Mink is able to reset the session without closing it entirely (and btw, the Mink 1.6 release ensures a consistent behavior across drivers for that, allowing us to fix a few bugs in drivers). This allows running much faster than stopping the session entirely, especially when using Selenium (as it avoids closing Firefox and relaunching it). I already got many complaints about this from people requesting to reuse the firefox window, while Mink already supports it since years when your context is not registered.

I don't know why you force isolating each scenario entirely (MinkExtension already provides a way to do it for scenarios needing it to work btw), but it should not be forced by default for anyone using your context (it is not even documented)

stof avatar Sep 26 '14 13:09 stof

:+1:

aik099 avatar Sep 26 '14 13:09 aik099