dusk
dusk copied to clipboard
Issue with ending the browser process
Symphony Process class and Dusk class both have destruct methods. Symphony Process will send a signal to end the browser process directly, Dusk class will send a message to the browser process to tell it to end. The issue is that if Symphony Process destruct runs first and kills the process the Dusk message will fail and give a Fatal Error.
So either Dusk object has to be manually deallocated before a script ends, or the destruct method could be changed to catch the error.
Hi @robryanx, sorry for the delay in responded, do you have an example script to reproduce the issue you're describing?
use PHPUnit\Framework\TestCase;
use duncan3dc\Laravel\Dusk;
use duncan3dc\Laravel\Drivers\Chrome;
use Facebook\WebDriver\WebDriverBy;
class BrowserTest extends TestCase
{
public static $browser = null;
public static function setUpBeforeClass() : void
{
self::$browser = new Dusk;
}
public static function tearDownAfterClass() : void
{
self::$browser = null;
}
}
I think this interaction might only happen in the context of PHPUnit, so I don't fully understand it as the same class run independently doesn't cause it. The above example runs with PHPUnit, if self::$browser = null; is commented out it generates the following error:
PHP Fatal error: Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http DELETE to /session/8d19e89fa73ee95186b9490fdad29e05
Failed to connect to localhost port 9515: Connection refused in vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:297
This is because the Symphony process class has already ended the browser process when dusk attempts to. Adding self::$browser = null; causes the Dusk destruct to run first.
I have had the same issue. I found out de issue for my was that the dusk bin did not got the correct permissions. The command below fixed it for me. chmod -R 0755 vendor/laravel/dusk/bin/
This might be a late reaction but if you got the same issue this might fix it