Laravel Dusk on Homestead
I've ending a successfull setup of DUSK :
- Windows 8.1
- Homestead (latest version)
- Laravel 5.4
-
follow Laravel Doc https://laravel.com/docs/5.4/dusk#installation
-
Because the Chrome driver and other tools aren't packadged in Homestead, follow this link : https://medium.com/@splatEric/laravel-dusk-on-homestead-dc5711987595
-
config
Add your website name in /etc/hosts (don't forget this !!! Dusk runs inside Homestead !)
127.0.0.1 mylaravelapp
Add the uri in .env (while you're inside Homestead, you don't need to add an extra port number)
APP_URL="http://mylaravelapp"
You can test if you reach the right site with :
curl http://mylaravelapp
In tests/DuckTestCase add your URI
<?php
namespace Tests;
use Laravel\Dusk\TestCase as BaseTestCase;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
abstract class DuskTestCase extends BaseTestCase
{
use CreatesApplication;
/**
* Prepare for Dusk test execution.
*
* @beforeClass
* @return void
*/
public static function prepare()
{
static::startChromeDriver();
}
/**
* Create the RemoteWebDriver instance.
*
* @return \Facebook\WebDriver\Remote\RemoteWebDriver
*/
protected function driver()
{
return RemoteWebDriver::create(
'http://mylaravelapp:9515', DesiredCapabilities::chrome()
);
}
}
With all of this, it works like a charm. Hope this helps
Paguemaou
Please or to participate in this conversation.