diff --git a/stubs/DuskTestCase.stub b/stubs/DuskTestCase.stub index 808af69c8..c564246fc 100644 --- a/stubs/DuskTestCase.stub +++ b/stubs/DuskTestCase.stub @@ -32,7 +32,7 @@ abstract class DuskTestCase extends BaseTestCase protected function driver() { $options = (new ChromeOptions)->addArguments(collect([ - '--window-size=1920,1080', + $this->shouldStartMaximized() ? '--start-maximized' : '--window-size=1920,1080', ])->unless($this->hasHeadlessDisabled(), function ($items) { return $items->merge([ '--disable-gpu', @@ -58,4 +58,15 @@ abstract class DuskTestCase extends BaseTestCase return isset($_SERVER['DUSK_HEADLESS_DISABLED']) || isset($_ENV['DUSK_HEADLESS_DISABLED']); } + + /** + * Determine if the browser window should start maximized. + * + * @return bool + */ + protected function shouldStartMaximized() + { + return isset($_SERVER['DUSK_START_MAXIMIZED']) || + isset($_ENV['DUSK_START_MAXIMIZED']); + } }