Created
April 19, 2020 12:26
-
-
Save msztorc/4f537eebb84d5e2d5b76473f90734e72 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First of all, google-chrome is requried to be installed in guest OS: | |
$ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
$ sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' | |
$ sudo apt-get update && sudo apt-get install -y google-chrome-stable | |
Next thing is xvfb: | |
$ sudo apt-get install -y xvfb | |
Try to start ./vendor/laravel/dusk/bin/chromedriver-linux --port=8888. If you have some errors about loading libraries (libnss3.so, libgconf-2.so.4), try this: | |
$ sudo apt-get install -y libnss3-dev libxi6 libgconf-2-4 | |
When you see | |
$ ./vendor/laravel/dusk/bin/chromedriver-linux --port=8888 | |
Starting ChromeDriver 2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e) on port 8888 | |
Only local connections are allowed. | |
this means ChromeDriver can be started (so SupportsChrome trait should be able to start it too). You can stop this process for now (Ctrl+C). | |
Run | |
$ Xvfb :0 -screen 0 1280x960x24 & | |
in a separate terminal window. | |
Also you may want to add your dev domain in guest's /etc/hosts file: | |
127.0.0.1 domain.dev. | |
And finally run | |
$ php artisan dusk | |
PHPUnit 5.7.6 by Sebastian Bergmann and contributors. | |
. 1 / 1 (100%) | |
Time: 3.15 seconds, Memory: 10.00MB | |
OK (1 test, 1 assertion) | |
I didn't try more complex tests for now, but assume they should work. The only thing I've noticed not working is a screenshot feature. I have blank white screen instead of actual browser window. | |
Edit: screenshots feature is working, just don't load Google Fonts. | |
---- | |
# makes sure all your repos are up to date | |
sudo apt-get update | |
# chrome dependencies I think | |
sudo apt-get -y install libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4 | |
# chromium is what I had success with on Codeship, so seemed a good option | |
sudo apt-get install chromium-browser | |
# XVFB for headless applications | |
sudo apt-get -y install xvfb gtk2-engines-pixbuf | |
# fonts for the browser | |
sudo apt-get -y install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable | |
# support for screenshot capturing | |
sudo apt-get -y install imagemagick x11-apps | |
# Once all this has run through, you need to fire up xvfb on your homestead box. If you’re planning to # do this on a regular basis, you’ll want to get this setup on boot, but for the sake of testing things out: | |
Xvfb -ac :0 -screen 0 1280x1024x16 & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment