Skip to content
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

[5.0] Use custom DISPLAY variable when set on Linux #613

Merged
merged 2 commits into from
Feb 25, 2019

Conversation

mbardelmeijer
Copy link
Contributor

Use case: running Dusk on a server environment and using X11 forwarding via SSH to take a peek in the browser running the actions. This is particularity useful in combination with the https://github.com/nunomaduro/laravel-console-dusk package.

We automate specific browser actions on the server side and it's handy to see why it's failing on the server (for instance, we ran into issues because the user agent of the headless browser was different).

Am not aware of any side effects but happy to hear some thoughts about this.

Use case: running Dusk on a server environment and using X11 forwarding via SSH to take a peek in the browser running the actions. This is particularity useful in combination with the https://github.com/nunomaduro/laravel-console-dusk package.

We automate specific browser actions on the server side and it's handy to see why it's failing on the server (for instance, we ran into issues because the user agent of the headless browser was different).

Am not aware of any side effects but happy to hear some thoughts about this.
@taylorotwell
Copy link
Member

Maybe DUSK_DISPLAY?

@mbardelmeijer
Copy link
Contributor Author

The benefit of reading the DISPLAY variable it this variable is automatically set. For instance, when using Putty with X11 forwarding you get:

michel@web0:~# echo $DISPLAY
localhost:10.0

In the case it's unset (most Linux servers) it will fallback to :0

@taylorotwell
Copy link
Member

Why not read from $_ENV?

@driesvints driesvints changed the title Use custom DISPLAY variable when set on Linux [5.0] Use custom DISPLAY variable when set on Linux Feb 25, 2019
@mbardelmeijer
Copy link
Contributor Author

No specific reason. Reading from $_ENV, $_SERVER or via getenv all gives the same result. Happy to update it to $_ENV if you prefer that.

@taylorotwell taylorotwell merged commit ac1f0f5 into laravel:5.0 Feb 25, 2019
@yohanesgultom
Copy link

yohanesgultom commented Aug 9, 2019

No specific reason. Reading from $_ENV, $_SERVER or via getenv all gives the same result. Happy to update it to $_ENV if you prefer that.

I'm using version 5.5 (this merge included) but I have to add:

$_ENV['DISPLAY'] = getenv('DISPLAY');

in my DuskTestCase to show browser during execution of php artisan dusk. Basically because $_ENV['DISPLAY'] is empty while getenv('DISPLAY') returns :1. Do you aware of any case that such thing may happen? I'm using Ubuntu 18.04 LTS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants