Mink: Auto-start session only upon 1st "->visit(...)" method call breaks my test suite
PR #705 from @aik099 breaks my testsuite as I am resizing the Window prior to each scenario.
class FeatureContext extends RawMinkContext
{
use KernelDictionary;
/**
* @BeforeScenario
*/
public function beforeScenario()
{
if ($this->getSession()->getDriver() instanceof Selenium2Driver) {
$this->getSession()->resizeWindow(1440, 900, 'current');
}
}
}
This breaks with the error:
┌─ @BeforeScenario # AppBundle\Features\Context\FeatureContext::beforeScenario()
│
╳ Fatal error: Call to a member function window() on null (Behat\Testwork\Call\Exception\FatalThrowableError)
│
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 30 (18 by maintainers)
This was fixed and is now suprisingly broken again since 1.8.0 (should have maybe been the reason for a BC release). So we might as well close this bug. The solution is: Overwrite your
getSession()to start the session if not already started.