public function run(array $context = []) { if (isset($context[self::CFG_DELAY_BASE]) && isset($context[self::CFG_DELAY_OFFSET]) && is_int($context[self::CFG_DELAY_BASE]) && is_int($context[self::CFG_DELAY_OFFSET])) { $this->delay->delayOffset($context[self::CFG_DELAY_BASE], $context[self::CFG_DELAY_OFFSET]); } else { $this->logger->warning('%s: No valid delay param found! Use default value instead.', [__CLASS__]); $this->delay->delayOffset(1000, 500); } }
public function __construct(Manager $manager, array $config) { parent::__construct($manager, $config); $this->setRetryLimit(Manager::readConfig($config, Manager::RES_CONFIG_RETRY, self::DEFAULT_RETRY_LIMIT)); $this->setRetryDelay(Manager::readConfig($config, Manager::RES_CONFIG_RETRY, self::DEFAULT_RETRY_DELAY)); $this->retryOffset = intval($this->retryDelay / 10); $this->position = Position::instance($manager, $this->app); $this->delay = Delay::instance($manager, $this->app); $this->adb = ADB::instance($manager, $this->app); $this->scr = Screen::instance($manager, $this->app); }
/** * * @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.'); } } }
public function __construct(Manager $manager, array $config) { parent::__construct($manager, $config); $this->delay = Delay::instance($manager, $this->app); $this->input = Input::instance($manager, $this->app); }