query('xpath:.//div[contains(@class, "is-loading")]')->waitUntilNotPresent($timeout); return $this; } /** * @inheritdoc */ public static function find() { return (new CElementQuery('xpath://div['.CXPathHelper::fromClass('overlay-dialogue modal').']'))->asOverlayDialog(); } /** * Get title text. * * @return string */ public function getTitle() { return $this->query('xpath:./div[@class="dashboard-widget-head"]/h4')->one()->getText(); } /** * Set context (host / hostgroup) of overlay dialog. * * This code should be different from older versions of Zabbix (< 5.0). * * @param array $context * @param integer $mode multiselect fill mode, or null if default */ public function setDataContext($context, $mode = null) { if (!$context) { return $this; } // Assuming that we are looking for a single multiselect... $element = $this->query('xpath:./div[@class="overlay-dialogue-controls"]//./div[@class="multiselect-control"]') ->asMultiselect()->one(); if ($mode !== null) { $element->setFillMode($mode); } $element->fill($context); $this->waitUntilReady(); return $this; } /** * Get content of overlay dialog. * * @return CElement */ public function getContent() { return $this->query('class:overlay-dialogue-body')->waitUntilPresent()->one(); } /** * Get content of overlay dialog footer. * * @return CElement */ public function getFooter() { return $this->query('class:overlay-dialogue-footer')->one(); } /** * Close overlay dialog. */ public function close() { $this->query('class:btn-overlay-close')->one()->click(); $this->ensureNotPresent(); } /** * Wait until overlay dialogue and overlay dialogue background is not visible one page. */ public static function ensureNotPresent() { (new CElementQuery('xpath', '//*['.CXPathHelper::fromClass('overlay-dialogue-body').' or '. CXPathHelper::fromClass('overlay-bg').']'))->waitUntilNotVisible(); } /** * Scroll the dialog to the top position. */ public function scrollToTop() { CElementQuery::getDriver()->executeScript('arguments[0].scrollTo(0, 0)', [$this->getContent()]); } }