Dusk and Homestead

Posted: 2017-04-24 00:47:58

Working on learning Dusk and really excited to get going with it.

But running it in homestead proved to be a bit tricky.

After following the docs and running php artisan dusk not much happened. Sure if I ran it on my Mac and it just worked but my tests needed to do migrations and what not and I want to keep my work in Homestead.

So a few steps later and it worked thanks to this post https://github.com/laravel/dusk/issues/50#issuecomment-275155974

Local host file

Make sure to edit sudo vim /etc/hosts and add the APP_URL there as well webforms.dev

Then make sure you can hit it from inside homestead as well.

curl -X GET http://webforms.dev

All set?

Then run xvfb

This is a virtual frame buffer that Chrome runs in. Pretty cool really https://en.wikipedia.org/wiki/Xvfb

So I like to use screen to start a new session

screen -S running_xvfb

and then in there run

Xvfb :0 -screen 0 1280x8000x24 &

Now we want to swap back to our default session CTRL+A then still holding CTRL let go of A and press D.

You are back at your default terminal


vagrant@homestead:~/Code/webforms$ screen -ls
There is a screen on:
    16315.running_xvfb  (04/24/2017 12:34:09 AM)    (Detached)
1 Socket in /var/run/screen/S-vagrant.

Now it all just worked!