public function setUp() { self::$verificationErrors = array(); self::$log = \Log::singleton('file', $GLOBALS['settings']['logname'], $this->getName()); self::$selenium = \SaunterPHP_Framework_SeleniumConnection::RemoteControl(); self::$selenium->start(); self::$selenium->windowMaximize(); $this->sessionId = self::$selenium->getEval("selenium.sessionId"); }
public function setUp() { self::$verificationErrors = array(); $this->screenshot_number = 1; // screenshot overhead; coupled with php overhead... $_inter_one = get_class($this); $_inter_two = explode('\\', $_inter_one); $this->current_class_name = end($_inter_two); $this->prep_screenshot_dirs(); $this->log = \Log::factory('file', $this->current_test_log_dir . DIRECTORY_SEPARATOR . 'test.log'); if ($GLOBALS['settings']['sauce.ondemand']) { $server_host = $GLOBALS['saucelabs']['username'] . ":" . $GLOBALS['saucelabs']['key'] . "@ondemand.saucelabs.com"; $profile_path = null; if (array_key_exists('profile-' . strtolower(PHP_OS), $GLOBALS['settings'])) { $profile_path = $GLOBALS['settings']['saunter.base'] . DIRECTORY_SEPARATOR . 'support/profiles/' . $GLOBALS['saucelabs']['profile-' . strtolower(PHP_OS)]; } elseif (array_key_exists('profile', $GLOBALS['settings'])) { $profile_path = $GLOBALS['settings']['saunter.base'] . DIRECTORY_SEPARATOR . 'support/profiles/' . $GLOBALS['settings']['profile']; } if ($profile_path) { if (is_dir($profile_path)) { $hosted_path = $GLOBALS['settings']['fileserver'] . '/profiles/' . basename($profile_path) . '.zip'; $zip = new \ZipArchive(); if ($zip->open($profile_path . '.zip', \ZipArchive::OVERWRITE) !== true) { throw new \SaunterPHP_Framework_Exception("Unable to create profile zip {$profile_path}"); } $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($profile_path, $flags = \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS)); foreach ($iterator as $key => $value) { $zip->addFile($key, substr($key, strlen($profile_path) + 1)) or die("ERROR: Could not add file: {$key}"); } $zip->close(); $decoded = json_decode($GLOBALS['settings']['browser'], $assoc = true); $decoded['firefox-profile-url'] = $hosted_path; $GLOBALS['settings']['browser'] = json_encode($decoded); } else { throw new \SaunterPHP_Framework_Exception("Profile directory not found at {$profile_path}"); } } } else { $server_host = $GLOBALS['settings']['seleniumserver']; } $server_port = $GLOBALS['settings']['seleniumport']; $this->driver = new \SaunterPHP_Framework_Bindings_SaunterRemoteControl($GLOBALS['settings']['browser'], $GLOBALS['settings']['webserver'], $server_host, $server_port); self::$selenium = $this->driver; $this->driver->start(); $this->driver->windowMaximize(); $this->sessionId = $this->driver->getEval("selenium.sessionId"); }