require_once dirname(__FILE__).'/../include/CWebTest.php';
class testTriggerExpressions extends CWebTest {
const TRIGGER_ID = 17094;
public function testTriggerExpressions_SimpleTest() {
$this->page->login()->open('triggers.php?form=update&triggerid='.self::TRIGGER_ID);
$this->query('button:Expression constructor')->waitUntilPresent()->one()->click();
$this->query('button:Test')->waitUntilPresent()->one()->click();
$dialog = COverlayDialogElement::find()->one()->waitUntilReady();
$table_headers = ['Expression Variable Elements', 'Result type', 'Value',
'Expression', 'Result', 'Error'];
foreach ($table_headers as $header) {
$this->assertTrue($dialog->query('xpath://table//th[text() ="'.$header.'"]')->one()->isPresent());
$dialog->query('xpath:.//input[@type="text"]')->waitUntilPresent()->one()->fill('20M');
$dialog->query('button:Test')->one()->click();
$message = $dialog->query('tag:output')->waitUntilPresent()->asMessage()->one();
$this->assertTrue($message->isBad());
$this->assertEquals('Cannot evaluate expression', $message->getTitle());
'Connection to Zabbix server "localhost" refused. Possible reasons:',
'1. Incorrect server IP/DNS in the "zabbix.conf.php";',
'2. Security environment (for example, SELinux) is blocking the connection;',
'3. Zabbix server daemon not running;',
'4. Firewall is blocking TCP connection.',
foreach ($message_details as $line) {
$this->assertTrue($message->hasLine($line));