Skip to content

Instantly share code, notes, and snippets.

@abedputra
Created May 8, 2018 02:39
Show Gist options
  • Save abedputra/50723a8a6faa3c53b4bf44b92a659dc6 to your computer and use it in GitHub Desktop.
Save abedputra/50723a8a6faa3c53b4bf44b92a659dc6 to your computer and use it in GitHub Desktop.
Dust test with option, disable gpu and headless
<?php
namespace Tests;
use Laravel\Dusk\TestCase as BaseTestCase;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Chrome\ChromeOptions;
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()
{
$options = (new ChromeOptions)->addArguments([
'--disable-gpu',
'--headless'
]);
return RemoteWebDriver::create(
'http://localhost:9515', DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment