0

I am having problems with Laravel Dusk in my application. I created a new Laravel 5.4 project inside of a Vagrant Box and I installed Dusk according to the directions in the official documentation (https://laravel.com/docs/5.4/dusk). When I run phpunit ExampleTest.php I get the following error:

PHP Fatal error:  Class 'Tests\DuskTestCase' not found in /var/www/my_project/tests/Browser/ExampleTest.php on line 9

Fatal error: Class 'Tests\DuskTestCase' not found in /var/www/my_project/tests/Browser/ExampleTest.php on line 9

When I try to run it with php artisan dusk I get:

PHPUnit 5.7.20 by Sebastian Bergmann and contributors.

<br />
<b>Error</b>: <font color="FF0000"><b>Internal script failure</b><br />

I have no idea what is causing this issue. Tests\DuskTestCase is most definitely in my ExampleTest.php file. Also, if it helps, the autoload-dev section of my composer.json file is as follows:

"autoload-dev": {
    "psr-4": {
        "Tests\\": "tests/"
   }

Does anyone have any idea what is going on? I can't seem to find a solution anywhere. Thanks in advance for any help.

  • Do you `require-dev` something like `"laravel/dusk": "1.1.*"` in your `composer.json`? – Sven Jun 15 '17 at 08:40
  • 1
    That wasn't in my `composer.json` but when I added it and ran `composer dump-autoload` it didn't make any difference. – CopaceticCoffee Jun 15 '17 at 14:27
  • And you do have the `DuskTestCase.php` file? (see https://raw.githubusercontent.com/laravel/dusk/1.0/stubs/DuskTestCase.stub) – Sven Jun 15 '17 at 18:13
  • Yes I do. I ended up creating a new Homestead Box and I was able to avoid getting these errors again. However, now I'm getting an error where the request `php artisan dusk` is timing out after 3000 milliseconds. I've done some research and apparently this is a known issue with the only known solution being one that defeats the purpose of using dusk in the first place. (https://stackoverflow.com/questions/43337644/running-laravel-dusk-on-homestead) I may end up just moving away from dusk for a while until they iron out the issues with Homestead compatibility. – CopaceticCoffee Jun 16 '17 at 18:30

0 Answers0