laravel / dusk

Laravel Dusk provides simple end-to-end testing and browser automation.
https://laravel.com/docs/dusk
MIT License
1.87k stars 319 forks source link

A way to have different environment variables #1037

Closed robertmylne closed 1 year ago

robertmylne commented 1 year ago

A way to dynamically change the .env variables in tests. Currently you can only have a single .env file and cannot change a variable at runtime.

I need a way to test 2 different sets of .env files. This is because we have 2 sites (brands) that share a single Laravel codebase with the only differences being the env files.

I have found multiple users with the same issues online. There doesn't seem to be a working solution to the problem though. And dusk doesn't have a way to allow multiple .env.dusk.{environment}. It is purely for the environment, to which there is 1 at a time and unfortunately it is also located the .env file.

driesvints commented 1 year ago

You can always set environment variables from the CLI:

env APP_NAME="Dusk" php artisan dusk
robertmylne commented 11 months ago

Environment variables set via the command line have no effect.

kenth-israel-goteam commented 3 months ago

Sorry late to the party. This package helped me: alebatistella/duskapiconf