Beispiel #1
0
 /**
  * Close existing Selenium server sessions
  *
  * @return void
  */
 public static function closeSeleniumSession()
 {
     try {
         if (Menta_SessionManager::activeSessionExists()) {
             echo "\n[Closing remote selenium session]\n";
             Menta_SessionManager::closeSession();
         }
     } catch (Exception $e) {
         echo "[closeSeleniumSession] EXCEPTION: " . $e->getMessage();
     }
     exit;
 }
 /**
  * Will send the test result to sauce labs in case we're running tests there
  *
  * @return void
  */
 protected function tearDown()
 {
     if (Menta_SessionManager::activeSessionExists()) {
         $status = $this->getStatus();
         if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR || $status == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
             $passed = false;
         } else {
             $passed = true;
         }
         $sauceUserId = $this->getConfiguration()->getValue('testing.sauce.userId');
         $sauceAccessKey = $this->getConfiguration()->getValue('testing.sauce.accessKey');
         if (!empty($sauceUserId) && !empty($sauceAccessKey)) {
             $rest = new WebDriver\SauceLabs\SauceRest($sauceUserId, $sauceAccessKey);
             $rest->updateJob(Menta_SessionManager::getSessionId(), array(WebDriver\SauceLabs\Capability::PASSED => $passed));
         }
     }
     parent::tearDown();
 }
Beispiel #3
0
 /**
  * @param string $title
  *
  * @return Menta_Util_Screenshot
  */
 public function getScreenShot($title = '')
 {
     // don't init a new session if there is none
     if (!Menta_SessionManager::activeSessionExists()) {
         return false;
     }
     $screenshotHelper = Menta_ComponentManager::get('Menta_Component_Helper_Screenshot');
     /* @var $screenshotHelper Menta_Component_Helper_Screenshot */
     $base64Image = $screenshotHelper->takeScreenshotToString();
     $time = time();
     // put data into the screenshot object
     $screenshot = new Menta_Util_Screenshot();
     $screenshot->setBase64Image($base64Image);
     $screenshot->setTime($time);
     if (!is_null($title)) {
         $screenshot->setTitle($title);
     }
     $screenshot->setLocation($this->getSession()->url());
     return $screenshot;
 }