<?php
require_once dirname(__FILE__).'/../include/CLegacyWebTest.php';
use Facebook\WebDriver\WebDriverBy;
class testFormAdministrationGeneralRegexp extends CLegacyWebTest {
private $regexp = 'test_regexp1';
private $regexp2 = 'test_regexp2';
private $cloned_regexp = 'test_regexp1_clone';
public function testFormAdministrationGeneralRegexp_Layout() {
$this->zbxTestLogin('zabbix.php?action=gui.edit');
$this->query('id:page-title-general')->asPopupButton()->one()->select('Regular expressions');
$this->zbxTestCheckTitle('Configuration of regular expressions');
$this->zbxTestCheckHeader('Regular expressions');
$this->zbxTestTextPresent(['Regular expressions', 'Name', 'Expressions']);
$this->zbxTestClickButtonText('New regular expression');
$this->zbxTestCheckTitle('Configuration of regular expressions');
$this->zbxTestCheckHeader('Regular expressions');
$this->zbxTestTextPresent('Name');
$this->zbxTestTextPresent('Expressions');
$this->zbxTestAssertElementPresentId('name');
$this->zbxTestAssertAttribute("//input[@id='name']", "maxlength", 128);
$this->zbxTestAssertAttribute("//input[@id='expressions_0_expression']", "maxlength", 255);
$this->zbxTestDropdownHasOptions('expressions_0_expression_type', [
'Character string included',
'Any character string included',
'Character string not included',
'Result is TRUE',
'Result is FALSE'
]);
}
public static function dataCreate() {
return [
['TRUE', 'test_regexp1', 'first test string', 'first test string', 'Character string included', ',', 1],
['FALSE', 'test_regexp1_2', 'first test string', 'first test string2', 'Character string included', ',', 1],
['TRUE', 'test_regexp2', 'second test string', 'test string', 'Any character string included', '.', 0],
['FALSE', 'test_regexp2_2', 'second test string', 'second string', 'Any character string included', '.', 0],
['TRUE', 'test_regexp3', 'test', 'abcd test', 'Character string not included', '.', 0],
['FALSE', 'test_regexp3_2', 'test', 'test', 'Character string not included', '.', 0],
['TRUE', 'test_regexp4', 'abcd', 'abcd', 'Result is TRUE', '.', 0],
['FALSE', 'test_regexp4_2', 'abcd', 'qwerty', 'Result is TRUE', '.', 0],
['TRUE', 'test_regexp5', 'abcd', 'asdf', 'Result is FALSE', '.', 0],
['FALSE', 'test_regexp5_2', 'abcd', 'abcd', 'Result is FALSE', '.', 0]
];
}
public function testFormAdministrationGeneralRegexp_Create($result, $name, $test_string, $expression, $expression_type, $exp_delimiter, $case_sensitive) {
$this->zbxTestLogin('zabbix.php?action=regex.list');
$this->zbxTestCheckHeader('Regular expressions');
$this->zbxTestClickButtonText('New regular expression');
$this->zbxTestInputType('name', $name);
$this->zbxTestInputType('expressions_0_expression', $expression);
$this->zbxTestDropdownSelect('expressions_0_expression_type', $expression_type);
if ($case_sensitive == 1) {
$this->zbxTestCheckboxSelect('expressions_0_case_sensitive');