protected function WebDriverTestBase::initMink in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::initMink()
Initializes Mink sessions.
Overrides BrowserTestBase::initMink
1 call to WebDriverTestBase::initMink()
- SelectProfileFormTest::initMink in core/
tests/ Drupal/ FunctionalJavascriptTests/ Core/ Installer/ Form/ SelectProfileFormTest.php - Initializes Mink sessions.
1 method overrides WebDriverTestBase::initMink()
- SelectProfileFormTest::initMink in core/
tests/ Drupal/ FunctionalJavascriptTests/ Core/ Installer/ Form/ SelectProfileFormTest.php - Initializes Mink sessions.
File
- core/
tests/ Drupal/ FunctionalJavascriptTests/ WebDriverTestBase.php, line 40
Class
- WebDriverTestBase
- Runs a browser test using a driver that supports Javascript.
Namespace
Drupal\FunctionalJavascriptTestsCode
protected function initMink() {
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 {
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) {
if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) {
$this
->markTestSkipped("The test wasn't able to connect to your webdriver instance. For more information read core/tests/README.md.\n\nThe original message while starting Mink: {$e->getMessage()}");
}
else {
throw $e;
}
} catch (\Exception $e) {
$this
->markTestSkipped('An unexpected error occurred while starting Mink: ' . $e
->getMessage());
}
}