Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 1.83 KB

README.md

File metadata and controls

77 lines (55 loc) · 1.83 KB

Version License

Additional BrowserStack Local Supports for Laravel Dusk

Installation

Use Composer

$ composer require creasi/dusk-browserstack --dev

Usage

  1. Add WithBrowserStack to your existing DuskTestCase, like so

    use Laravel\Dusk\TestCase as BaseTestCase;
    use Creasi\DuskBrowserStack\WithBrowserStack;
    
    abstract class DuskTestCase extends BaseTestCase
    {
        use CreatesApplication;
        use WithBrowserStack;
    
        // ...
    }
  2. Update prepare method

    use Creasi\DuskBrowserStack\BrowserStack;
    
    public static function prepare()
    {
        if (BrowserStack::hasAccessKey()) {
            static::startBrowserStackLocal();
            return;
        }
    
        if (! static::runningInSail()) {
            static::startChromeDriver();
        }
    }
  3. Update driver method

    use Creasi\DuskBrowserStack\BrowserStack;
    
    protected function driver()
    {
        // ...
    
        $capabilities = DesiredCapabilities::chrome()
            ->setCapability(ChromeOptions::CAPABILITY, $options);
        
        return RemoteWebDriver::create(
            BrowserStack::getDriverURL(),
            $this->withBrowserStackCapabilities($capabilities)
        );
    }
  4. Last one, don't forget to update your .env file

    BROWSERSTACK_USERNAME='<your-browserstack-username>'
    BROWSERSTACK_ACCESS_KEY='<your-browserstack-access-key>'

License

This library is open-sourced software licensed under MIT license.