Dusk: Change the location of screenshots and console folders

Created on 20 Oct 2017  路  7Comments  路  Source: laravel/dusk

The tests folder is PSR-4 compliant. Those two folders do not really belong here.

They would rather be located in storage/logs/dusk/...

Moving the folders is currently possible with a custom setUp method in the DuskTestCase class:

protected function setUp()
{
    parent::setUp();

    Browser::$storeScreenshotsAt = storage_path('logs/dusk/screenshots');
    Browser::$storeConsoleLogAt = storage_path('logs/dusk/console');
}

However, the DuskCommand complains that the folders in tests/Browser do not exist when trying to clean them.

I think that for the same reasons some folders/files were taken out of the app folder from L4 to L5, we should keep the tests folder free of non-PSR-4 stuff.

enhancement

Most helpful comment

Well, having the routes folder inside the app directory in Laravel has never been an issue either. That said, since app became a PSR4 compliant folder, they decided to keep things clean and organised.

Not saying that those folders MUST be moved. Just saying that there is a way to tell the browser to store them somewhere else, but the artisan command does not honour that choice.

At the very least, I would not mind the command not cleaning up my custom folders if it did not simply crash because the default folders are missing (in which case it should just skip the cleanup step).

All 7 comments

I don't think there's any issue with having stubs, fakes, mocks, logs or screenshots inside test folder.

Well, having the routes folder inside the app directory in Laravel has never been an issue either. That said, since app became a PSR4 compliant folder, they decided to keep things clean and organised.

Not saying that those folders MUST be moved. Just saying that there is a way to tell the browser to store them somewhere else, but the artisan command does not honour that choice.

At the very least, I would not mind the command not cleaning up my custom folders if it did not simply crash because the default folders are missing (in which case it should just skip the cleanup step).

I added an is_dir() check to purgeScreenshots() and purgeConsoleLogs(): #577

Any update on this?

@theomessin you're free to attempt a pr for this.

@driesvints: The recent pull request to allow configurable directories was declined so this should probably be closed.

However, the DuskCommand complains that the folders in tests/Browser do not exist when trying to clean them.

in the root issue post was fixed by staudenmeir 2 years ago. tests/DuskTestCase@setUp() in an app can still customize these paths without needing a config setting.

@derekmd thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joanlopez picture joanlopez  路  5Comments

fwang-laralabs picture fwang-laralabs  路  6Comments

rauldeheer picture rauldeheer  路  4Comments

ahtinurme picture ahtinurme  路  6Comments

muswanto picture muswanto  路  3Comments