/**
  * @param string $path
  * @param null   $wait
  * @param string $submitId
  *
  * @return array
  */
 protected function getAllErrorsOnPage($path, $wait = null, $submitId = 'form_submit')
 {
     $this->visitTest($path);
     $this->session->getPage()->findButton($submitId)->click();
     if ($wait) {
         $this->session->wait(5000, $wait);
     }
     return $this->fetchErrors();
 }
 /**
  * @param string $path
  * @param null   $wait
  * @param string $submitId
  *
  * @return array
  */
 protected function getAllErrorsOnPage($path, $wait = null, $submitId = 'form_submit')
 {
     $this->visitTest($path);
     $button = $this->session->getPage()->findButton($submitId);
     $this->assertNotNull($button, "Button ID '{$submitId}' does not found'");
     $button->click();
     if ($wait) {
         $this->session->wait(5000, $wait);
     }
     return $this->fetchErrors();
 }
Example #3
0
 /**
  *
  * @param \Pachico\Voyeur\Shot $shot
  * @return string
  */
 protected function _shoot_shot(Shot $shot)
 {
     // Starting sesion if not started yet (in short, open browser)
     if (!$this->_session->isStarted()) {
         $this->_log_out('Starting camera session');
         $this->_session->start();
     }
     $this->_log_out('Loading ' . $shot->get_uri());
     $this->_log_out("Resizing window to " . $shot->get_width() . 'x' . $shot->get_height());
     $this->_session->resizeWindow($shot->get_width(), $shot->get_height());
     // Load page
     $this->_session->visit($shot->get_uri());
     $this->_log_out("Loading finished");
     // Should I wait for something?
     if (count($shot->get_wait_for()) > 0) {
         foreach ($shot->get_wait_for() as $waitings) {
             $wait_time = key($waitings);
             $condition = is_null(current($waitings)) ? null : current($waitings);
             $this->_log_out("Waiting " . $wait_time . ' microseconds');
             $condition and $this->_log_out("Or until " . $condition);
             $this->_session->wait($wait_time, $condition);
         }
     }
     // Any scripts to execute?
     if (count($shot->get_scripts()) > 0) {
         foreach ($shot->get_scripts() as $script) {
             $script = $this->_get_script_file_content($script);
             $this->_session->executeScript($script);
         }
     }
     // Finally take the screenshot and return it
     $this->_log_out("Taking screenshot");
     $picture = $this->_session->getScreenshot();
     return $picture;
 }
 public function testWait()
 {
     $this->driver->expects($this->once())->method('wait')->with(1000, 'function () {}');
     $this->session->wait(1000, 'function () {}');
 }
Example #5
0
 /** @noinspection MoreThanThreeArgumentsInspection
  * @param Controller $module
  * @param Session $session
  * @param int $wait
  * @param bool $makeSS
  */
 private function openController(Controller $module, Session $session, $wait = 100, $makeSS = false)
 {
     $page = $session->getPage();
     $nav = $page->findById('nav');
     $container = $nav->findById('mi_' . $module->getId());
     $link = $container->find('css', 'a:first-child');
     $link->click();
     $session->wait($wait);
     if ($makeSS) {
         Mink::getInstance()->ss();
     }
 }