Skip to content

Commit

Permalink
More test skipping fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
uuf6429 committed Jun 14, 2023
1 parent 6196f75 commit 83f0029
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ jobs:
- name: Run tests
env:
WEB_FIXTURES_BROWSER: ${{ matrix.browser }}
SELENIUM_VERSION: ${{ matrix.selenium }}
DRIVER_URL: http://172.18.0.2:4444/wd/hub
WEB_FIXTURES_HOST: http://host.docker.internal:8002
WEB_FIXTURES_BROWSER: ${{ matrix.browser }}
DRIVER_MACHINE_BASE_PATH: /fixtures/
run: |
vendor/bin/phpunit -v --coverage-clover=coverage.xml --colors=always --testdox
Expand Down
45 changes: 30 additions & 15 deletions tests/WebdriverClassicConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
namespace Mink\WebdriverClassDriver\Tests;

use Behat\Mink\Driver\DriverInterface;
use Behat\Mink\Exception\DriverException;
use Behat\Mink\Tests\Driver\AbstractConfig;
use Behat\Mink\Tests\Driver\Basic\BasicAuthTest;
use Behat\Mink\Tests\Driver\Basic\HeaderTest;
use Behat\Mink\Tests\Driver\Basic\StatusCodeTest;
use Behat\Mink\Tests\Driver\Js\EventsTest;
use Behat\Mink\Tests\Driver\Js\WindowTest;
use Mink\WebdriverClassDriver\WebdriverClassicDriver;

Expand All @@ -18,6 +21,7 @@ public static function getInstance(): self

/**
* {@inheritdoc}
* @throws DriverException
*/
public function createDriver(): DriverInterface
{
Expand All @@ -40,25 +44,25 @@ public function mapRemoteFilePath($file): string

public function skipMessage($testCase, $test): ?string
{
if (
$testCase === WindowTest::class
&& $test === 'testWindowMaximize'
&& getenv('GITHUB_ACTIONS') === 'true'
) {
return 'Maximizing the window does not work when running the browser in Xvfb.';
}
switch (true) {
case $testCase === WindowTest::class && $test === 'testWindowMaximize' && $this->isXvfb():
return 'Maximizing the window does not work when running the browser in Xvfb.';

if ($testCase === HeaderTest::class) {
return 'Headers are not supported.';
}
case $testCase === BasicAuthTest::class:
return 'Basic auth is not supported.';

if ($testCase === StatusCodeTest::class) {
return 'Checking status code is not supported.';
}
case $testCase === HeaderTest::class:
return 'Headers are not supported.';

// TODO skip event tests for old chrome
case $testCase === StatusCodeTest::class:
return 'Checking status code is not supported.';

return parent::skipMessage($testCase, $test);
case $testCase === EventsTest::class && $test === 'testKeyboardEvents' && $this->isOldChrome():
return 'Old Chrome does not allow triggering events.';

default:
return parent::skipMessage($testCase, $test);
}
}

/**
Expand All @@ -68,4 +72,15 @@ protected function supportsCss(): bool
{
return true;
}

private function isXvfb(): bool
{
return getenv('GITHUB_ACTIONS') === 'true';
}

private function isOldChrome(): bool
{
return getenv('WEB_FIXTURES_BROWSER') === 'chrome'
&& version_compare(getenv('SELENIUM_VERSION'), '3', '<');
}
}

0 comments on commit 83f0029

Please sign in to comment.