简体   繁体   中英

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, eg 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

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

To ensure

php artisan dusk

Works well, you need to check the followings :

  • Have chrome installed on your equipement
  • Have the latest update on chrome
  • If you get stuck at 100% after changing at least one of the previous point, you need to change the configuration file for dusk to purge his cache, so go to /phpunit.dusk.xml and add a few lines

For example, add these into the tags :

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

Then relaunch

php artisan dusk

It should do the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM