/**
  * 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();
     }
 }
Exemplo n.º 2
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;
 }
Exemplo n.º 4
0
 /**
  * Initialize the sql logger.
  *
  * @param AlcysDb   $db
  * @param TestSuite $testSuite
  */
 public function __construct(AlcysDb $db, TestSuite $testSuite)
 {
     $this->db = $db;
     $this->testSuite = $testSuite;
     $this->suiteSettings = $this->testSuite->getSuiteSettings();
 }