-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sail + Dusk not picking up Dusk specific .env file (.env.dusk.local) #667
Comments
Does it work if you run Dusk outside Sail? |
I can't run it outside of Sail as Sail is my dev environment. I mean I could if I installed everything locally I suppose but the whole point of using Sail was so that I could run my dev environment in containers so it's the same across machines. I'll try and have a go at setting it up just to see what happens. |
Just to add to the original problem description. The repo I created is a fresh Sail project install with only a test and a controller/view added so the problem shouldn't be anything unique to my project. |
@driesvints I created a non-sail project and I see the same problem occuring there, so I guess this is a Dusk problem. I'll raise the bug there instead. |
Does laravel/dusk#851 help? |
I was actually trying the solutions out in that thread and some stackoverflow answers too. I have not seen any change to the environment at all in my test. It's weird as I can visibly see the .env file is updated by Dusk when I run the tests, however the DB_DATABASE env var never changes. I have tried the following
|
Just to ensure i'm not going mad, is the following an accurate description of how this should work?
|
I think I fixed the problem. Most likely my own doing (sorry!) I think the .env.local file I have is causing the problem. When I delete it, leaving me with just the I guess this file is causing confusion. I thought it was being used to create the initial Anyway it's working now. We can close this as there is no problem. I'm not sure why the |
Ah good that you figured that out! |
Sail Version
1.27.4
Laravel Version
v10.44.0
PHP Version
v8.3.2-1
Operating System
Linux
OS Version
ubuntu22.04.1+deb.sury.org+1
Description
Hi,
Not sure if this is a Sail issue or a Dusk issue, I decided to register the problem here.
In the Laravel Dusk documentation is states that you can create a seperate ENV file for Dusk testing by naming it .env.dusk.{environment}.
When I do this it appears that the ENV values that were set in .env.local are still used by the system and the dusk specific file is ignored.
This may be something to do with the combination of SAIL + Dusk? I couldn't find a clear example of this working anywhere online but he documentation seems to suggest it should work.
Steps To Reproduce
I created a repo with a test that shows the problem. See the instructions in this commit (copied below as well).
Reproduction
Requirements: check out https://github.com/chrismacp/dusk-bug.git
Open the
.env
file in your IDE so you can watch it change as the ENV is updated by Dusk.Run e2e test
tests/Browser/EnvTest
The text was updated successfully, but these errors were encountered: