Skip to content

Allows Chrome driver's path to be configured #1171

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions config/dusk.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Dusk driver path
|--------------------------------------------------------------------------
|
| This value holds the path where the chrome's driver will be installed
| when the command dusk:chrome-driver is run.
| You typically don't need to change this path, but there may be some
| situation when you need to change it, for instance if you build a phar
| standalone app.
|
*/

'driver_path' => env('DUSK_DRIVER_PATH', __DIR__.'/../bin'),

];
2 changes: 1 addition & 1 deletion src/Chrome/ChromeProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function toProcess(array $arguments = [])
'win' => 'chromedriver-win.exe',
];

$driver = __DIR__.'/../../bin'.DIRECTORY_SEPARATOR.$filenames[$this->operatingSystemId()];
$driver = config('dusk.driver_path').DIRECTORY_SEPARATOR.$filenames[$this->operatingSystemId()];
}

$this->driver = realpath($driver);
Expand Down
4 changes: 3 additions & 1 deletion src/Console/ChromeDriverCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ChromeDriverCommand extends Command
*
* @var string
*/
protected $directory = __DIR__.'/../../bin/';
protected $directory;

/**
* Execute the console command.
Expand All @@ -85,6 +85,8 @@ class ChromeDriverCommand extends Command
*/
public function handle()
{
$this->directory = config('dusk.driver_path').DIRECTORY_SEPARATOR;

$version = $this->version();

$all = $this->option('all');
Expand Down
14 changes: 14 additions & 0 deletions src/DuskServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ public function boot()
Console\ComponentCommand::class,
Console\ChromeDriverCommand::class,
]);

$this->publishes([
__DIR__.'/../config/dusk.php' => config_path('dusk.php'),
], 'config');
}
}

/**
* Register any application services.
*
* @return void
*/
public function register(): void
{
$this->mergeConfigFrom(__DIR__ . '/../config/dusk.php', 'dusk');
}
}
Loading