Mercurial > hg > isophonics-drupal-site
diff core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.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 | 4c8ae668cc8c |
children | c2387f117808 |
line wrap: on
line diff
--- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php Mon Apr 23 09:33:26 2018 +0100 +++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php Mon Apr 23 09:46:53 2018 +0100 @@ -15,6 +15,9 @@ /** * {@inheritdoc} + * + * To use a webdriver based approach, please use DrupalSelenium2Driver::class. + * We will switch the default later. */ protected $minkDefaultDriverClass = PhantomJSDriver::class; @@ -22,14 +25,19 @@ * {@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); + if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) { + $this->minkDefaultDriverArgs = ['chrome', NULL, 'http://localhost:4444/']; + } + elseif ($this->minkDefaultDriverClass === PhantomJSDriver::class) { + // 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); + } } try { @@ -64,6 +72,19 @@ } /** + * {@inheritdoc} + */ + protected function getMinkDriverArgs() { + if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) { + return getenv('MINK_DRIVER_ARGS_WEBDRIVER') ?: getenv('MINK_DRIVER_ARGS_PHANTOMJS') ?: parent::getMinkDriverArgs(); + } + elseif ($this->minkDefaultDriverClass === PhantomJSDriver::class) { + return getenv('MINK_DRIVER_ARGS_PHANTOMJS') ?: parent::getMinkDriverArgs(); + } + return parent::getMinkDriverArgs(); + } + + /** * Asserts that the element with the given CSS selector is visible. * * @param string $css_selector @@ -169,4 +190,12 @@ return $this->getSession()->evaluateScript($script) ?: []; } + /** + * {@inheritdoc} + */ + protected function getHtmlOutputHeaders() { + // The webdriver API does not support fetching headers. + return ''; + } + }