require_once dirname(__FILE__).'/../include/CLegacyWebTest.php';
use Facebook\WebDriver\WebDriverBy;
class testFormAdministrationDMProxies extends CLegacyWebTest {
private $proxy_name = 'proxy_name_1';
private $new_proxy_name = 'proxy_name_new';
private $cloned_proxy_name = 'proxy_name_new_clone';
private $long_proxy_name = '1234567890123456789012345678901234567890123456789012345678901234';
private $long_proxy_name2 = '12345678901234567890123456789012345678901234567890123456789012345';
private $proxy_host = 'Zabbix server';
private $passive_proxy_host = 'H1';
private $passive_proxy_name = 'passive_proxy_name1';
public function testFormAdministrationDMProxies_CheckLayout() {
$this->zbxTestLogin('zabbix.php?action=proxy.list');
$this->zbxTestCheckTitle('Configuration of proxies');
$this->zbxTestCheckHeader('Proxies');
$this->zbxTestClickButtonText('Create proxy');
$this->zbxTestTextPresent(['Proxy name', 'Proxy mode', 'Proxy address', 'Description']);
$this->zbxTestAssertElementPresentId('host');
$this->zbxTestAssertAttribute('//input[@id=\'host\']', 'maxlength', '128');
$this->zbxTestAssertElementText("//ul[@id='status']//label[@for='status_0']", 'Active');
$this->zbxTestAssertElementText("//ul[@id='status']//label[@for='status_1']", 'Passive');
$this->zbxTestAssertElementPresentXpath("//button[@value='proxy.create']");
$this->zbxTestAssertElementPresentXpath("//button[text()='Cancel']");
$this->zbxTestClickXpathWait("//ul[@id='status']//label[@for='status_1']");
$this->zbxTestWaitUntilElementVisible(WebDriverBy::id('ip'));
$this->zbxTestTextPresent(['Proxy name', 'Proxy mode', 'Interface', 'Description']);
$this->zbxTestTextPresent(['IP address', 'DNS name', 'Connect to', 'Port']);
$this->zbxTestAssertElementPresentId('host');
$this->zbxTestAssertAttribute('//input[@id=\'host\']', 'maxlength', '128');
$this->zbxTestAssertElementPresentId('status');
$this->zbxTestAssertElementPresentId('ip');
$this->zbxTestAssertAttribute('//input[@id=\'ip\']', 'maxlength', '64');
$this->zbxTestAssertElementPresentId('dns');
$this->zbxTestAssertAttribute('//input[@id=\'dns\']', 'maxlength', '255');
$this->zbxTestAssertElementPresentId('port');
$this->zbxTestAssertAttribute('//input[@id=\'port\']', 'maxlength', '64');
$this->zbxTestAssertElementPresentXpath("//button[@value='proxy.create']");
$this->zbxTestAssertElementPresentXpath("//button[text()='Cancel']");
public static function dataCreate() {
[PROXY_GOOD, 'New active proxy 1', HOST_STATUS_PROXY_ACTIVE,
0, 0, 'No encryption', 0, ''
[PROXY_GOOD, 'New active proxy 2', HOST_STATUS_PROXY_ACTIVE,
[PROXY_GOOD, 'New active proxy 3', HOST_STATUS_PROXY_ACTIVE,
0, 0, 'Certificate', 0, ''
[PROXY_GOOD, 'New passive proxy 1', HOST_STATUS_PROXY_PASSIVE,
'192.168.1.1', 'proxy123.zabbix.com', 'No encryption', 11051, ''