Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Dusk how to show the browser while executing tests

I am writing some tests and I want to see whether Dusk correctly fills in the input fields but Dusk doesn't show the browser while running the tests, is there any way to force it to do that?

like image 816
Petar Vasilev Avatar asked Apr 20 '18 09:04

Petar Vasilev


2 Answers

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

like image 59
Tuan Ha Avatar answered Oct 16 '22 22:10

Tuan Ha


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

$options = (new ChromeOptions)->addArguments([
    //'--disable-gpu',
    //'--headless'
]);
like image 34
Jonas Staudenmeir Avatar answered Oct 16 '22 23:10

Jonas Staudenmeir