Skip to content

Commit

Permalink
Add code to delete the Google testing directory
Browse files Browse the repository at this point in the history
  • Loading branch information
asciito committed Dec 1, 2023
1 parent 7a74205 commit 87b6eba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/Commands/DriverManagerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Console\Command;
use Illuminate\Contracts\Process\ProcessResult;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Process;
use Illuminate\Support\Str;
Expand Down Expand Up @@ -307,10 +308,13 @@ protected function getBinary(): string

protected function getChromeDriverDirectory(): string
{
$directory = join_paths(getenv('HOME'), '.google-for-testing');

File::ensureDirectoryExists($directory);

return $this->option('path')
?? join_paths(
getenv('HOME'),
'.google-for-testing',
$directory,
'chromedriver-'.$this->platforms[OperatingSystem::id()],
);
}
Expand Down
3 changes: 3 additions & 0 deletions tests/Feature/ManageDriverCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Process;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\File;
use Laravel\Prompts\Prompt;

use function Pest\Laravel\artisan;

afterAll(fn () => File::deleteDirectory(join_paths(getenv('HOME'), '.google-for-testing')));

it('start a Chrome Driver server', function () {
Process::fake();

Expand Down

0 comments on commit 87b6eba

Please sign in to comment.