diff --git a/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php b/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php index 8e247eb..13d1f4e 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php @@ -5,32 +5,28 @@ use Behat\Mink\Driver\Selenium2Driver; /** - * Phantomjs requried domain in setCookie. + * Provides a driver for Selenium testing. */ -class DrupalSelenium2Driver extends Selenium2Driver -{ +class DrupalSelenium2Driver extends Selenium2Driver { + /** * {@inheritdoc} */ - public function setCookie($name, $value = null) - { - if (null === $value) { + public function setCookie($name, $value = null) { + if ($value === null) { $this->getWebDriverSession()->deleteCookie($name); - return; } - $cookieArray = array( - 'name' => $name, - 'value' => urlencode($value), - 'secure' => false, // thanks, chibimagic! - 'domain' => parse_url($this->getWebDriverSession()->url(), PHP_URL_HOST), // drupal-fixes: phantomjs hack - 'expiry' => time() + 80000, - ); - - try { - $this->getWebDriverSession()->setCookie($cookieArray); - } catch (\Exception $e) {} + $cookieArray = [ + 'name' => $name, + 'value' => urlencode($value), + 'secure' => FALSE, + 'domain' => parse_url($this->getWebDriverSession()->url(), PHP_URL_HOST), + 'expires' => time() + 80000, + ]; + $this->getWebDriverSession()->setCookie($cookieArray); } + } diff --git a/core/tests/README.md b/core/tests/README.md index 3c38201..8d61538 100644 --- a/core/tests/README.md +++ b/core/tests/README.md @@ -59,6 +59,9 @@ sudo -u www-data -E ./vendor/bin/phpunit -c core --testsuite functional-javascri firefox/chrome too actually see what the test is doing. * Install and start selenium, see http://mink.behat.org/en/latest/drivers/selenium2.html + +Note: Use the 2.x range for selenium standalone server as 3.x is not yet supported by Mink. + * Set an additional environment parameter to tell the test to use firefox: ``` export MINK_DRIVER_ARGS='["firefox", null, "http://localhost:4444/wd/hub"]' @@ -67,3 +70,6 @@ export MINK_DRIVER_ARGS='["firefox", null, "http://localhost:4444/wd/hub"]' ``` ./vendor/bin/phpunit -c core --testsuite functional-javascript ``` + +Note: Selenium standalone server does not support the latest versions of the browsers. See +http://www.seleniumhq.org/about/platforms.jsp for the supported browsers.