diff --git a/composer.lock b/composer.lock index 97c6e64..4b2c092 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "1167766f8eca494239cc8a1baa1ea6bb", - "content-hash": "0cfc95231ad5eb3f8d306e45c9cc92d9", + "hash": "37b5525e923d827a5580e76d51952434", + "content-hash": "0d9bbd1bfabbbc8aea478cba2ac92788", "packages": [ { "name": "asm89/stack-cors", @@ -51,6 +51,125 @@ "time": "2016-08-01 12:05:04" }, { + "name": "behat/mink", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/minkphp/Mink.git", + "reference": "12e09bf56d4892998518eff6e9be897ba23b7dc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/minkphp/Mink/zipball/12e09bf56d4892998518eff6e9be897ba23b7dc1", + "reference": "12e09bf56d4892998518eff6e9be897ba23b7dc1", + "shasum": "" + }, + "require": { + "php": ">=5.3.1", + "symfony/css-selector": "~2.1|~3.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7|~3.0" + }, + "suggest": { + "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", + "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", + "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", + "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Behat\\Mink\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Browser controller/emulator abstraction for PHP", + "homepage": "http://mink.behat.org/", + "keywords": [ + "browser", + "testing", + "web" + ], + "time": "2016-10-17 08:31:38" + }, + { + "name": "behat/mink-selenium2-driver", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/minkphp/MinkSelenium2Driver.git", + "reference": "473a9f3ebe0c134ee1e623ce8a9c852832020288" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/minkphp/MinkSelenium2Driver/zipball/473a9f3ebe0c134ee1e623ce8a9c852832020288", + "reference": "473a9f3ebe0c134ee1e623ce8a9c852832020288", + "shasum": "" + }, + "require": { + "behat/mink": "~1.7@dev", + "instaclick/php-webdriver": "~1.1", + "php": ">=5.3.1" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "mink-driver", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Behat\\Mink\\Driver\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Pete Otaqui", + "email": "pete@otaqui.com", + "homepage": "https://github.com/pete-otaqui" + } + ], + "description": "Selenium2 (WebDriver) driver for Mink framework", + "homepage": "http://mink.behat.org/", + "keywords": [ + "ajax", + "browser", + "javascript", + "selenium", + "testing", + "webdriver" + ], + "time": "2016-03-05 09:10:18" + }, + { "name": "composer/installers", "version": "v1.0.21", "source": { @@ -891,6 +1010,64 @@ "time": "2016-06-24 23:00:38" }, { + "name": "instaclick/php-webdriver", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/instaclick/php-webdriver.git", + "reference": "0c20707dcf30a32728fd6bdeeab996c887fdb2fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/instaclick/php-webdriver/zipball/0c20707dcf30a32728fd6bdeeab996c887fdb2fb", + "reference": "0c20707dcf30a32728fd6bdeeab996c887fdb2fb", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3.2" + }, + "require-dev": { + "satooshi/php-coveralls": "dev-master" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "WebDriver": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Justin Bishop", + "email": "jubishop@gmail.com", + "role": "Developer" + }, + { + "name": "Anthon Pang", + "email": "apang@softwaredevelopment.ca", + "role": "Fork Maintainer" + } + ], + "description": "PHP WebDriver for Selenium 2", + "homepage": "http://instaclick.com/", + "keywords": [ + "browser", + "selenium", + "webdriver", + "webtest" + ], + "time": "2015-06-15 20:19:33" + }, + { "name": "ircmaxell/password-compat", "version": "v1.0.4", "source": { @@ -1100,12 +1277,12 @@ "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "1.0.0" + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/1.0.0", - "reference": "1.0.0", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", "shasum": "" }, "type": "library", @@ -1354,6 +1531,59 @@ "time": "2016-03-17 09:19:04" }, { + "name": "symfony/css-selector", + "version": "v2.8.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "07b7ced3ae0c12918477c095453ea8595000810e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/07b7ced3ae0c12918477c095453ea8595000810e", + "reference": "07b7ced3ae0c12918477c095453ea8595000810e", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2016-03-04 07:54:35" + }, + { "name": "symfony/debug", "version": "v2.7.6", "source": { @@ -2814,41 +3044,38 @@ ], "packages-dev": [ { - "name": "behat/mink", - "version": "dev-master", + "name": "behat/mink-browserkit-driver", + "version": "v1.3.2", "source": { "type": "git", - "url": "https://github.com/minkphp/Mink.git", - "reference": "12e09bf56d4892998518eff6e9be897ba23b7dc1" + "url": "https://github.com/minkphp/MinkBrowserKitDriver.git", + "reference": "10e67fb4a295efcd62ea0bf16025a85ea19534fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/minkphp/Mink/zipball/12e09bf56d4892998518eff6e9be897ba23b7dc1", - "reference": "12e09bf56d4892998518eff6e9be897ba23b7dc1", + "url": "https://api.github.com/repos/minkphp/MinkBrowserKitDriver/zipball/10e67fb4a295efcd62ea0bf16025a85ea19534fb", + "reference": "10e67fb4a295efcd62ea0bf16025a85ea19534fb", "shasum": "" }, "require": { - "php": ">=5.3.1", - "symfony/css-selector": "~2.1|~3.0" + "behat/mink": "^1.7.1@dev", + "php": ">=5.3.6", + "symfony/browser-kit": "~2.3|~3.0", + "symfony/dom-crawler": "~2.3|~3.0" }, "require-dev": { + "silex/silex": "~1.2", "symfony/phpunit-bridge": "~2.7|~3.0" }, - "suggest": { - "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", - "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", - "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", - "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" - }, - "type": "library", + "type": "mink-driver", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { "psr-4": { - "Behat\\Mink\\": "src/" + "Behat\\Mink\\Driver\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2862,43 +3089,43 @@ "homepage": "http://everzet.com" } ], - "description": "Browser controller/emulator abstraction for PHP", + "description": "Symfony2 BrowserKit driver for Mink framework", "homepage": "http://mink.behat.org/", "keywords": [ + "Mink", + "Symfony2", "browser", - "testing", - "web" + "testing" ], - "time": "2016-10-17 08:31:38" + "time": "2016-03-05 08:59:47" }, { - "name": "behat/mink-browserkit-driver", - "version": "v1.3.2", + "name": "behat/mink-goutte-driver", + "version": "v1.2.1", "source": { "type": "git", - "url": "https://github.com/minkphp/MinkBrowserKitDriver.git", - "reference": "10e67fb4a295efcd62ea0bf16025a85ea19534fb" + "url": "https://github.com/minkphp/MinkGoutteDriver.git", + "reference": "8b9ad6d2d95bc70b840d15323365f52fcdaea6ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkBrowserKitDriver/zipball/10e67fb4a295efcd62ea0bf16025a85ea19534fb", - "reference": "10e67fb4a295efcd62ea0bf16025a85ea19534fb", + "url": "https://api.github.com/repos/minkphp/MinkGoutteDriver/zipball/8b9ad6d2d95bc70b840d15323365f52fcdaea6ca", + "reference": "8b9ad6d2d95bc70b840d15323365f52fcdaea6ca", "shasum": "" }, "require": { - "behat/mink": "^1.7.1@dev", - "php": ">=5.3.6", - "symfony/browser-kit": "~2.3|~3.0", - "symfony/dom-crawler": "~2.3|~3.0" + "behat/mink": "~1.6@dev", + "behat/mink-browserkit-driver": "~1.2@dev", + "fabpot/goutte": "~1.0.4|~2.0|~3.1", + "php": ">=5.3.1" }, "require-dev": { - "silex/silex": "~1.2", "symfony/phpunit-bridge": "~2.7|~3.0" }, "type": "mink-driver", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -2917,43 +3144,42 @@ "homepage": "http://everzet.com" } ], - "description": "Symfony2 BrowserKit driver for Mink framework", + "description": "Goutte driver for Mink framework", "homepage": "http://mink.behat.org/", "keywords": [ - "Mink", - "Symfony2", "browser", + "goutte", + "headless", "testing" ], - "time": "2016-03-05 08:59:47" + "time": "2016-03-05 09:04:22" }, { - "name": "behat/mink-goutte-driver", - "version": "v1.2.1", + "name": "behat/mink-selenium2-driver", + "version": "v1.3.1", "source": { "type": "git", - "url": "https://github.com/minkphp/MinkGoutteDriver.git", - "reference": "8b9ad6d2d95bc70b840d15323365f52fcdaea6ca" + "url": "https://github.com/minkphp/MinkSelenium2Driver.git", + "reference": "473a9f3ebe0c134ee1e623ce8a9c852832020288" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkGoutteDriver/zipball/8b9ad6d2d95bc70b840d15323365f52fcdaea6ca", - "reference": "8b9ad6d2d95bc70b840d15323365f52fcdaea6ca", + "url": "https://api.github.com/repos/minkphp/MinkSelenium2Driver/zipball/473a9f3ebe0c134ee1e623ce8a9c852832020288", + "reference": "473a9f3ebe0c134ee1e623ce8a9c852832020288", "shasum": "" }, "require": { - "behat/mink": "~1.6@dev", - "behat/mink-browserkit-driver": "~1.2@dev", - "fabpot/goutte": "~1.0.4|~2.0|~3.1", + "behat/mink": "~1.7@dev", + "instaclick/php-webdriver": "~1.1", "php": ">=5.3.1" }, "require-dev": { - "symfony/phpunit-bridge": "~2.7|~3.0" + "symfony/phpunit-bridge": "~2.7" }, "type": "mink-driver", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -2970,17 +3196,24 @@ "name": "Konstantin Kudryashov", "email": "ever.zet@gmail.com", "homepage": "http://everzet.com" + }, + { + "name": "Pete Otaqui", + "email": "pete@otaqui.com", + "homepage": "https://github.com/pete-otaqui" } ], - "description": "Goutte driver for Mink framework", + "description": "Selenium2 (WebDriver) driver for Mink framework", "homepage": "http://mink.behat.org/", "keywords": [ + "ajax", "browser", - "goutte", - "headless", - "testing" + "javascript", + "selenium", + "testing", + "webdriver" ], - "time": "2016-03-05 09:04:22" + "time": "2016-03-05 09:10:18" }, { "name": "doctrine/instantiator", @@ -3086,122 +3319,62 @@ "time": "2015-11-05 12:58:44" }, { - "name": "jcalderonzumba/gastonjs", - "version": "v1.0.2", + "name": "instaclick/php-webdriver", + "version": "1.4.3", "source": { "type": "git", - "url": "https://github.com/jcalderonzumba/gastonjs.git", - "reference": "21bebb8ca03eb0f93ec2f3fad61192fb079e2622" + "url": "https://github.com/instaclick/php-webdriver.git", + "reference": "0c20707dcf30a32728fd6bdeeab996c887fdb2fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jcalderonzumba/gastonjs/zipball/21bebb8ca03eb0f93ec2f3fad61192fb079e2622", - "reference": "21bebb8ca03eb0f93ec2f3fad61192fb079e2622", + "url": "https://api.github.com/repos/instaclick/php-webdriver/zipball/0c20707dcf30a32728fd6bdeeab996c887fdb2fb", + "reference": "0c20707dcf30a32728fd6bdeeab996c887fdb2fb", "shasum": "" }, "require": { - "guzzlehttp/guzzle": "~5.0|~6.0", - "php": ">=5.4" + "ext-curl": "*", + "php": ">=5.3.2" }, "require-dev": { - "phpunit/phpunit": "~4.6", - "silex/silex": "~1.2", - "symfony/phpunit-bridge": "~2.7", - "symfony/process": "~2.1" + "satooshi/php-coveralls": "dev-master" }, - "type": "phantomjs-api", + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { - "psr-4": { - "Zumba\\GastonJS\\": "src" + "psr-0": { + "WebDriver": "lib/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "Apache-2.0" ], "authors": [ { - "name": "Juan Francisco Calderón Zumba", - "email": "juanfcz@gmail.com", - "homepage": "http://github.com/jcalderonzumba" - } - ], - "description": "PhantomJS API based server for webpage automation", - "homepage": "https://github.com/jcalderonzumba/gastonjs", - "keywords": [ - "api", - "automation", - "browser", - "headless", - "phantomjs" - ], - "time": "2016-01-18 09:21:03" - }, - { - "name": "jcalderonzumba/mink-phantomjs-driver", - "version": "v0.3.1", - "source": { - "type": "git", - "url": "https://github.com/jcalderonzumba/MinkPhantomJSDriver.git", - "reference": "782892dbea4af7d04024374672b3790b6c008def" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/jcalderonzumba/MinkPhantomJSDriver/zipball/782892dbea4af7d04024374672b3790b6c008def", - "reference": "782892dbea4af7d04024374672b3790b6c008def", - "shasum": "" - }, - "require": { - "behat/mink": "~1.6", - "jcalderonzumba/gastonjs": "~1.0", - "php": ">=5.4", - "twig/twig": "~1.20|~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.6", - "silex/silex": "~1.2", - "symfony/css-selector": "~2.1", - "symfony/phpunit-bridge": "~2.7", - "symfony/process": "~2.3" - }, - "type": "mink-driver", - "extra": { - "branch-alias": { - "dev-master": "0.4.x-dev" - } - }, - "autoload": { - "psr-4": { - "Zumba\\Mink\\Driver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "name": "Justin Bishop", + "email": "jubishop@gmail.com", + "role": "Developer" + }, { - "name": "Juan Francisco Calderón Zumba", - "email": "juanfcz@gmail.com", - "homepage": "http://github.com/jcalderonzumba" + "name": "Anthon Pang", + "email": "apang@softwaredevelopment.ca", + "role": "Fork Maintainer" } ], - "description": "PhantomJS driver for Mink framework", - "homepage": "http://mink.behat.org/", + "description": "PHP WebDriver for Selenium 2", + "homepage": "http://instaclick.com/", "keywords": [ - "ajax", "browser", - "headless", - "javascript", - "phantomjs", - "testing" + "selenium", + "webdriver", + "webtest" ], - "time": "2015-12-04 13:55:02" + "time": "2015-06-15 20:19:33" }, { "name": "mikey179/vfsStream", @@ -4150,59 +4323,6 @@ "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", "time": "2015-10-23 14:47:27" - }, - { - "name": "symfony/css-selector", - "version": "v2.8.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "07b7ced3ae0c12918477c095453ea8595000810e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/07b7ced3ae0c12918477c095453ea8595000810e", - "reference": "07b7ced3ae0c12918477c095453ea8595000810e", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "https://symfony.com", - "time": "2016-03-04 07:54:35" } ], "aliases": [], diff --git a/core/composer.json b/core/composer.json index 71f07d0..b58b214 100644 --- a/core/composer.json +++ b/core/composer.json @@ -38,6 +38,7 @@ "require-dev": { "behat/mink": "1.7.x-dev", "behat/mink-goutte-driver": "~1.2", + "behat/mink-selenium2-driver": "^1.3", "jcalderonzumba/gastonjs": "~1.0.2", "jcalderonzumba/mink-phantomjs-driver": "~0.3.1", "mikey179/vfsStream": "~1.2", diff --git a/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php b/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php new file mode 100644 index 0000000..8e247eb --- /dev/null +++ b/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php @@ -0,0 +1,36 @@ +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) {} + + } +} diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php index 94a9108..2f8ef60 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php @@ -238,4 +238,26 @@ function t(r, lx, ly) { return $this->session->evaluateScript($full_javascript_visibility_test); } + /** + * Overrides statusCodeEquals function. Use Functional tests for status code validation + * + * @param int $code + * + */ + public function statusCodeEquals($code) + { + // should we throw an error? + } + + /** + * Overrides statusCodeEquals function. Use Functional tests for status code validation + * + * @param int $code + * + */ + public function statusCodeNotEquals($code) + { + // should we throw an error? + } + } diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php index d5156ee..2de9c67 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php @@ -2,9 +2,9 @@ namespace Drupal\FunctionalJavascriptTests; +use Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver; +use Behat\Mink\Exception\DriverException; use Drupal\Tests\BrowserTestBase; -use Zumba\GastonJS\Exception\DeadClient; -use Zumba\Mink\Driver\PhantomJSDriver; /** * Runs a browser test using PhantomJS. @@ -16,27 +16,19 @@ /** * {@inheritdoc} */ - protected $minkDefaultDriverClass = PhantomJSDriver::class; + protected $minkDefaultDriverClass = DrupalSelenium2Driver::class; /** * {@inheritdoc} */ protected function initMink() { - // Set up the template cache used by the PhantomJS mink driver. - $path = $this->tempFilesDirectory . DIRECTORY_SEPARATOR . 'browsertestbase-templatecache'; - $this->minkDefaultDriverArgs = [ - 'http://127.0.0.1:8510', - $path, - ]; - if (!file_exists($path)) { - mkdir($path); - } + $this->minkDefaultDriverArgs = ['phantomjs']; try { return parent::initMink(); } - catch (DeadClient $e) { - $this->markTestSkipped('PhantomJS is either not installed or not running. Start it via phantomjs --ssl-protocol=any --ignore-ssl-errors=true vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768&'); + catch (DriverException $e) { + $this->markTestSkipped($e->getMessage()); } catch (\Exception $e) { $this->markTestSkipped('An unexpected error occurred while starting Mink: ' . $e->getMessage()); @@ -169,4 +161,12 @@ protected function getDrupalSettings() { return $this->getSession()->evaluateScript($script) ?: []; } + /** + * {@inheritdoc} + */ + protected function getHtmlOutputHeaders() { + // No headers on the selenium driver, nothing to show. + return ''; + } + } diff --git a/core/tests/README.md b/core/tests/README.md index 566fa23..3c38201 100644 --- a/core/tests/README.md +++ b/core/tests/README.md @@ -2,16 +2,11 @@ ## Functional tests -* Start PhantomJS: - ``` - phantomjs --ssl-protocol=any --ignore-ssl-errors=true ./vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 >> /dev/null & - ``` * Run the functional tests: ``` export SIMPLETEST_DB='mysql://root@localhost/dev_d8' export SIMPLETEST_BASE_URL='http://d8.dev' ./vendor/bin/phpunit -c core --testsuite functional - ./vendor/bin/phpunit -c core --testsuite functional-javascript ``` Note: functional tests have to be invoked with a user in the same group as the @@ -46,3 +41,29 @@ export SIMPLETEST_BASE_URL='http://d8.dev' sudo -u www-data -E ./vendor/bin/phpunit -c core --testsuite functional sudo -u www-data -E ./vendor/bin/phpunit -c core --testsuite functional-javascript ``` + +## Functional javascript tests + +* Start PhantomJS: + ``` + phantomjs --webdriver=4444 + ``` + +* Run the functional javascript tests: + +``` + ./vendor/bin/phpunit -c core --testsuite functional-javascript +``` + +* Alternative to use phantomjs you can also use a real browser like + firefox/chrome too actually see what the test is doing. + +* Install and start selenium, see http://mink.behat.org/en/latest/drivers/selenium2.html +* Set an additional environment parameter to tell the test to use firefox: +``` +export MINK_DRIVER_ARGS='["firefox", null, "http://localhost:4444/wd/hub"]' +``` +* Run the tests as before, now a firefox window should appear. +``` + ./vendor/bin/phpunit -c core --testsuite functional-javascript +```