Example #1
0
 /**
  * @Given /^kliknu na (tlačítko|odkaz) (.+)$/
  */
 public function clickButton($type, $text)
 {
     $text = trim($text);
     switch ($type) {
         case 'tlačítko':
             $buttons = $this->getSession()->elements($this->getSession()->using('xpath')->value("//input[@type='submit'][@value='{$text}']"));
             if (!$buttons) {
                 $buttons = $this->getSession()->elements($this->getSession()->using('xpath')->value("//button[@type='submit'][./text()[contains(.,'{$text}')]]"));
             }
             break;
         case 'odkaz':
             $buttons = $this->getSession()->elements($this->getSession()->using('partial link text')->value($text));
             break;
     }
     if ($button = reset($buttons)) {
         /** @var Element $button */
         $button->click();
     } else {
         Assert::fail("Button with title '{$text}' was not found");
     }
     if (!($className = $this->seleniumContext->findPageObjectClass())) {
         throw new \RuntimeException("Router didn't match the url " . $this->getSession()->url());
     }
     if (!$this->getCurrentPage() instanceof $className) {
         $this->pushPage(new $className($this->getSession()));
     }
     $this->getSession()->waitForAjax();
 }
Example #2
0
 public function runTest($name, array $args = array())
 {
     try {
         parent::runTest($name, $args);
         $this->seleniumContext->takeDown();
     } catch (\Exception $e) {
         if (Debugger::$browser && ($tracy = Debugger::log($e))) {
             exec(Debugger::$browser . ' ' . escapeshellarg($tracy));
         }
         $this->seleniumContext->takeDown();
         throw $e;
     }
 }
Example #3
0
 /**
  * Set's this browser session instance as default
  */
 public function makeDefault()
 {
     $this->context->changeDefaultSession($this);
 }