Use Composer
$ composer require creasi/dusk-browserstack --dev
-
Add
WithBrowserStack
to your existingDuskTestCase
, like souse Laravel\Dusk\TestCase as BaseTestCase; use Creasi\DuskBrowserStack\WithBrowserStack; abstract class DuskTestCase extends BaseTestCase { use CreatesApplication; use WithBrowserStack; // ... }
-
Update
prepare
methoduse Creasi\DuskBrowserStack\BrowserStack; public static function prepare() { if (BrowserStack::hasAccessKey()) { static::startBrowserStackLocal(); return; } if (! static::runningInSail()) { static::startChromeDriver(); } }
-
Update
driver
methoduse Creasi\DuskBrowserStack\BrowserStack; protected function driver() { // ... $capabilities = DesiredCapabilities::chrome() ->setCapability(ChromeOptions::CAPABILITY, $options); return RemoteWebDriver::create( BrowserStack::getDriverURL(), $this->withBrowserStackCapabilities($capabilities) ); }
-
Last one, don't forget to update your
.env
fileBROWSERSTACK_USERNAME='<your-browserstack-username>' BROWSERSTACK_ACCESS_KEY='<your-browserstack-access-key>'
This library is open-sourced software licensed under MIT license.