/** * Loads a specific driver for the specified browser * * @param array $browser Defines what kind of driver, for a what browser will be loaded * * @return \Mage_Selenium_Driver|\PHPUnit_Extensions_SeleniumTestCase_Driver */ protected function getDriver(array $browser) { if (!isset($browser['name'])) { $browser['name'] = ''; } if (!isset($browser['browser'])) { $browser['browser'] = ''; } if (!isset($browser['host'])) { $browser['host'] = 'localhost'; } if (!isset($browser['port'])) { $browser['port'] = 4444; } if (!isset($browser['timeout'])) { $browser['timeout'] = 30; } if (!isset($browser['httpTimeout'])) { $browser['httpTimeout'] = 45; } $driver = new Mage_Selenium_Driver(); $driver->setName($browser['name']); $driver->setBrowser($browser['browser']); $driver->setHost($browser['host']); $driver->setPort($browser['port']); $driver->setTimeout($browser['timeout']); $driver->setHttpTimeout($browser['httpTimeout']); $driver->setTestCase($this); $driver->setTestId($this->testId); $driver->setLogHandle($this->_testConfig->getLogFile()); $driver->setBrowserUrl($this->_configHelper->getBaseUrl()); $this->_browserTimeoutPeriod = $browser['timeout'] * 1000; $this->drivers[0] = $driver; return $driver; }
/** * Initializes new driver connection with specific configuration * * @param array $connectionConfig Array of configuration data to start driver's connection * * @return Mage_Selenium_TestConfiguration */ protected function _addDriverConnection(array $connectionConfig) { $driver = new Mage_Selenium_Driver(); $driver->setBrowser($connectionConfig['browser']); $driver->setHost($connectionConfig['host']); $driver->setPort($connectionConfig['port']); $driver->setContiguousSession(true); $this->_drivers[] = $driver; $this->driver = $this->_drivers[0]; return $this; }
/** * Stops browser connection if the session is not marked as contiguous * @return mixed */ public function stop() { if (!$this->_contiguousSession) { return; } self::$_currentSessionId = null; self::$_currentBrowser = null; self::$_currentContiguousSession = null; self::$_currentTestClassName = null; parent::stop(); }
/** * Initializes new driver connection with specific configuration * * @param array $browser * * @return Mage_Selenium_Driver * @throws InvalidArgumentException */ public function addDriverConnection(array $browser) { if (!isset($browser['name'])) { $browser['name'] = ''; } if (!isset($browser['browser'])) { $browser['browser'] = ''; } if (!isset($browser['host'])) { $browser['host'] = 'localhost'; } if (!isset($browser['port'])) { $browser['port'] = 4444; } if (!isset($browser['timeout'])) { $browser['timeout'] = 30; } if (!isset($browser['httpTimeout'])) { $browser['httpTimeout'] = 45; } if (!isset($browser['restartBrowser'])) { $browser['restartBrowser'] = true; } $driver = new Mage_Selenium_Driver(); $driver->setLogHandle($this->getHelper('config')->getLogDir()); $driver->setName($browser['name']); $driver->setBrowser($browser['browser']); $driver->setHost($browser['host']); $driver->setPort($browser['port']); $driver->setTimeout($browser['timeout']); $driver->setHttpTimeout($browser['httpTimeout']); $driver->setContiguousSession($browser['restartBrowser']); $driver->setBrowserUrl($this->_configHelper->getBaseUrl()); return $driver; }