Closed CaptainQuirk closed 7 years ago
Even without page object extension, you don't need to manually start the mink session. MinkExtension will do this for you. Do you use the MinkExtension for Behat?
I do ! But I had to do a
$session = new Behat\Mink\Session;
$session->start();
If the session is started automatically, where does it occur and how can I get a reference on it ?
By the way, I decided ro create an extension to register a custom PageObjectFactory
and it solved this particular issue.
Thanks !
I think it's Mink that starts the session when you request it: https://github.com/Behat/Mink/blob/master/src/Behat/Mink/Mink.php#L116-L118
Hi all,
I'm trying to implement the PageObject extension into an existing Behat\Mink test harness. Before trying, I've been having some success with the following architecture:
ParentContext
loaded as default@beforeScenario
and the@afterScenario
hooksI'm starting on a new suite and thought I'd give the following architecture a try:
ParentContext
loaded as defaultPopinContext
related to apopin/connected.feature
fileLoginContext
referenced inPopinContext
through the$environment
available in theBeforeScenarioHookScope
with one function called in aPopinContext
stepLoginPage
object that I would like to openIf I leave the
$session->start()
in myParentContext
, a first browser window spawns, like it would before, but before any other instructions are executed (even if I comment out the$loginPage->open()
, a second browser window spawns.If I remove the
$session->start()
in theParentContext
, any subsequent attempt at$loginPage->open()
fails, as if it would need a session to not use it at all.Could someone give me his/her opinion on the architecture I've chosen and maybe some pointers on what I'm doing wrong ?
Thanks in advance