0

I've enjoyed Laravel, Homestead, and Dusk for years. Everything was working fine, but I recently needed to upgrade to PHP 7.4 for a new package I wanted to install, so I went ahead and upgraded VirtualBox, Vagrant, etc to:

  • vboxmanage --version = 6.1.2r135662
  • Vagrant 2.2.7
  • laravel/homestead (virtualbox, 9.2.0)
  • Homestead v10.2.0
  • Laravel 6.13.1
  • Dusk v5.9.0
  • Ubuntu 18.04.3 LTS
  • PHP 7.4.1
  • Windows 10 is the host

Now, when I run my Dusk browser tests, they produce screenshots with this error in Chrome: "This site can't be reached" ERR_CONNECTION_REFUSED

But in Windows Chrome, I can browse to my local site fine, as usual (Windows is the host of my Homestead box).

My APP_URL in .env is (and has always been) APP_URL=https://abc.192.168.1.105.xip.io:44300, and it's the same in my .env.dusk.local file, which I've always had.

In Vagrant, when I run wget https://abc.192.168.1.105.xip.io:44300, the result says failed: Connection refused. But if I run wget 127.0.0.1, it downloads the correct page.

So then I figured I could change my APP_URL to 127.0.0.1 (although I wouldn't know why my upgrades would lead me to be required to make that change).

However, then the error in the Dusk Chrome screenshot becomes "Your connection is not private" NET::ERR_CERT_AUTHORITY_INVALID.

I have not found the docs at https://laravel.com/docs/6.x/dusk#installation to help with these problems. Ideas?

P.S. If I change to APP_URL=https://google.com, the screenshot successfully shows Google. So at least Chrome is installed properly in Homestead.

Ryan
  • 22,332
  • 31
  • 176
  • 357

1 Answers1

0

I got it working. I don't understand why these steps seem to be necessary since they were never necessary in my prior experience using Dusk, and no documentation mentioned them as newly necessary due to recent upgrades.

  1. I removed ":44300", so now my .env.dusk.local says APP_URL=https://abc.192.168.1.105.xip.io
  2. Then, running Dusk led to the "Your connection is not private" NET::ERR_CERT_AUTHORITY_INVALID error again, so I figured I needed to tell the Homestead Chrome browser to trust the self-signed certificate. https://stackoverflow.com/a/49612084/470749 and https://stackoverflow.com/a/22813705/470749 led me to run:
sudo apt-get install libnss3-tools
vagrant@vboxHomestead:~/Code/myproject$ cat /etc/nginx/ssl/ca.homestead.vboxHomestead.crt > ca.homestead.vboxHomestead.crt
certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "ca.homestead.vboxHomestead.crt" -i ca.homestead.vboxHomestead.crt

Now Dusk runs again.

Ryan
  • 22,332
  • 31
  • 176
  • 357