From 9edc8c049db2d8976f5983b3a70a56f5f14619c4 Mon Sep 17 00:00:00 2001 From: asciito Date: Fri, 1 Dec 2023 12:45:46 -0600 Subject: [PATCH] fix: add matrix to test on windows also --- .github/workflows/run-tests.yml | 7 ++++++- tests/Feature/ManageDriverCommandTest.php | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a5419b6..c2b4514 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,7 +8,12 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + steps: - name: Checkout Code uses: actions/checkout@v3 diff --git a/tests/Feature/ManageDriverCommandTest.php b/tests/Feature/ManageDriverCommandTest.php index 3e1db3b..610e7d1 100644 --- a/tests/Feature/ManageDriverCommandTest.php +++ b/tests/Feature/ManageDriverCommandTest.php @@ -18,7 +18,7 @@ ->assertSuccessful(); Process::assertRan('./chromedriver --log-level=ALL --port=9515 &'); -}); +})->skipOnWindows(); it('stop a Chrome Driver server', function () { Process::fake([ @@ -35,7 +35,7 @@ Process::assertRan("ps aux | grep '[c]hromedriver --log-level=ALL --port=9515' | awk '{print $2,$13}'"); Process::assertRan('kill -9 10101'); -}); +})->skipOnWindows(); it('restart a Chrome Driver server', function () { Process::fake([ @@ -54,7 +54,7 @@ Process::assertRan('kill -9 10101'); Process::assertRan('./chromedriver --log-level=ALL --port=9515 &'); -}); +})->skipOnWindows(); test('status of Chrome Driver server', function () { Process::fake([ @@ -72,7 +72,7 @@ ->expectsOutputToContain('Google Chrome server status: [OK]') ->doesntExpectOutputToContain("There's no server available on port [9515]") ->assertSuccessful(); -}); +})->skipOnWindows(); it('can\'t start a new Chrome Driver server if there\'s one already started', function () { Process::fake([ @@ -83,7 +83,7 @@ ->expectsOutputToContain("[PID: 10101]: There's a server running already on port [9515]") ->doesntExpectOutput('Stating Google Chrome Driver on port [9515]') ->assertFailed(); -}); +})->skipOnWindows(); it('can\'t stop a Chrome Driver server if there\'s no server already started', function () { Process::fake(); @@ -91,7 +91,7 @@ artisan('manage:driver', ['action' => 'stop']) ->expectsOutputToContain("There's no server to stop") ->assertFailed(); -}); +})->skipOnWindows(); it('can\'t restart a Chrome Driver server if there\'s no server already started', function () { Process::fake(); @@ -99,7 +99,7 @@ artisan('manage:driver', ['action' => 'stop']) ->expectsOutputToContain("There's no server to stop on port [9515]") ->assertFailed(); -}); +})->skipOnWindows(); it('can\'t get the status of Chrome Driver server if there\'s no server already started', function () { Process::fake(); @@ -107,7 +107,7 @@ artisan('manage:driver', ['action' => 'restart']) ->expectsOutputToContain("There's no server to restart on port [9515]") ->assertFailed(); -}); +})->skipOnWindows(); it('start 4 Chrome Driver servers', function () { Process::fake(); @@ -116,7 +116,7 @@ ->assertSuccessful(); Process::assertRanTimes(fn (PendingProcess $process) => Str::match('/^\.\/chromedriver --log-level=ALL --port=\d+ &$/', $process->command), 4); -}); +})->skipOnWindows(); it('stop all the available Chrome Driver servers', function () { $data = ['9991 1111', '9992 1112', '9993 1113', '9994 1114']; @@ -143,7 +143,7 @@ Process::assertRan(fn (PendingProcess $process) => Str::match('/^ps aux .*/', $process->command)); Process::assertRanTimes(fn (PendingProcess $process) => Str::match('/^kill -9 \d+/', $process->command), 4); -}); +})->skipOnWindows(); it('list all the available Chrome Driver servers', function () { $data = collect([ @@ -166,4 +166,4 @@ ->doesntExpectOutputToContain("There' no servers available to list") ->expectsTable(['PID', 'PORT'], $data->map(fn ($port, $pid) => [$pid, $port])->values()) ->assertSuccessful(); -}); +})->skipOnWindows();