Skip to content

Commit

Permalink
Tests: Fix compatibility with Dusk 7.9
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Jul 30, 2023
1 parent 8d68453 commit 9e8e9a5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# It installs in-browser tests dependencies and prepares Roundcube instance

GMV=1.6.13
CHROMEVERSION=$(google-chrome-stable --version | tr -cd [:digit:]. | cut -d . -f 1)
CHROMEVERSION=$(google-chrome-stable --version | tr -cd [:digit:].)
GMARGS="-Dgreenmail.setup.all -Dgreenmail.users=test:test -Dgreenmail.startup.timeout=3000"

# Make temp and logs writeable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/browser_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Setup composer
run: |
cp composer.json-dist composer.json
composer require "laravel/dusk:^7.7" --no-update
composer require "laravel/dusk:^7.9" --no-update
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress
Expand Down
2 changes: 1 addition & 1 deletion tests/Browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Installation:

1. Install Laravel Dusk with all dependencies.
```
composer require "laravel/dusk:^7.7"
composer require "laravel/dusk:^7.9"
```
2. Install Chrome WebDriver for the version of Chrome/Chromium in your system. Yes,
you have to have Chrome/Chromium installed.
Expand Down
25 changes: 14 additions & 11 deletions tests/Browser/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,23 @@ class Installer extends Laravel\Dusk\Console\ChromeDriverCommand
*
* @return void
*/
public function install($version = null)
public function install($version = '')
{
$version = $version ? preg_replace('/\..*/', '', $version) : $this->latestVersion();
$version = trim($this->getUrl(sprintf($this->versionUrl, $version)));
$currentOS = Laravel\Dusk\OperatingSystem::id();
$os = Laravel\Dusk\OperatingSystem::id();
$version = trim($version);
$archive = $this->directory . 'chromedriver.zip';

foreach ($this->slugs as $os => $slug) {
if ($os === $currentOS) {
$archive = $this->download($version, $slug);
$binary = $this->extract($archive);
$url = $this->resolveChromeDriverDownloadUrl($version, $os);

$this->rename($binary, $os);
}
}
$client = new \GuzzleHttp\Client();

$response = $client->get($url);

$data = file_put_contents($archive, $response->getBody());

$binary = $this->extract($version, $archive);

$this->rename($binary, $os);

echo "ChromeDriver binary successfully installed for version $version.\n";
}
Expand Down

0 comments on commit 9e8e9a5

Please sign in to comment.