Skip to content

Sail + Dusk not picking up Dusk specific .env file (.env.dusk.local) #667

Closed
@chrismacp

Description

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

  1. Start the sail app:
./vendor/bin/sail up
  1. Open the .env file in your IDE so you can watch it change as the ENV is updated by Dusk.

  2. Run e2e test

./vendor/bin/sail dusk
  1. See that:
  • 1 test fails in tests/Browser/EnvTest
  • The first test in the same test file passes when it shouldn't

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions