Created
May 8, 2018 02:39
-
-
Save abedputra/50723a8a6faa3c53b4bf44b92a659dc6 to your computer and use it in GitHub Desktop.
Dust test with option, disable gpu and headless
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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