Skip to content

Commit

Permalink
Merge pull request #227 from OndraM/feature/revert-readiness-check
Browse files Browse the repository at this point in the history
Revert readiness check, as it would prevent queuing tests
  • Loading branch information
OndraM committed Oct 31, 2018
2 parents 9225eb8 + 766223e commit 2a0033b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
3 changes: 0 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
<!-- There is always Unreleased section on the top. Subsections (Added, Changed, Fixed, Removed) should be added as needed. -->

## Unreleased
### Added
- Detect readiness state of new Selenium servers (v3.5.3+ running in W3C-protocol mode) during startup, so that eg. no available Selenium server nodes are reported before attempting to start any test.

### Changed
- Require PHP 7.1+ and Symfony 4 components.
- Update to namespaced PHPUnit 7.0.
Expand Down
16 changes: 4 additions & 12 deletions src-tests/Selenium/SeleniumServerAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,6 @@ public function testShouldReturnFalseIfTheServerDoesNotRespondToStatusUrl(): voi
$this->assertEquals('error reading server response', $this->adapter->getLastError());
}

public function testShouldDetectNotReadySeleniumServer(): void
{
$notReadyResponse = file_get_contents(__DIR__ . '/Fixtures/response-standalone-w3c-not-ready.json');
$fileGetContentsMock = $this->getFunctionMock(__NAMESPACE__, 'file_get_contents');
$fileGetContentsMock->expects($this->once())
->with($this->serverUrl . '/status')
->willReturn($notReadyResponse);

$this->assertFalse($this->adapter->isSeleniumServer());
$this->assertEquals('server is not ready ("No spare hub capacity")', $this->adapter->getLastError());
}

public function testShouldReturnJsonErrorDescriptionIfTheServerResponseIsNotJson(): void
{
$fileGetContentsMock = $this->getFunctionMock(__NAMESPACE__, 'file_get_contents');
Expand Down Expand Up @@ -181,6 +169,10 @@ public function provideValidStatusResponses(): array
return [
// $responseData, $expectedCloudService
'standalone W3C server (in ready state)' => [__DIR__ . '/Fixtures/response-standalone-w3c-ready.json', ''],
'standalone W3C server (in not ready state - but tests could wait in queue)' => [
__DIR__ . '/Fixtures/response-standalone-w3c-not-ready.json',
'',
],
'standalone server v2' => [__DIR__ . '/Fixtures/response-standalone-v2.json', ''],
'standalone local grid v2' => [__DIR__ . '/Fixtures/response-standalone-hub-v2.json', ''],
'Sauce Labs cloud' =>
Expand Down
9 changes: 0 additions & 9 deletions src/Selenium/SeleniumServerAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,6 @@ public function isSeleniumServer(): bool
return false;
}

// Try to get readiness status from W3C protocol conforming implementations
if (isset($decodedData->value, $decodedData->value->ready, $decodedData->value->message)) {
if (!$decodedData->value->ready) {
$this->lastError = 'server is not ready ("' . $decodedData->value->message . '")';

return false;
}
}

$this->cloudService = $this->detectCloudServiceByStatus($decodedData);

return true;
Expand Down

0 comments on commit 2a0033b

Please sign in to comment.