require_once dirname(__FILE__).'/../include/CLegacyWebTest.php';
class testFormHostLinkTemplates extends CLegacyWebTest {
public $host_for_template = 'Visible host for template linkage';
public function testFormHostLinkTemplates_Layout() {
$this->zbxTestLogin('hosts.php?form=1');
$this->zbxTestTabSwitch('Inventory');
$inventoryFields = getHostInventories();
$inventoryFields = zbx_toHash($inventoryFields, 'db_field');
foreach ($inventoryFields as $fieldId => $fieldName) {
$this->zbxTestTextPresent($fieldName['title']);
$this->zbxTestAssertElementPresentId('host_inventory_'.$fieldId.'');
public function testFormHostLinkTemplates_TemplateLink() {
$this->zbxTestLogin('hosts.php');
$this->query('button:Reset')->one()->click();
$this->zbxTestClickLinkTextWait($this->host_for_template);
$this->zbxTestTabSwitch('Templates');
$this->zbxTestClickButtonMultiselect('add_templates_');
$this->zbxTestLaunchOverlayDialog('Templates');
COverlayDialogElement::find()->one()->setDataContext('Templates');
$this->zbxTestClickLinkTextWait('Template OS Linux by Zabbix agent');
$this->zbxTestTextPresent('Template OS Linux by Zabbix agent');
$this->zbxTestClick('update');
$this->zbxTestCheckTitle('Configuration of hosts');
$this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Host updated');
$this->zbxTestTextPresent($this->host_for_template);
public function testFormHostLinkTemplates_TemplateUnlink() {