Skip to content

Commit

Permalink
Merge pull request lmc-eu#290 from OndraM/feature/github-releases
Browse files Browse the repository at this point in the history
Download Selenium server releases from GitHub
  • Loading branch information
OndraM committed Nov 29, 2021
2 parents 24fd4cf + 28295b5 commit fccd712
Show file tree
Hide file tree
Showing 14 changed files with 304 additions and 2,104 deletions.
5 changes: 2 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ init:
install:
- IF EXIST c:\tools\php (SET PHP=0)
- IF %PHP%==1 cinst -y OpenSSL.Light
# TODO: remove -version and use the latest PHP (after Steward has PHP 8.0 support)
- IF %PHP%==1 cinst -y php -version 7.4.15 --params "/InstallDir:C:\tools\php" # we could use -version to specify exact version, but we rather use the latest available
- IF %PHP%==1 cinst -y php --params "/InstallDir:C:\tools\php" # we do not use -version to specify exact version, but we rather use the latest available
- cd C:\tools\php
- IF %PHP%==1 copy php.ini-production php.ini /Y
- IF %PHP%==1 echo extension_dir=ext >> php.ini
Expand All @@ -37,6 +36,6 @@ install:

test_script:
- cd %APPVEYOR_BUILD_FOLDER%\src-tests\
- ..\vendor\bin\phpunit --colors=always --exclude-group integration
- php ..\vendor\bin\phpunit --colors=always --exclude-group integration

build: false # disable build step (we only run tests)
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:

strategy:
matrix:
selenium-version: ['3.141.59', '4.0.0-beta-2']
selenium-version: ['3.141.59', '4.1.0']

name: Integration tests (Selenium ${{ matrix.selenium-version }})

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<!-- There is always Unreleased section on the top. Subsections (Added, Changed, Fixed, Removed) should be added as needed. -->

## Unreleased
### Changed
- Download Selenium server releases from GitHub (see [announcement](https://www.selenium.dev/blog/2021/downloads-moving-to-github-releases/)).

### Removed
- `resolveRequiredCapabilities()` method from `CustomCapabilitiesResolverInterface`, as this feature is not fully used in php-webdriver anyway.

Expand Down
3 changes: 1 addition & 2 deletions src-tests/AssertDownloadableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ protected function assertIsDownloadable(string $url): void
{
$context = stream_context_create(['http' => ['method' => 'HEAD', 'ignore_errors' => true]]);
$fd = fopen($url, 'rb', false, $context);
$responseCode = $http_response_header[0];
fclose($fd);

$this->assertStringContainsString('200 OK', $responseCode, 'Error downloading from "' . $url . '"');
$this->assertContains('HTTP/1.1 200 OK', $http_response_header, 'Error downloading from "' . $url . '"');
}
}
18 changes: 9 additions & 9 deletions src-tests/Selenium/DownloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testShouldAssembleUrlToDownload(string $version, string $expecte
$downloader = new Downloader(__DIR__ . '/Fixtures', Version::createFromString($version));

$this->assertSame(
'https://selenium-release.storage.googleapis.com' . $expectedPath,
'https://github.com/SeleniumHQ/selenium/releases/download/' . $expectedPath,
$downloader->getFileUrl()
);
}
Expand All @@ -60,12 +60,12 @@ public function testShouldAssembleUrlToDownload(string $version, string $expecte
public function provideVersions(): array
{
return [
['2.53.0', '/2.53/selenium-server-standalone-2.53.0.jar'],
['2.53.1', '/2.53/selenium-server-standalone-2.53.1.jar'],
['3.0.0-beta2', '/3.0-beta2/selenium-server-standalone-3.0.0-beta2.jar'],
['3.0.0', '/3.0/selenium-server-standalone-3.0.0.jar'],
['4.0.0-beta-1', '/4.0-beta-1/selenium-server-4.0.0-beta-1.jar'],
['4.0.0', '/4.0/selenium-server-4.0.0.jar'],
['2.53.0', 'selenium-2.53.0/selenium-server-standalone-2.53.0.jar'],
['2.53.1', 'selenium-2.53.1/selenium-server-standalone-2.53.1.jar'],
['3.0.0', 'selenium-3.0.0/selenium-server-standalone-3.0.0.jar'],
['3.141.59', 'selenium-3.141.59/selenium-server-standalone-3.141.59.jar'],
['4.0.0-beta-4', 'selenium-4.0.0-beta-4/selenium-server-4.0.0-beta-4.jar'],
['4.0.0', 'selenium-4.0.0/selenium-server-4.0.0.jar'],
];
}

Expand Down Expand Up @@ -94,7 +94,7 @@ public function testShouldStoreDownloadedFileToExpectedLocation(): void
$expectedFile = __DIR__ . '/Fixtures/selenium-server-standalone-1.33.7.jar';
$this->assertFileNotExists($expectedFile, 'File already exists, though it should be created only by the test');

$this->mockGetHeadersToReturnHeader('HTTP/1.0 200 OK');
$this->mockGetHeadersToReturnHeader('HTTP/1.1 200 OK');

$this->assertEquals(9, $downloader->download());
$this->assertFileExists($expectedFile);
Expand Down Expand Up @@ -141,7 +141,7 @@ public function testShouldCreateTargetDirectoryIfNotExists(): void
->method('getFileUrl')
->willReturn(__DIR__ . '/Fixtures/dummy-file.jar');

$this->mockGetHeadersToReturnHeader('HTTP/1.0 200 OK');
$this->mockGetHeadersToReturnHeader('HTTP/1.1 200 OK');

$downloader->download();

Expand Down
244 changes: 244 additions & 0 deletions src-tests/Selenium/Fixtures/releases-latest.json

Large diffs are not rendered by default.

40 changes: 0 additions & 40 deletions src-tests/Selenium/Fixtures/releases-response-invalid-version.xml

This file was deleted.

1 change: 1 addition & 0 deletions src-tests/Selenium/Fixtures/releases-response-missing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading

0 comments on commit fccd712

Please sign in to comment.