we are trying to run Behat tests inside vagrant machine, but we keep always getting problems.
This is Vagrant machine we are using https://github.com/vranac/vagrant-sylius-setup
So first issue was with cookies, we resolved that but now every scenario that is @javascript is failing
In screenshot which we got after error is says that route is missing?
Any Idea how to resolve this?
I have faced and managed to resolve this particular issue.
The key issue was the fact that ChromeWebdriver version (2.29) was either incompatible with Google Chrome version (59.0) or it had a bug in regards to setting cookies (Changelog does mention some work on cookies).
A working combination for me currently is ChromeDriver 2.30 + Google Chrome 59.0 - check those versions.
Another thing I had to change was the session handler to use proper sessions instead of mocksess(ions). In
app/config/config_test.yml
I've change theframework
>session
section like this:And yet another thing to check is if the sessions are created/read/written without any permission issues. I did face an issue at one point where I was running behat with
vagrant
user so it created the session file with this user as owner, but when it went through Selenium/Chrome back to the webserver then it tried to access it withwww-data
user and failed due to permission restrictions. As a workaround, I am now running behat underwww-data
user as well:sudo -E -u www-data bin/behat ...
. Similar issues may happen for caches too.It seems that for Vagrant specifically Sylius forces cache/log directories to be placed in
/dev/shm/sylius
, which in case of shared dir (between host and guest) is a performance boost, but also implies strict permission checks (See https://github.com/Sylius/Sylius/blob/79a5285/src/Sylius/Bundle/CoreBundle/Application/Kernel.php#L162-L164 )