New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem running dusk on Homestead #50

Closed
SaeedPrez opened this Issue Jan 24, 2017 · 40 comments

Comments

Projects
None yet
@SaeedPrez

SaeedPrez commented Jan 24, 2017

Hello,

So I just installed a new Laravel 5.4 project and thought I'd give Dusk a try..

Followed the installation steps in the documentation:

  1. Ran composer require laravel/dusk
  2. Updated AppServiceProvider.php
  3. Ran php artisan dusk:install

But when I run php artisan dusk I get the following output:

dir=$(d=${0%[/\\]*}; cd "$d"; cd "../phpunit/phpunit" && pwd)

# See if we are running in Cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
        # Cygwin paths start with /cygdrive/ which will break windows PHP,
        # so we need to translate the dir path to windows format. However
        # we could be using cygwin PHP which does not require this, so we
        # test if the path to PHP starts with /cygdrive/ rather than /usr/bin
        if [[ $(which php) == /cygdrive/* ]]; then
                dir=$(cygpath -m "$dir");
        fi
fi

dir=$(echo $dir | sed 's/ /\ /g')
"${dir}/phpunit" "$@"

It seems to be outputting the script instead of executing it.

I'm running latest Homestead on Windows 10 with PHP 7.1.0-2+deb.sury.org~xenial+1 (cli) ( NTS )

PS. PHPUnit works as expected.

@tyler36

This comment has been minimized.

Show comment
Hide comment
@tyler36

tyler36 Jan 25, 2017

Me too on latest Homestead.
Doesn't work on Windows 10 either.

tyler36 commented Jan 25, 2017

Me too on latest Homestead.
Doesn't work on Windows 10 either.

@spyric

This comment has been minimized.

Show comment
Hide comment
@spyric

spyric Jan 25, 2017

Contributor

Try this fork https://github.com/spyric/dusk/tree/windows
In alpha there was no compability with Windows. This fork should fix this issue, but it still not merged

Contributor

spyric commented Jan 25, 2017

Try this fork https://github.com/spyric/dusk/tree/windows
In alpha there was no compability with Windows. This fork should fix this issue, but it still not merged

@SaeedPrez

This comment has been minimized.

Show comment
Hide comment
@SaeedPrez

SaeedPrez Jan 25, 2017

Thanks @spyric I tried that yesterday and even though it didn't help the problem mentioned in the first post, I was able to run Dusk from Windows command prompt.

SaeedPrez commented Jan 25, 2017

Thanks @spyric I tried that yesterday and even though it didn't help the problem mentioned in the first post, I was able to run Dusk from Windows command prompt.

@tzurbaev

This comment has been minimized.

Show comment
Hide comment
@tzurbaev

tzurbaev Jan 25, 2017

Finally got it working in Vagrant on Ubuntu 14.04 (not a Homestead image though). My host OS is Windows 10.

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.

tzurbaev commented Jan 25, 2017

Finally got it working in Vagrant on Ubuntu 14.04 (not a Homestead image though). My host OS is Windows 10.

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.

@rustymulvaney

This comment has been minimized.

Show comment
Hide comment
@rustymulvaney

rustymulvaney Jan 25, 2017

I'm having issues running on Homestead as well, but I'm running my Vagrant box on Linux Mint. I have updated Homestead to latest, and tried using a new test site. Also, tried the various methods listed above which didn't work.

If I follow the Dusk setup exactly, I get the following:

There was 1 error:

1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY"}}

Failed to connect to localhost port 9515: Connection refused

/home/vagrant/test/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:287
/home/vagrant/test/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:121
/home/vagrant/test/tests/DuskTestCase.php:32
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:180
/home/vagrant/test/vendor/laravel/framework/src/Illuminate/Support/helpers.php:639
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:181
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:111
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:85
/home/vagrant/test/tests/Browser/ExampleTest.php:21

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

EDIT

I have gotten a little farther by marking the /vendor/laravel/dusk/bin/chromedriver-linux executable:
chmod a+x ./vendor/laravel/dusk/bin/chromedriver-linux

After making this edit, I now get a timeout error:

There was 1 error:

1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY"}}

Operation timed out after 30000 milliseconds with 0 bytes received

/home/vagrant/test/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:287
/home/vagrant/test/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:121
/home/vagrant/test/tests/DuskTestCase.php:32
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:180
/home/vagrant/test/vendor/laravel/framework/src/Illuminate/Support/helpers.php:639
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:181
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:111
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:85
/home/vagrant/test/tests/Browser/ExampleTest.php:21

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

I tried another solution from @abalozz (#10).

  • Installing xvfb apt-get install xvfb
  • Modifying the SupportsChrome Trait: static::$chromeProcess = new Process('xvfb-run ./chromedriver-linux', realpath(__DIR__.'/../bin'), null, null, null);

Unfortunately, this solution seems to be buggy since the tests are sometimes very slow to run.

rustymulvaney commented Jan 25, 2017

I'm having issues running on Homestead as well, but I'm running my Vagrant box on Linux Mint. I have updated Homestead to latest, and tried using a new test site. Also, tried the various methods listed above which didn't work.

If I follow the Dusk setup exactly, I get the following:

There was 1 error:

1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY"}}

Failed to connect to localhost port 9515: Connection refused

/home/vagrant/test/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:287
/home/vagrant/test/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:121
/home/vagrant/test/tests/DuskTestCase.php:32
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:180
/home/vagrant/test/vendor/laravel/framework/src/Illuminate/Support/helpers.php:639
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:181
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:111
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:85
/home/vagrant/test/tests/Browser/ExampleTest.php:21

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

EDIT

I have gotten a little farther by marking the /vendor/laravel/dusk/bin/chromedriver-linux executable:
chmod a+x ./vendor/laravel/dusk/bin/chromedriver-linux

After making this edit, I now get a timeout error:

There was 1 error:

1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY"}}

Operation timed out after 30000 milliseconds with 0 bytes received

/home/vagrant/test/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:287
/home/vagrant/test/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:121
/home/vagrant/test/tests/DuskTestCase.php:32
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:180
/home/vagrant/test/vendor/laravel/framework/src/Illuminate/Support/helpers.php:639
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:181
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:111
/home/vagrant/test/vendor/laravel/dusk/src/TestCase.php:85
/home/vagrant/test/tests/Browser/ExampleTest.php:21

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

I tried another solution from @abalozz (#10).

  • Installing xvfb apt-get install xvfb
  • Modifying the SupportsChrome Trait: static::$chromeProcess = new Process('xvfb-run ./chromedriver-linux', realpath(__DIR__.'/../bin'), null, null, null);

Unfortunately, this solution seems to be buggy since the tests are sometimes very slow to run.

@amochohan

This comment has been minimized.

Show comment
Hide comment
@amochohan

amochohan Jan 27, 2017

Contributor

The following, (taken from here) worked for me:

# 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 &
Contributor

amochohan commented Jan 27, 2017

The following, (taken from here) worked for me:

# 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 &
@mnabialek

This comment has been minimized.

Show comment
Hide comment
@mnabialek

mnabialek Jan 28, 2017

Contributor

@SaeedPrez Have you solved the sisue from 1st post? I'm getting exactly same on docker - displayed content of vendor/bin/phpunit instead of executing it. Bare phpunit is working without any problem

Contributor

mnabialek commented Jan 28, 2017

@SaeedPrez Have you solved the sisue from 1st post? I'm getting exactly same on docker - displayed content of vendor/bin/phpunit instead of executing it. Bare phpunit is working without any problem

@SaeedPrez

This comment has been minimized.

Show comment
Hide comment
@SaeedPrez

SaeedPrez Jan 28, 2017

@mnabialek Sorry, I have no solution. It was consuming a lot of my time so I decided to continue development in 5.3 and in a few weeks, maybe when 5.4 is a bit less rough around the edges try once again.

SaeedPrez commented Jan 28, 2017

@mnabialek Sorry, I have no solution. It was consuming a lot of my time so I decided to continue development in 5.3 and in a few weeks, maybe when 5.4 is a bit less rough around the edges try once again.

@mnabialek

This comment has been minimized.

Show comment
Hide comment
@mnabialek

mnabialek Jan 28, 2017

Contributor

@SaeedPrez On my end #70 fixed this (but haven't run full Dusk test yet because of further connection problems that I need to solve in free time that were mentioned also in this thread)

Contributor

mnabialek commented Jan 28, 2017

@SaeedPrez On my end #70 fixed this (but haven't run full Dusk test yet because of further connection problems that I need to solve in free time that were mentioned also in this thread)

@SaeedPrez

This comment has been minimized.

Show comment
Hide comment
@SaeedPrez

SaeedPrez Jan 28, 2017

@mnabialek awesome, great job! I'll close this issue since the original issue is fixed and merged.

SaeedPrez commented Jan 28, 2017

@mnabialek awesome, great job! I'll close this issue since the original issue is fixed and merged.

@SaeedPrez SaeedPrez closed this Jan 28, 2017

@browner12

This comment has been minimized.

Show comment
Hide comment
@browner12

browner12 Feb 10, 2017

Contributor

is this fixing it for other people? I am still having issues on the current v1.0.5

Contributor

browner12 commented Feb 10, 2017

is this fixing it for other people? I am still having issues on the current v1.0.5

@johanvanhelden

This comment has been minimized.

Show comment
Hide comment
@johanvanhelden

johanvanhelden Feb 10, 2017

@browner12

No, I get a timeout:

Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY"}}

Operation timed out after 30001 milliseconds with 0 bytes received

johanvanhelden commented Feb 10, 2017

@browner12

No, I get a timeout:

Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY"}}

Operation timed out after 30001 milliseconds with 0 bytes received
@fukuball

This comment has been minimized.

Show comment
Hide comment
@fukuball

fukuball Feb 13, 2017

I am still having issues on the current v1.0.5, too.

fukuball commented Feb 13, 2017

I am still having issues on the current v1.0.5, too.

@murribu

This comment has been minimized.

Show comment
Hide comment
@murribu

murribu Feb 15, 2017

This was helpful to me

murribu commented Feb 15, 2017

This was helpful to me

@browner12

This comment has been minimized.

Show comment
Hide comment
@browner12

browner12 Feb 15, 2017

Contributor

Yah, for me the issue was the chromedriver was not actually executable. updating the permissions allowed me to finally run Dusk.

see #81

Contributor

browner12 commented Feb 15, 2017

Yah, for me the issue was the chromedriver was not actually executable. updating the permissions allowed me to finally run Dusk.

see #81

@fukuball

This comment has been minimized.

Show comment
Hide comment
@fukuball

fukuball Feb 16, 2017

@murribu Thank! This really help. I can run duck in Homestead.

fukuball commented Feb 16, 2017

@murribu Thank! This really help. I can run duck in Homestead.

@driesvints

This comment has been minimized.

Show comment
Hide comment
@driesvints

driesvints Mar 11, 2017

@tzurbaev thanks for your comment. Saved my butt.

driesvints commented Mar 11, 2017

@tzurbaev thanks for your comment. Saved my butt.

@nonDeath

This comment has been minimized.

Show comment
Hide comment
@nonDeath

nonDeath Mar 15, 2017

I get the same issue, ubuntu 16.04, laravel v5.4.15, dusk v1.0.10. Making excecutable the file, or more extreme giving chmod 777 on entire folder

Again, dowloading the crhomedriver latest version and replacing, don't work!

But mi error is Failed to connect to localhost port xxxx: Connection refused

But running $ vendor/laravel/dusk/bin/crhomedriver-linux on another terminal i get this work fin, but that isn't the idea.

nonDeath commented Mar 15, 2017

I get the same issue, ubuntu 16.04, laravel v5.4.15, dusk v1.0.10. Making excecutable the file, or more extreme giving chmod 777 on entire folder

Again, dowloading the crhomedriver latest version and replacing, don't work!

But mi error is Failed to connect to localhost port xxxx: Connection refused

But running $ vendor/laravel/dusk/bin/crhomedriver-linux on another terminal i get this work fin, but that isn't the idea.

@lgyaxx

This comment has been minimized.

Show comment
Hide comment
@lgyaxx

lgyaxx Mar 28, 2017

@tzurbaev Thank you! Works like a charm now.

lgyaxx commented Mar 28, 2017

@tzurbaev Thank you! Works like a charm now.

@vesper8

This comment has been minimized.

Show comment
Hide comment
@vesper8

vesper8 Apr 2, 2017

Lots of solutions floating around but this here is the official solution that will be included in the next vagrant homestead box. I've tried it and it works good

https://github.com/laravel/homestead/pull/528/files#diff-6c17dd8d21b8b745850a87b9d0de77c7

basically run

sudo apt-get update
sudo apt-get -y install libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4
sudo apt-get -y install chromium-browser
sudo apt-get -y install xvfb gtk2-engines-pixbuf
sudo apt-get -y install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable
sudo apt-get -y install imagemagick x11-apps

and then update your aliases with the latest ones which includes this new function

function dusk() {
     pids=$(pidof /usr/bin/Xvfb)
 
     if [ ! -n "$pids" ]; then
         Xvfb :0 -screen 0 1280x960x24 &
     fi
 
     php artisan dusk "$@"
 }

You can also alternatively use this release candidate homestead box which has the fix in it
https://atlas.hashicorp.com/Svpernova09/boxes/nothomestead

vesper8 commented Apr 2, 2017

Lots of solutions floating around but this here is the official solution that will be included in the next vagrant homestead box. I've tried it and it works good

https://github.com/laravel/homestead/pull/528/files#diff-6c17dd8d21b8b745850a87b9d0de77c7

basically run

sudo apt-get update
sudo apt-get -y install libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4
sudo apt-get -y install chromium-browser
sudo apt-get -y install xvfb gtk2-engines-pixbuf
sudo apt-get -y install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable
sudo apt-get -y install imagemagick x11-apps

and then update your aliases with the latest ones which includes this new function

function dusk() {
     pids=$(pidof /usr/bin/Xvfb)
 
     if [ ! -n "$pids" ]; then
         Xvfb :0 -screen 0 1280x960x24 &
     fi
 
     php artisan dusk "$@"
 }

You can also alternatively use this release candidate homestead box which has the fix in it
https://atlas.hashicorp.com/Svpernova09/boxes/nothomestead

@shez1983

This comment has been minimized.

Show comment
Hide comment
@shez1983

shez1983 Apr 7, 2017

just to clarify I had the same problem - I did:

sudo apt-get update
sudo apt-get -y install libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4
sudo apt-get -y install chromium-browser
sudo apt-get -y install xvfb gtk2-engines-pixbuf
sudo apt-get -y install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable
sudo apt-get -y install imagemagick x11-apps

and then

chmod a+x ./vendor/laravel/dusk/bin/chromedriver-linux

and it seemed to have solved the problem

shez1983 commented Apr 7, 2017

just to clarify I had the same problem - I did:

sudo apt-get update
sudo apt-get -y install libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4
sudo apt-get -y install chromium-browser
sudo apt-get -y install xvfb gtk2-engines-pixbuf
sudo apt-get -y install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable
sudo apt-get -y install imagemagick x11-apps

and then

chmod a+x ./vendor/laravel/dusk/bin/chromedriver-linux

and it seemed to have solved the problem

@digitlimit

This comment has been minimized.

Show comment
Hide comment
@digitlimit

digitlimit Aug 14, 2017

@tzurbaev solution worked for me except for screenshots.
How do I get screenshots to work?
I am running Ubuntu 16.04.2 LTS, Release: 16.04, Codename: xenial

digitlimit commented Aug 14, 2017

@tzurbaev solution worked for me except for screenshots.
How do I get screenshots to work?
I am running Ubuntu 16.04.2 LTS, Release: 16.04, Codename: xenial

@ryancwalsh

This comment has been minimized.

Show comment
Hide comment
@ryancwalsh

ryancwalsh commented Aug 15, 2017

Thank you, @tzurbaev ! (#50 (comment))

@mnabialek

This comment has been minimized.

Show comment
Hide comment
@mnabialek

mnabialek Sep 26, 2017

Contributor

If anyone has problems with displaying remote fonts (for example from Google) this package might be useful - https://github.com/mnabialek/laravel-test-css

Contributor

mnabialek commented Sep 26, 2017

If anyone has problems with displaying remote fonts (for example from Google) this package might be useful - https://github.com/mnabialek/laravel-test-css

@trogne

This comment has been minimized.

Show comment
Hide comment
@trogne

trogne Nov 27, 2017

But what command should be done on the windows host ? Should I run "php artisan dusk" on windows OR on the homestead ?

trogne commented Nov 27, 2017

But what command should be done on the windows host ? Should I run "php artisan dusk" on windows OR on the homestead ?

@trogne

This comment has been minimized.

Show comment
Hide comment
@trogne

trogne Nov 27, 2017

@vesper8 : where do I add the alias ? Do I run "php artisan dusk" on the homestead ssh ? I'm using windows with homestead. "php artisan dusk" does not even open the windows chrome browser.

trogne commented Nov 27, 2017

@vesper8 : where do I add the alias ? Do I run "php artisan dusk" on the homestead ssh ? I'm using windows with homestead. "php artisan dusk" does not even open the windows chrome browser.

@browner12

This comment has been minimized.

Show comment
Hide comment
@browner12

browner12 Nov 27, 2017

Contributor

Dusk is by default "headless" now, which means it will not open a chrome browser in your OS.

Contributor

browner12 commented Nov 27, 2017

Dusk is by default "headless" now, which means it will not open a chrome browser in your OS.

@trogne

This comment has been minimized.

Show comment
Hide comment
@trogne

trogne Nov 27, 2017

@tzurbaev : I do exactly what you say, but the chrome browser does not even open.
I'm using windows 10 and homestead. Xvfb is started on the homestead vm. On another homestead terminal, I run "php artisan homestead". No chrome browser pops up.

trogne commented Nov 27, 2017

@tzurbaev : I do exactly what you say, but the chrome browser does not even open.
I'm using windows 10 and homestead. Xvfb is started on the homestead vm. On another homestead terminal, I run "php artisan homestead". No chrome browser pops up.

@trogne

This comment has been minimized.

Show comment
Hide comment
@trogne

trogne Nov 27, 2017

@browner12 : So it's impossible today to test with a real browser ? (e.g. seeing Dusk typing in a form and submit it)

trogne commented Nov 27, 2017

@browner12 : So it's impossible today to test with a real browser ? (e.g. seeing Dusk typing in a form and submit it)

@browner12

This comment has been minimized.

Show comment
Hide comment
@browner12

browner12 Nov 27, 2017

Contributor

nope, just comment out the --headless line on the driver() method in DuskTestCase

Contributor

browner12 commented Nov 27, 2017

nope, just comment out the --headless line on the driver() method in DuskTestCase

@trogne

This comment has been minimized.

Show comment
Hide comment
@trogne

trogne Nov 27, 2017

@browner12 : Ok, I see the browser popping up. But I have to run "php artisan dusk" on windows. I cannot run the command on the homestead vm ? Also, for "php artisan dusk" on windows, it works even without the "Xvfb" process.

trogne commented Nov 27, 2017

@browner12 : Ok, I see the browser popping up. But I have to run "php artisan dusk" on windows. I cannot run the command on the homestead vm ? Also, for "php artisan dusk" on windows, it works even without the "Xvfb" process.

@browner12

This comment has been minimized.

Show comment
Hide comment
@browner12

browner12 Nov 27, 2017

Contributor

i'm not sure how you're setup, but Homestead really only exists in the terminal, so it doesn't have a GUI to popup a Chrome window.

Run the command in your host OS if you want to popup the browser and see what's going on. If you want to go faster, just run it in Homestead with headless turned on. (you still get screenshots on errors I believe)

I only live in Linux world, though, so maybe Windows is different.

Contributor

browner12 commented Nov 27, 2017

i'm not sure how you're setup, but Homestead really only exists in the terminal, so it doesn't have a GUI to popup a Chrome window.

Run the command in your host OS if you want to popup the browser and see what's going on. If you want to go faster, just run it in Homestead with headless turned on. (you still get screenshots on errors I believe)

I only live in Linux world, though, so maybe Windows is different.

@trogne

This comment has been minimized.

Show comment
Hide comment
@trogne

trogne Nov 27, 2017

Ok but what is Xvfb for then ? Xvfb -ac :0 -screen 0 1280x1024x16 & : This is running on the headless homestead VM ? How does the graphical chrome on host gets fired then ?

trogne commented Nov 27, 2017

Ok but what is Xvfb for then ? Xvfb -ac :0 -screen 0 1280x1024x16 & : This is running on the headless homestead VM ? How does the graphical chrome on host gets fired then ?

@browner12

This comment has been minimized.

Show comment
Hide comment
@browner12

browner12 Nov 27, 2017

Contributor

not really sure. might be legacy hack from before Chrome had a true "headless" mode.

seeing as Chrome "headless" was released in June of this year, this seems most likely.

Contributor

browner12 commented Nov 27, 2017

not really sure. might be legacy hack from before Chrome had a true "headless" mode.

seeing as Chrome "headless" was released in June of this year, this seems most likely.

@trogne

This comment has been minimized.

Show comment
Hide comment
@trogne

trogne Nov 27, 2017

OK... I thought "Xvfb" was used to send the chrome browser graphical output from the homestead VM to the physical Windows host.

trogne commented Nov 27, 2017

OK... I thought "Xvfb" was used to send the chrome browser graphical output from the homestead VM to the physical Windows host.

@trogne

This comment has been minimized.

Show comment
Hide comment
@trogne

trogne Nov 27, 2017

OK! My answer here : https://developers.google.com/web/updates/2017/04/headless-chrome :

So I still need Xvfb?

No. Headless Chrome doesn't use a window so a display server like Xvfb is no longer needed. You can happily run your automated tests without it.

What is Xvfb? Xvfb is an in-memory display server for Unix-like systems that enables you to run graphical applications (like Chrome) without an attached physical display. Many people use Xvfb to run earlier versions of Chrome to do "headless" testing.

trogne commented Nov 27, 2017

OK! My answer here : https://developers.google.com/web/updates/2017/04/headless-chrome :

So I still need Xvfb?

No. Headless Chrome doesn't use a window so a display server like Xvfb is no longer needed. You can happily run your automated tests without it.

What is Xvfb? Xvfb is an in-memory display server for Unix-like systems that enables you to run graphical applications (like Chrome) without an attached physical display. Many people use Xvfb to run earlier versions of Chrome to do "headless" testing.

@Ravaelles

This comment has been minimized.

Show comment
Hide comment
@Ravaelles

Ravaelles Dec 5, 2017

For me the easiest solution was to simply migrate to Laravel 5.5 where Dusk works natively on Win 10.
...now Dusk actually works, but incredibly slowly, so yet another problem, yay.

Ravaelles commented Dec 5, 2017

For me the easiest solution was to simply migrate to Laravel 5.5 where Dusk works natively on Win 10.
...now Dusk actually works, but incredibly slowly, so yet another problem, yay.

@webcrazy

This comment has been minimized.

Show comment
Hide comment
@webcrazy

webcrazy Feb 8, 2018

@browner12 Thanks. If i disabled --headless, it works as expected but if I turn on, I got error and error screenshots become blank. not sure why. looks like I will have to stick with --headless for the time being.

webcrazy commented Feb 8, 2018

@browner12 Thanks. If i disabled --headless, it works as expected but if I turn on, I got error and error screenshots become blank. not sure why. looks like I will have to stick with --headless for the time being.

@chilio

This comment has been minimized.

Show comment
Hide comment
@chilio

chilio Feb 20, 2018

@webcrazy same issue here (Laravel 5.5, Win10, Homestead).
What makes me said, is that, it was working fine, at least for last couple of months.
For me, one issue is that, screenshots are blank/white.
The other one, I am facing, is getting failed tests, when I use assertPathIs() after redirect.
It happens only, if I run chromedriver in headless mode. With windowed mode, all tests pass green.
What is intriguing, that my tests pass green in my gitlab CI.
So this issue is even more confusing...
BTW I've tried chromedriver 2.33 and 2.35, same result.

chilio commented Feb 20, 2018

@webcrazy same issue here (Laravel 5.5, Win10, Homestead).
What makes me said, is that, it was working fine, at least for last couple of months.
For me, one issue is that, screenshots are blank/white.
The other one, I am facing, is getting failed tests, when I use assertPathIs() after redirect.
It happens only, if I run chromedriver in headless mode. With windowed mode, all tests pass green.
What is intriguing, that my tests pass green in my gitlab CI.
So this issue is even more confusing...
BTW I've tried chromedriver 2.33 and 2.35, same result.

@henryonsoftware

This comment has been minimized.

Show comment
Hide comment
@henryonsoftware

henryonsoftware Apr 12, 2018

@tzurbaev I'm crazy with my Laravel 5.4 and your solution help me a lot.
Especially this mention Also you may want to add your dev domain in guest's /etc/hosts file, I wrong when creating it on local instead of the virtual machine.

Thanks so much!

henryonsoftware commented Apr 12, 2018

@tzurbaev I'm crazy with my Laravel 5.4 and your solution help me a lot.
Especially this mention Also you may want to add your dev domain in guest's /etc/hosts file, I wrong when creating it on local instead of the virtual machine.

Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment