I am facing an issue while trying to use Behat and mink within a symfony project (sf2.4).
Situation:
I just started to test behat for symfony2 projects, which looks like awesome. I would also be able to use mink, as my main projects are currently web projects. I therefore follow the tutorial of the official doc: official doc
Issue:
While testing "In browser" solution with selenium, I download the jar, start it, and run via another cmd line window:
php bin/behat features/search.feature
and there comes an error:
[Behat\Testwork\ServiceContainer\Exception\ProcessingException]
The @javascript tag cannot be used without enabling a javascript session
EDIT: featureContext.php looks like this
<?php
#features/FeatureContext.php
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Behat\MinkExtension\Context\MinkContext;
/**
* Behat context class.
*/
//class FeatureContext implements SnippetAcceptingContext
class FeatureContext extends MinkContext
{
/**
* Initializes context.
*
* Every scenario gets it's own context object.
* You can also pass arbitrary arguments to the context constructor through behat.yml.
*/
public function __construct()
{
}
}
Solution:
I am not too sure about 1) the meaning of this error (javascript session?) nor about 2) how to solve it. I wasn't able to get appropriate documentation on the web about causes and fix.
Any hint much appreciated!
EDIT2:
Once this part was solved either by solving typo in #behat.yml, or by following doc for behat3 see jakub's post, which I was using at the time of this post), I had a second error:
Install MinkSelenium2Driver in order to use selenium2 driver.
This error was most evidently due to wrong composer setup. Just adding:
"behat/mink-selenium2-driver": "*"
solves this second issue. and it works!
Kind regards,