Setup Laradock + Laravel Dusk

To start running your Dusk tests with Laradock, in addition to the installation as explained in the official Laravel documentation, two more steps are needed.

First of all, you must create a specific environment file for Dusk, just following the official Laravel documentation (Environment Handling).

In the new file (for example, .env.dusk.local) the variable APP_URL must be set to http://nginx.

APP_URL=http://nginx

And, in the tests / DuskTestCase.php file, change the url of the selenium server to http://selenium: 4444/wd/hub.

return RemoteWebDriver::create(
'http://selenium:4444/wd/hub', DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
);

It’s ready, now you can run your Dusk tests:

php artisan dusk