chilio / laravel-dusk-ci

Docker Test suite for Laravel Dusk in gitlab CI
MIT License
159 stars 51 forks source link

Failed to open storage/logs/laravel.log: Permission denied #68

Closed tkoop closed 2 years ago

tkoop commented 2 years ago

I'm using your excellent Docker image in GitLab CI. Thank you!! But I seem to have one problem.

In my Dusk tests, (which are all failing), my screenshots return a Laravel error page that says this:

The stream or file ".../storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied.

But the "storage" and "logs" directories exist with 777 permissions and are owned by www-data.www-data. What more do I need?

I'm using chilio/laravel-dusk-ci:php-8.0

Thank you!

tkoop commented 2 years ago

I think this is because I was also running regular Laravel Feature tests, like this:

php artisan test --env=testing

If I split these (feature tests) into a different GitLab job than the dusk tests, both seem to work.

chilio commented 2 years ago

@tkoop it is difficult to say with the info you provided. One hint I have is you should not change your env across builds, especially when using cache. Let me know if this helps, or if you have this problem resolved.

germanlozickyj commented 1 year ago

@tkoop the solution is executing their tests with this command: su www-data -s /bin/bash -c "php artisan dusk --colors --debug" . and give permission 777 the folders storage/ and bootstrap/cache