waitUntilPresent()->one(); } $query->setContext($selector); } return $query->waitUntilVisible()->asMessage(); } /** * Check if message is good. * * @return boolean */ public function isGood() { return in_array('msg-good', explode(' ', $this->getAttribute('class'))); } /** * Check if message is bad. * * @return boolean */ public function isBad() { return in_array('msg-bad', explode(' ', $this->getAttribute('class'))); } /** * Check if message is warning. * * @return boolean */ public function isWarning() { return in_array('msg-warning', explode(' ', $this->getAttribute('class'))); } /** * Get message title. * * @return string */ public function getTitle() { if ($this->getAttribute('class') === 'msg-global msg-bad'){ return strtok($this->getText(), "\n"); } else { return $this->query('xpath:./span')->one()->getText(); } } /** * Get collection of description lines. * * @return CElementCollection */ public function getLines() { return $this->query('xpath:./div[@class="msg-details"]//li')->all(); } /** * Check if description line exists. * * @param string $text line to be searched for * * @return boolean */ public function hasLine($text) { foreach ($this->getLines()->asText() as $line) { if (strpos($line, $text) !== false) { return true; } } return false; } /** * Close message. * * @return $this */ public function close() { $this->query('xpath:.//button[contains(@class, "btn-overlay-close")]')->one()->click(); return $this->waitUntilNotVisible(); } }