Laravel Dusk how to show the browser while executing tests

Updated (2021):

You can disable headless with 2 methods:

Method 1: Add this to your .env

DUSK_HEADLESS_DISABLED=true

Method 2: Add this to your special test case if you don't need to show the browser for all tests

protected function hasHeadlessDisabled(): bool
{
    return true;
}

Btw, I don't know why these are not mentioned in the documentation. I found the above methods myself from DuskTestCase.php.

enter image description here


Disable the headless mode in tests\DuskTestCase.php file driver() function:

$options = (new ChromeOptions)->addArguments([
    //'--disable-gpu',
    //'--headless'
]);