Skip to content

Commit

Permalink
Add hasStartMaximizedEnabled method. (#978)
Browse files Browse the repository at this point in the history
* Add hasStartMaximizedEnabled method.

* Fix formatting.

* Update DuskTestCase.stub

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
roksprogar and taylorotwell authored May 9, 2022
1 parent 4f09b8e commit 7fed369
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion stubs/DuskTestCase.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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']);
}
}

0 comments on commit 7fed369

Please sign in to comment.