diff --git a/src/Console/DuskCommand.php b/src/Console/DuskCommand.php index df99e77d2..628f2b0bc 100644 --- a/src/Console/DuskCommand.php +++ b/src/Console/DuskCommand.php @@ -121,7 +121,7 @@ protected function phpunitArguments($options) */ protected function purgeScreenshots() { - $path = base_path('tests/Browser/screenshots'); + $path = config('dusk.screenshots_path', base_path('tests/Browser/screenshots')); if (! is_dir($path)) { return; @@ -143,7 +143,7 @@ protected function purgeScreenshots() */ protected function purgeConsoleLogs() { - $path = base_path('tests/Browser/console'); + $path = config('dusk.console_log_path', base_path('tests/Browser/console')); if (! is_dir($path)) { return; diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index b0f96b721..17c4281e4 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -37,11 +37,11 @@ public function handle() mkdir(base_path('tests/Browser/Components'), 0755, true); } - if (! is_dir(base_path('tests/Browser/screenshots'))) { + if (! is_dir(config('dusk.screenshots_path', base_path('tests/Browser/screenshots')))) { $this->createScreenshotsDirectory(); } - if (! is_dir(base_path('tests/Browser/console'))) { + if (! is_dir(config('dusk.console_log_path', base_path('tests/Browser/console')))) { $this->createConsoleDirectory(); } @@ -82,9 +82,10 @@ public function handle() */ protected function createScreenshotsDirectory() { - mkdir(base_path('tests/Browser/screenshots'), 0755, true); + $storeScreenshotsAt = config('dusk.screenshots_path', base_path('tests/Browser/screenshots')); + mkdir($storeScreenshotsAt, 0755, true); - file_put_contents(base_path('tests/Browser/screenshots/.gitignore'), '* + file_put_contents($storeScreenshotsAt.DIRECTORY_SEPARATOR.'.gitignore', '* !.gitignore '); } @@ -96,9 +97,10 @@ protected function createScreenshotsDirectory() */ protected function createConsoleDirectory() { - mkdir(base_path('tests/Browser/console'), 0755, true); + $storeConsoleLogAt = config('dusk.console_log_path', base_path('tests/Browser/console')); + mkdir($storeConsoleLogAt, 0755, true); - file_put_contents(base_path('tests/Browser/console/.gitignore'), '* + file_put_contents($storeConsoleLogAt.DIRECTORY_SEPARATOR.'.gitignore', '* !.gitignore '); } diff --git a/src/TestCase.php b/src/TestCase.php index 7600a6796..d08b8de55 100644 --- a/src/TestCase.php +++ b/src/TestCase.php @@ -24,11 +24,11 @@ protected function setUp(): void Browser::$baseUrl = $this->baseUrl(); - Browser::$storeScreenshotsAt = base_path('tests/Browser/screenshots'); + Browser::$storeScreenshotsAt = config('dusk.screenshots_path', base_path('tests/Browser/screenshots')); - Browser::$storeConsoleLogAt = base_path('tests/Browser/console'); + Browser::$storeConsoleLogAt = config('dusk.console_log_path', base_path('tests/Browser/console')); - Browser::$storeSourceAt = base_path('tests/Browser/source'); + Browser::$storeSourceAt = config('dusk.source_path', base_path('tests/Browser/source')); Browser::$userResolver = function () { return $this->user();