Skip to content

Instantly share code, notes, and snippets.

@dustinleblanc
Created March 18, 2018 17:29
Show Gist options
  • Save dustinleblanc/c49b020419e70f70b40353b3d05a9735 to your computer and use it in GitHub Desktop.
Save dustinleblanc/c49b020419e70f70b40353b3d05a9735 to your computer and use it in GitHub Desktop.
Setting up Laravel Dusk with ChromeDriver and Lando
name: cool-app
recipe: laravel
compose:
- docker-compose.yml
config:
php: '7.1'
via: nginx
webroot: public
database: postgres
cache: redis
services:
appserver:
composer:
phpunit/phpunit: '*'
testdb:
type: postgres
creds:
user: laravel
password: laravel
database: laravel
node:
type: node:latest
tooling:
phpunit:
service: appserver
redis-cli:
service: cache
yarn:
service: node
node:
service: node
npm:
service: node
robo:
service: appserver
cmd: 'vendor/bin/robo'
version: '3'
services:
chromedriver:
image: robcherry/docker-chromedriver:latest
expose:
- "4444"
environment:
CHROMEDRIVER_WHITELISTED_IPS: ""
CHROMEDRIVER_URL_BASE: "/wd/hub"
security_opt:
- seccomp:unconfined
<?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://chromedriver:4444/wd/hub', DesiredCapabilities::chrome()
);
}
@tylers-username
Copy link

Inspired by @dustinleblanc's config, see an updated solution here for making the chromedriver and laravel dusk work within Lando.

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