First, we will download selenium.
It can be nice to put it in its down directory, such as this. On Windows, choose your own:
mkdir ~/selenium
cd ~/selenium
Then download this link. 'wget' is an OSX download tool, otherwise just download this link and put it in your directory
wget http://selenium-release.storage.googleapis.com/2.44/selenium-server-standalone-2.44.0.jar
And the chrome driver of your OS from here:
http://chromedriver.storage.googleapis.com/index.html?path=2.8/
Then, in that directory, run this command to start selenium locally:
java -jar selenium-server-standalone-2.44.0.jar -Dwebdriver.chrome.driver=chromedriver
Leave this running in a separate tab and open a new terminal tab to keep working.
In your project, add the composer module:
composer require silverstripe/behat-extension:*
Put the attached behat.yml into the root of your project. It will give you both Chrome and Firefox support.
Now that you have everything, you can run the tests in Chrome like this:
vendor/bin/behat @framework --profile chrome
- Create
mysite/tests/behat/
,mysite/tests/behat/features
,mysite/tests/behat/features/bootstrap
- Copy
my-site.feature
intomysite/tests/behat/features
- Copy
FeatureContext.php
intomysite/tests/behat/features/bootstrap