Skip to content

Commit

Permalink
[8.x] Explicitly set chromedriver port. (#1124)
Browse files Browse the repository at this point in the history
fixes #1123
fixes #1122

Before 128, ChromeDriver will use the default 9515 port, however this is
no longer the case and would cause chromedriver to run on port 0. https://issues.chromium.org/issues/361370192

Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone authored Aug 26, 2024
1 parent 4e76666 commit e641800
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/browser-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
run: php vendor/bin/testbench dusk:chrome-driver --detect

- name: Start Chrome Driver
run: ./bin/chromedriver-linux &
run: ./bin/chromedriver-linux --port=9515 &

- name: Run Laravel Server
run: php vendor/bin/testbench serve --no-reload &
Expand Down
3 changes: 2 additions & 1 deletion src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ protected function setUp(): void
protected function driver()
{
return RemoteWebDriver::create(
'http://localhost:9515', DesiredCapabilities::chrome()
$_ENV['DUSK_DRIVER_URL'] ?? env('DUSK_DRIVER_URL') ?? 'http://localhost:9515',
DesiredCapabilities::chrome()
);
}

Expand Down
2 changes: 1 addition & 1 deletion stubs/DuskTestCase.stub
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract class DuskTestCase extends BaseTestCase
public static function prepare(): void
{
if (! static::runningInSail()) {
static::startChromeDriver();
static::startChromeDriver(['--port=9515']);
}
}

Expand Down

0 comments on commit e641800

Please sign in to comment.