Skip to content

Commit

Permalink
fix: add matrix to test on windows also
Browse files Browse the repository at this point in the history
  • Loading branch information
asciito committed Dec 1, 2023
1 parent 162b7ea commit 9edc8c0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions tests/Feature/ManageDriverCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
->assertSuccessful();

Process::assertRan('./chromedriver --log-level=ALL --port=9515 &');
});
})->skipOnWindows();

it('stop a Chrome Driver server', function () {
Process::fake([
Expand All @@ -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([
Expand All @@ -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([
Expand All @@ -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([
Expand All @@ -83,31 +83,31 @@
->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();

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();

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();

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();
Expand All @@ -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'];
Expand All @@ -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([
Expand All @@ -166,4 +166,4 @@
->doesntExpectOutputToContain("There' no servers available to list")
->expectsTable(['PID', 'PORT'], $data->map(fn ($port, $pid) => [$pid, $port])->values())
->assertSuccessful();
});
})->skipOnWindows();

0 comments on commit 9edc8c0

Please sign in to comment.