Пример #1
0
 /**
  * Returns an array with values for the suite log entry.
  *
  * @param false|bool $update (Optional) Values for insert or update statement?
  * @param bool       $error  (Optional) Sets instead of the pending value(0) the error status (2)
  *
  * @return array
  */
 protected function _getSuiteValuesArray($update = false, $error = false)
 {
     if ($update) {
         return [$this->testSuite->isFailed() ? 2 : 1, date('Y-m-d H:i:s'), $this->suiteTimer->time()];
     }
     return [$this->suiteSettings->getBuildNumber(), $this->suiteSettings->getSuiteName(), $this->suiteSettings->getVersion(), $this->suiteSettings->getBranch(), $error ? 3 : 0, date('Y-m-d H:i:s'), date('Y-m-d H:i:s'), 0.0];
 }
 /**
  * Returns a web driver element by the given searching type.
  *
  * @param string                 $by      Searching type.
  * @param string                 $value   Expected value of searching type.
  * @param WebDriverSearchContext $context Instance to find elements.
  *
  * @deprecated Will be remove in future version! Algorithms are unstable and may procedure errors.
  * @return WebDriverElement Expected web driver element.
  */
 private function _by($by, $value, WebDriverSearchContext $context)
 {
     if ($this->failed) {
         return new WebDriverElementNull();
     }
     try {
         return $context->findElement(WebDriverBy::$by($value));
     } catch (NoSuchElementException $e) {
         $this->testSuite->getSuiteSettings()->getCurrentTestCase()->_exceptionError('element by "' . $by . '" with value "' . $value . '" not found', $e);
         return new WebDriverElementNull();
     }
 }
Пример #3
0
 /**
  * Method to output messages in the running console.
  *
  * @param string $message                  Message to display.
  * @param string $foreground               (Optional) Text color.
  * @param string $background               (Optional) Background color.
  * @param bool   $camelCaseToHumanReadable Converts camel case message to human readable messages.
  *
  * @return $this Same instance for chained method calls.
  */
 public function output($message, $foreground = null, $background = null, $camelCaseToHumanReadable = false)
 {
     if ($this->testSuite->getSuiteSettings()->isLogDisplayed()) {
         if ($camelCaseToHumanReadable) {
             $message = $this->camelToSentence($message);
         }
         echo $this->dye($message, $foreground, $background) . "\n";
     }
     if ($this->testSuite->getSuiteSettings()->isLogStored()) {
         $this->testSuite->getFileLogger()->log($message, 'log');
     }
     return $this;
 }
 /**
  * Returns an instance of a sql logger.
  *
  * @return SqlLogger
  */
 public function createSqlLogger()
 {
     if (null === $this->sqlLogger) {
         try {
             $db = new AlcysDb('mysql:host=' . $this->testSuite->getSuiteSettings()->getDbHost() . ';dbname=' . $this->testSuite->getSuiteSettings()->getDbName(), $this->testSuite->getSuiteSettings()->getDbUser(), $this->testSuite->getSuiteSettings()->getDbPassword());
             $this->sqlLogger = new SqlLogger($db, $this->testSuite);
         } catch (\PDOException $e) {
             $this->testSuite->output("\n" . 'Invalid db credentials .. database logging deactivated');
             $this->sqlLogger = new SqlNull();
         }
     }
     return $this->sqlLogger;
 }