comparison vendor/behat/mink-selenium2-driver/tests/Selenium2Config.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents
children 129ea1e6d783
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
1 <?php
2
3 namespace Behat\Mink\Tests\Driver;
4
5 use Behat\Mink\Driver\Selenium2Driver;
6
7 class Selenium2Config extends AbstractConfig
8 {
9 public static function getInstance()
10 {
11 return new self();
12 }
13
14 /**
15 * {@inheritdoc}
16 */
17 public function createDriver()
18 {
19 $browser = getenv('WEB_FIXTURES_BROWSER') ?: 'firefox';
20 $seleniumHost = $_SERVER['DRIVER_URL'];
21
22 return new Selenium2Driver($browser, null, $seleniumHost);
23 }
24
25 /**
26 * {@inheritdoc}
27 */
28 public function skipMessage($testCase, $test)
29 {
30 if ('phantomjs' === getenv('WEBDRIVER') && null !== $message = $this->skipPhantomJs($testCase, $test)) {
31 return $message;
32 }
33
34 if (
35 'phantomjs' !== getenv('WEBDRIVER')
36 && 'Behat\Mink\Tests\Driver\Form\Html5Test' === $testCase
37 && 'testHtml5Types' === $test
38 ) {
39 return 'WebDriver does not support setting value in color inputs. See https://code.google.com/p/selenium/issues/detail?id=7650';
40 }
41
42 if (
43 'Behat\Mink\Tests\Driver\Js\WindowTest' === $testCase
44 && (0 === strpos($test, 'testWindowMaximize'))
45 && 'true' === getenv('TRAVIS')
46 ) {
47 return 'Maximizing the window does not work when running the browser in Xvfb.';
48 }
49
50 return parent::skipMessage($testCase, $test);
51 }
52
53 /**
54 * {@inheritdoc}
55 */
56 protected function supportsCss()
57 {
58 return true;
59 }
60
61 private function skipPhantomJs($testCase, $test)
62 {
63 if (
64 'Behat\Mink\Tests\Driver\Js\WindowTest' === $testCase
65 && in_array($test, array('testResizeWindow', 'testWindowMaximize'))
66 ) {
67 return 'PhantomJS is headless so resizing the window does not make sense.';
68 }
69
70
71 if (
72 'Behat\Mink\Tests\Driver\Basic\CookieTest' === $testCase
73 && 'testHttpOnlyCookieIsDeleted' === $test
74 ) {
75 return 'This test does not work for PhantomJS. See https://github.com/detro/ghostdriver/issues/170';
76 }
77
78 return null;
79 }
80 }