-
Notifications
You must be signed in to change notification settings - Fork 321
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
The loaded environment differs between the testing scope and the running scope #204
Comments
A possible solution could be to let Dusk run |
Although the approach of #162 is a great suggestion (which I yet intend to follow up on), it is not something that I think should be on core because you cannot make such assumption of the desired behavior for everyone. The core of what you're describing is caused by the Browser and Dusk being on separate processes. So Dusk, although inside of Laravel, is acting as a Web Browser going to your application and it will work like |
Closing this issue because it's already solved, old or not relevant anymore. Feel free to reply if you're still experiencing this issue. |
the greatest thing to do before running the dusk is to make sure you run dev server in the right way, I'll describe (3 days and nights was burned to solve this puzzle):
|
I've create a new project to showcase what's happening.
Installation and running:
The only browser test will fail, so what's happening?
I've created a
.env
file containing aAPP_ENV=local
line. I've also created a.env.dusk.local
file containing theAPP_ENV=testing
line.The
EnvTest
tries to check if the app is running in thetesting
environment and obviously fails.For better comprehension, I've logged the environment in two places:
If you run
cat storage/logs/laravel.log
in your terminal after a failed test, you will see something like that:Here is the issue: the
EnvTest
class runs with thetesting
environment, while the application runs with thelocal
environment. I expect the environments to be the same, maybe it's a misunderstanding?However, despite this issue, thank you for this awesome package!
The text was updated successfully, but these errors were encountered: