예제 #1
0
 public function __construct(Manager $manager, array $config)
 {
     parent::__construct($manager, $config);
     $this->rules = Manager::readConfig($config, self::CFG_RULES);
     $this->button = Manager::readConfig($config, self::CFG_BUTTON);
     Screen::assertRules($this->rules);
     Position::assertRect($this->button);
 }
예제 #2
0
 /**
  *
  * @param array $assertion
  */
 public function waitFor(array $assertion, $timeout = null, $delay = null)
 {
     Screen::assertRules($assertion);
     $timeout = is_int($timeout) && $timeout > 0 ? $timeout : $this->timeout;
     $delay = is_int($delay) && $delay > 0 ? $delay : $this->delay;
     $offset = intval($delay * 0.15);
     $waited = 0;
     while (!$this->screen->compareRules($assertion)) {
         $this->delay->delayOffset($delay, $offset);
         $waited += $delay;
         if ($waited > $timeout) {
             throw new \RuntimeException('Waiting for assertion timeout.');
         }
     }
 }