createScreenshotsDirectory(); } if (! is_dir(base_path('tests/Browser/console'))) { $this->createConsoleDirectory(); } if (! is_dir(base_path('tests/Browser/source'))) { $this->createSourceDirectory(); } $stubs = [ 'ExampleTest.stub' => base_path('tests/Browser/ExampleTest.php'), 'HomePage.stub' => base_path('tests/Browser/Pages/HomePage.php'), 'DuskTestCase.stub' => base_path('tests/DuskTestCase.php'), 'Page.stub' => base_path('tests/Browser/Pages/Page.php'), ]; foreach ($stubs as $stub => $file) { if (! is_file($file)) { copy(__DIR__.'/../../stubs/'.$stub, $file); } } $this->info('Dusk scaffolding installed successfully.'); $this->comment('Downloading ChromeDriver binaries...'); $driverCommandArgs = ['--all' => true]; if ($this->option('proxy')) { $driverCommandArgs['--proxy'] = $this->option('proxy'); } if ($this->option('ssl-no-verify')) { $driverCommandArgs['--ssl-no-verify'] = true; } $this->call('dusk:chrome-driver', $driverCommandArgs); } /** * Create the screenshots directory. * * @return void */ protected function createScreenshotsDirectory() { mkdir(base_path('tests/Browser/screenshots'), 0755, true); file_put_contents(base_path('tests/Browser/screenshots/.gitignore'), '* !.gitignore '); } /** * Create the console directory. * * @return void */ protected function createConsoleDirectory() { mkdir(base_path('tests/Browser/console'), 0755, true); file_put_contents(base_path('tests/Browser/console/.gitignore'), '* !.gitignore '); } /** * Create the source directory. * * @return void */ protected function createSourceDirectory() { mkdir(base_path('tests/Browser/source'), 0755, true); file_put_contents(base_path('tests/Browser/source/.gitignore'), '* !.gitignore '); } }