Search code examples
phplaravelmamplaravel-dusk

No output/nothing happens when running Laravel Dusk


I'm using Laravel's Dusk for browser testing.

Sporadically, when I run php artisan dusk nothing happens. No errors, no output, nothing.

To demonstrate the "nothingness", here's a short video clip.

Same nothingness occurs when running php artisan dusk -vvv.

I am able to run individual tests by specifying the file name, e.g. php artisan dusk /path/to/site/tests/Browser/PagesTest.php

I've run each of my individual tests this way - thinking maybe one was short-circuiting it - but they all run fine when invoked individually.

Sometimes this will happen, I'll troubleshoot for a while, give up, then come back to it days later and it will just work fine.

Update w/ additional info:

  • It's specific to one project; does not happen on a fresh Laravel install

Specs:

  • Laravel 5.7.9 / Dusk 4.0.2
  • Mac High Sierra 10.13.5
  • MAMP Pro 5.1.1 w/ PHP 7.2.8

Solution

  • Figured it out: I had two different Browser test files with the same class name.

    It happened when I duplicated an existing test to create a new one and forgot to change the class name.

    I was getting no output, but behind the scenes it was a PHP error.

    I've since learned that if I add the following to phpunit.dusk.xml, it will show the error:

    <php>
        <ini name="display_errors" value="On" />
        <ini name="display_startup_errors" value="On" />
    </php>
    

    Now, when a mistake like that exists, I get useful feedback:

    $ php artisan dusk
    
    Fatal error: Cannot declare class Tests\Browser\AccountTest, 
    because the name is already in use in /tests/Browser/GroupTest.php on line 30