I was working setting up an integration with Behat and Drupal in an environment with Vagrant, this post contains the list of resources that help me to implement the integration.
Introduction to Behat Concepts
This post will explain you the basic things that you need to know about Behat.
Setup for Vagrant Machines
This post will explain how to setup the selenium server to run in the host machine and run the test from the vagrant machine.
General information about Behat
Things that I found in the road.
Curl didn’t work with our homemade SSL cert
I had a validation error with Goutte and our SSL certs since our certs are not “real certs”, we are using home made certs for development. In order to skip the SSL validation we had to add these lines to the behat.yml
extensions: Behat\MinkExtension: goutte: guzzle_parameters: verify: false sessions: default: goutte: guzzle_parameters: ssl.certificate_authority: false verify: false
Issue with the Dependency Injector
I found a weird trouble with the Symfony dependency injector, some constant were not found, googling for the solutions I found that the problem was since the versions of the components. The solution is to force the symfony/dependency-injection to an specific version. For that, in the composer.json of the behat project (not the one of drupal), add these required libraries.
"symfony/dependency-injection": "2.8.2", "symfony/event-dispatcher": "2.8.2",
Then do a composer update and composer install to download the specific library versions.
Run it with selenium
That will indicate to Behat to use Selenium Server.
Chrome Didn’t Opened
Once I have tried to test my feature with Selenium, Chrome didn’t started and I got a nice Java stack trace dump error. Trying to identify the problem I realize that I ran the Selenium Node in the host machine as Root. Be sure that you are running the Servers as the host session user so selenium will be able to open Chrome.