Skip to content

Commit

Permalink
test: change first two test
Browse files Browse the repository at this point in the history
  • Loading branch information
asciito committed Oct 20, 2023
1 parent f7e4606 commit e170818
Showing 1 changed file with 38 additions and 13 deletions.
51 changes: 38 additions & 13 deletions tests/Feature/InstallBrowserCommandTest.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,54 @@
<?php

use App\Facades\GoogleForTesting;
use App\GoogleDownloadable;
use Illuminate\Support\Facades\File;
use Symfony\Component\Finder\Finder;
use Illuminate\Support\Facades\Http;
use function Pest\Laravel\artisan;

it('download the latest browser version', function () {
Http::fake();

$google = GoogleForTesting::partialMock();
$downloadable = Mockery::mock(GoogleDownloadable::class);

$downloadable->shouldReceive('getVersion')
->andReturn('200.0.0.0');

$downloadable->shouldReceive('getChromeBrowserURL')
->andReturn('https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/200.0.0.0/linux64/chrome-linux64.zip');

$google->shouldReceive('getLatestVersion')
->andReturn($downloadable);

artisan('install:browser --latest')
->expectsOutputToContain('Downloading Google Chrome Browser')
->expectsOutputToContain('downloaded')
->doesntExpectOutputToContain("There' no versions available for [200.0.0.0]")
->expectsOutputToContain('Downloading Google Chrome Browser [200.0.0.0]')
->expectsOutputToContain('Google Chrome Browser [200.0.0.0] downloaded')
->assertSuccessful();
});

$finder = new Finder;
it('it download the browser version [113.0.5672.0]', function () {
Http::fake();

$finder
->directories()
->in(join_paths(env('HOME'), '.google-for-testing'))
->name('chrome*');
$google = GoogleForTesting::partialMock();
$downloadable = Mockery::mock(GoogleDownloadable::class);

expect($finder->hasResults())
->toBeTrue();
});
$downloadable->shouldReceive('getVersion')
->andReturn('113.0.5672.0');

it('it download the browser version []', function () {
$downloadable->shouldReceive('getChromeBrowserURL')
->andReturn('https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/113.0.5672.0/linux64/chrome-linux64.zip');

})->todo();
$google->shouldReceive('getVersion')
->andReturn($downloadable);

artisan('install:browser --ver=113.0.5672.0')
->doesntExpectOutputToContain("There' no versions available for [113.0.5672.0]")
->expectsOutputToContain('Downloading Google Chrome Browser [113.0.5672.0]')
->expectsOutputToContain('Google Chrome Browser [113.0.5672.0] downloaded')
->assertSuccessful();
});

it('download the browser on other path', function () {

Expand Down

0 comments on commit e170818

Please sign in to comment.