Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/ui/tests
diff options
context:
space:
mode:
authorAndrejs Griščenko <andrejs.griscenko@zabbix.com>2021-04-15 17:36:07 +0300
committerAndrejs Griščenko <andrejs.griscenko@zabbix.com>2021-04-15 17:36:07 +0300
commitdecfd09b2b1f1e70fcccbeebb8b10cc54204b7d9 (patch)
tree04f761d57384bfc5bf93d6c341a6f81f582007e9 /ui/tests
parenta5888b38fb7cdf0126aae8f09e988227834967f6 (diff)
parent3c11d9b6b7e5c546e52fc388c3c728f2cf3e88b6 (diff)
.......... [ZBXNEXT-6478] updated to the master branch; resolved conflicts in:
- create/src/schema.tmpl - src/libs/zbxdbupgrade/dbupgrade_5030.c - ui/app/views/popup.generic.php - ui/include/classes/mvc/CRouter.php - ui/include/defines.inc.php - ui/include/schema.inc.php
Diffstat (limited to 'ui/tests')
-rw-r--r--ui/tests/api_json/ApiJsonTests.php4
-rw-r--r--ui/tests/api_json/data/data_test.sql80
-rw-r--r--ui/tests/api_json/testApplication.php661
-rw-r--r--ui/tests/api_json/testAuditLog.php2
-rw-r--r--ui/tests/api_json/testConfiguration.php16
-rw-r--r--ui/tests/api_json/testDiscoveryRule.php22
-rw-r--r--ui/tests/api_json/testItem.php32
-rw-r--r--ui/tests/api_json/testMap.php9
-rw-r--r--ui/tests/api_json/testTemplateImport.php70
-rw-r--r--ui/tests/api_json/testWebScenario.php188
-rw-r--r--ui/tests/api_json/xml/testDeleteMissingForLinkedTemplateApplication.xml112
-rw-r--r--ui/tests/selenium/SeleniumTests.php10
-rw-r--r--ui/tests/selenium/common/testFormTags.php144
-rw-r--r--ui/tests/selenium/dashboard/testDashboardCopyWidgets.php8
-rw-r--r--ui/tests/selenium/dashboard/testDashboardGraphPrototypeWidget.php2
-rw-r--r--ui/tests/selenium/dashboard/testDashboardProblemsBySeverityWidget.php4
-rw-r--r--ui/tests/selenium/data/data_test.sql146
-rw-r--r--ui/tests/selenium/modules/module_number_6/manifest.json2
-rw-r--r--ui/tests/selenium/testFormAction.php49
-rw-r--r--ui/tests/selenium/testFormApplication.php238
-rw-r--r--ui/tests/selenium/testFormHost.php2
-rw-r--r--ui/tests/selenium/testFormHostLinkTemplates.php12
-rw-r--r--ui/tests/selenium/testFormItem.php16
-rw-r--r--ui/tests/selenium/testFormItemPrototype.php9
-rw-r--r--ui/tests/selenium/testFormTabIndicators.php6
-rw-r--r--ui/tests/selenium/testFormTagsItem.php58
-rw-r--r--ui/tests/selenium/testFormTagsItemPrototype.php58
-rw-r--r--ui/tests/selenium/testFormTemplate.php4
-rw-r--r--ui/tests/selenium/testFormUser.php10
-rw-r--r--ui/tests/selenium/testFormWeb.php49
-rw-r--r--ui/tests/selenium/testInheritanceApplication.php292
-rw-r--r--ui/tests/selenium/testInheritanceTrigger.php1
-rw-r--r--ui/tests/selenium/testPageAdministrationGeneralModules.php4
-rw-r--r--ui/tests/selenium/testPageApplications.php299
-rw-r--r--ui/tests/selenium/testPageDashboard.php32
-rw-r--r--ui/tests/selenium/testPageDashboardWidgets.php4
-rw-r--r--ui/tests/selenium/testPageHostGraph.php1
-rw-r--r--ui/tests/selenium/testPageHosts.php4
-rw-r--r--ui/tests/selenium/testPageItemPrototypes.php4
-rw-r--r--ui/tests/selenium/testPageItems.php2
-rw-r--r--ui/tests/selenium/testPageLatestData.php4
-rw-r--r--ui/tests/selenium/testPageMonitoringHosts.php4
-rw-r--r--ui/tests/selenium/testPageOverview.php57
-rw-r--r--ui/tests/selenium/testPageProblems.php23
-rw-r--r--ui/tests/selenium/testPageReportsAudit.php4
-rw-r--r--ui/tests/selenium/testPageSearch.php2
-rw-r--r--ui/tests/selenium/testPageTemplates.php5
-rw-r--r--ui/tests/selenium/testUrlUserPermissions.php10
-rw-r--r--ui/tests/selenium/testZBX6663.php14
-rw-r--r--ui/tests/unit/include/classes/import/CImportDataAdapterTest.php156
-rw-r--r--ui/tests/unit/include/classes/validators/CActionCondValidatorTest.php11
51 files changed, 574 insertions, 2382 deletions
diff --git a/ui/tests/api_json/ApiJsonTests.php b/ui/tests/api_json/ApiJsonTests.php
index 711740b5e91..87980295c1d 100644
--- a/ui/tests/api_json/ApiJsonTests.php
+++ b/ui/tests/api_json/ApiJsonTests.php
@@ -22,7 +22,6 @@
require_once dirname(__FILE__).'/testJSONRPC.php';
require_once dirname(__FILE__).'/testAPIInfo.php';
require_once dirname(__FILE__).'/testAction.php';
-require_once dirname(__FILE__).'/testApplication.php';
require_once dirname(__FILE__).'/testAuditLog.php';
require_once dirname(__FILE__).'/testConfiguration.php';
require_once dirname(__FILE__).'/testCorrelation.php';
@@ -45,7 +44,6 @@ require_once dirname(__FILE__).'/testTriggerPermissions.php';
require_once dirname(__FILE__).'/testTriggerValidation.php';
require_once dirname(__FILE__).'/testTaskCreate.php';
require_once dirname(__FILE__).'/testTagFiltering.php';
-require_once dirname(__FILE__).'/testTemplateImport.php';
require_once dirname(__FILE__).'/testToken.php';
require_once dirname(__FILE__).'/testUserGroup.php';
require_once dirname(__FILE__).'/testUserMacro.php';
@@ -63,7 +61,6 @@ class ApiJsonTests {
$suite->addTestSuite('testJSONRPC');
$suite->addTestSuite('testAPIInfo');
$suite->addTestSuite('testAction');
- $suite->addTestSuite('testApplication');
$suite->addTestSuite('testAuditLog');
$suite->addTestSuite('testConfiguration');
// $suite->addTestSuite('testDependentItems'); TODO: To be fix later
@@ -87,7 +84,6 @@ class ApiJsonTests {
$suite->addTestSuite('testTriggerValidation');
$suite->addTestSuite('testTaskCreate');
$suite->addTestSuite('testTagFiltering');
- $suite->addTestSuite('testTemplateImport');
$suite->addTestSuite('testToken');
$suite->addTestSuite('testUserGroup');
$suite->addTestSuite('testUserMacro');
diff --git a/ui/tests/api_json/data/data_test.sql b/ui/tests/api_json/data/data_test.sql
index b07ac593e90..1da7cd8f906 100644
--- a/ui/tests/api_json/data/data_test.sql
+++ b/ui/tests/api_json/data/data_test.sql
@@ -3,7 +3,7 @@
-- Activate "Zabbix Server" host
UPDATE hosts SET status=0 WHERE host='Zabbix server';
--- applications
+-- host groups
INSERT INTO hosts (hostid, host, name, status, description) VALUES (50009, 'API Host', 'API Host', 0, '');
INSERT INTO hosts (hostid, host, name, status, description) VALUES (50010, 'API Template', 'API Template', 3, '');
INSERT INTO interface (interfaceid,hostid,main,type,useip,ip,dns,port) values (50022,50009,1,1,1,'127.0.0.1','','10050');
@@ -12,50 +12,7 @@ INSERT INTO hstgrp (groupid,name,internal) VALUES (50013,'API group for template
INSERT INTO hosts_groups (hostgroupid, hostid, groupid) VALUES (50009, 50009, 50012);
INSERT INTO hosts_groups (hostgroupid, hostid, groupid) VALUES (50011, 50010, 50013);
INSERT INTO hosts_templates (hosttemplateid, hostid, templateid) VALUES (50003, 50009, 50010);
-INSERT INTO applications (applicationid,hostid,name) VALUES (366,50009,'API application');
-INSERT INTO applications (applicationid,hostid,name) VALUES (367,50009,'API host application for update');
-INSERT INTO applications (applicationid,hostid,name) VALUES (368,10093,'API template application for update');
-INSERT INTO applications (applicationid,hostid,name) VALUES (369,50010,'API templated application');
-INSERT INTO applications (applicationid,hostid,name) VALUES (370,50009,'API templated application');
-INSERT INTO applications (applicationid,hostid,name) VALUES (371,50009,'API application delete');
-INSERT INTO applications (applicationid,hostid,name) VALUES (372,50009,'API application delete2');
-INSERT INTO applications (applicationid,hostid,name) VALUES (373,50009,'API application delete3');
-INSERT INTO applications (applicationid,hostid,name) VALUES (374,50009,'API application delete4');
-INSERT INTO applications (applicationid,hostid,name) VALUES (376,10084,'API application for Zabbix server');
-INSERT INTO application_template (application_templateid,applicationid,templateid) VALUES (52,370,369);
--- discovered application
INSERT INTO items (itemid,hostid,interfaceid,type,value_type,name,key_,delay,history,status,params,description,flags,posts,headers) VALUES (40066, 50009, 50022, 0, 2,'API discovery rule','vfs.fs.discovery',30,90,0,'','',1,'','');
-INSERT INTO items (itemid,hostid,interfaceid,type,value_type,name,key_,delay,history,status,params,description,flags,posts,headers) VALUES (40067, 50009, 50022, 0, 2,'API discovery item','vfs.fs.size[{#FSNAME},free]',30,90,0,'','',2,'','');
-INSERT INTO items (itemid,hostid,interfaceid,type,value_type,name,key_,delay,history,status,params,description,flags,posts,headers) VALUES (40068, 50009, 50022, 0, 2,'API discovery item','vfs.fs.size[/,free]',30,90,0,'','',4,'','');
-INSERT INTO item_discovery (itemdiscoveryid,itemid,parent_itemid,key_) VALUES (15085,40067,40066,'vfs.fs.size[{#FSNAME},free]');
-INSERT INTO item_discovery (itemdiscoveryid,itemid,parent_itemid,key_) VALUES (15086,40068,40067,'vfs.fs.size[{#FSNAME},free]');
-INSERT INTO applications (applicationid,hostid,name,flags) VALUES (375,50009,'API discovery application',4);
-INSERT INTO application_prototype (application_prototypeid,itemid,name) VALUES (900,40066,'API discovery application');
-INSERT INTO application_discovery (application_discoveryid,applicationid,application_prototypeid,name) VALUES (1,375,900,'API discovery application');
-INSERT INTO items_applications (itemappid,applicationid,itemid) VALUES (6000,375,40068);
-INSERT INTO item_application_prototype (item_application_prototypeid,application_prototypeid,itemid) VALUES (1900,900,40067);
-
--- valuemap
-INSERT INTO valuemap (valuemapid,hostid,name) VALUES (399,50009,'API value map for update');
-INSERT INTO valuemap (valuemapid,hostid,name) VALUES (400,50009,'API value map for update with mappings');
-INSERT INTO valuemap (valuemapid,hostid,name) VALUES (401,50009,'API value map delete');
-INSERT INTO valuemap (valuemapid,hostid,name) VALUES (402,50009,'API value map delete2');
-INSERT INTO valuemap (valuemapid,hostid,name) VALUES (403,50009,'API value map delete3');
-INSERT INTO valuemap (valuemapid,hostid,name) VALUES (404,50009,'API value map delete4');
-INSERT INTO valuemap (valuemapid,hostid,name) VALUES (405,50009,'API value duplicate');
-INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9904,399,'1','Unknown');
-INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9905,400,'One','Online');
-INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9906,400,'Two','Offline');
-INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9907,401,'1','Unknown');
-INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9908,402,'Three','Other');
-INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9909,403,'Four','Unknown');
-INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9910,404,'1','Unknown');
-INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9911,405,'1','Unknown');
-INSERT INTO users (userid, username, passwd, autologin, autologout, lang, refresh, roleid, theme, attempt_failed, attempt_clock, rows_per_page) VALUES (4, 'zabbix-admin', '5fce1b3e34b520afeffb37ce08c7cd66', 0, 0, 'en_GB', '30s', 2, 'default', 0, 0, 50);
-INSERT INTO users (userid, username, passwd, autologin, autologout, lang, refresh, roleid, theme, attempt_failed, attempt_clock, rows_per_page) VALUES (5, 'zabbix-user', '5fce1b3e34b520afeffb37ce08c7cd66', 0, 0, 'en_GB', '30s', 1, 'default', 0, 0, 50);
-INSERT INTO users_groups (id, usrgrpid, userid) VALUES (6, 8, 4);
-
--- host groups
INSERT INTO hstgrp (groupid,name,internal) VALUES (50005,'API host group for update',0);
INSERT INTO hosts_groups (hostgroupid, hostid, groupid) VALUES (50010, 50009, 50005);
INSERT INTO hstgrp (groupid,name,internal) VALUES (50006,'API host group for update internal',1);
@@ -90,9 +47,12 @@ INSERT INTO usrgrp (usrgrpid, name) VALUES (19, 'API user group delete3');
INSERT INTO usrgrp (usrgrpid, name) VALUES (20, 'API user group in actions');
INSERT INTO usrgrp (usrgrpid, name) VALUES (21, 'API user group in scripts');
INSERT INTO usrgrp (usrgrpid, name) VALUES (22, 'API user group in configuration');
+INSERT INTO users (userid, username, passwd, autologin, autologout, lang, refresh, roleid, theme, attempt_failed, attempt_clock, rows_per_page) VALUES (4, 'zabbix-admin', '5fce1b3e34b520afeffb37ce08c7cd66', 0, 0, 'en_GB', '30s', 2, 'default', 0, 0, 50);
+INSERT INTO users (userid, username, passwd, autologin, autologout, lang, refresh, roleid, theme, attempt_failed, attempt_clock, rows_per_page) VALUES (5, 'zabbix-user', '5fce1b3e34b520afeffb37ce08c7cd66', 0, 0, 'en_GB', '30s', 1, 'default', 0, 0, 50);
INSERT INTO users (userid, username, passwd, autologin, autologout, lang, refresh, roleid, theme, attempt_failed, attempt_clock, rows_per_page) VALUES (6, 'user-in-one-group', '5fce1b3e34b520afeffb37ce08c7cd66', 0, 0, 'en_GB', '30s', 2, 'default', 0, 0, 50);
INSERT INTO users (userid, username, passwd, autologin, autologout, lang, refresh, roleid, theme, attempt_failed, attempt_clock, rows_per_page) VALUES (7, 'user-in-two-groups', '5fce1b3e34b520afeffb37ce08c7cd66', 0, 0, 'en_GB', '30s', 2, 'default', 0, 0, 50);
INSERT INTO users (userid, username, passwd, autologin, autologout, lang, refresh, roleid, theme, attempt_failed, attempt_clock, rows_per_page) VALUES (8, 'api-user', '5fce1b3e34b520afeffb37ce08c7cd66', 0, 0, 'en_GB', '30s', 2, 'default', 0, 0, 50);
+INSERT INTO users_groups (id, usrgrpid, userid) VALUES (6, 8, 4);
INSERT INTO users_groups (id, usrgrpid, userid) VALUES (8, 14, 4);
INSERT INTO users_groups (id, usrgrpid, userid) VALUES (9, 15, 6);
INSERT INTO users_groups (id, usrgrpid, userid) VALUES (10, 16, 7);
@@ -125,6 +85,23 @@ INSERT INTO opmessage (operationid, default_msg, subject, message, mediatypeid)
INSERT INTO opmessage_usr (opmessage_usrid, operationid, userid) VALUES (4, 32, 13);
INSERT INTO sysmaps (sysmapid, name, width, height, backgroundid, label_type, label_location, highlight, expandproblem, markelements, show_unack, userid, private) VALUES (6, 'API map', 800, 600, NULL, 0, 0, 1, 1, 1, 2, 14, 0);
+-- valuemap
+INSERT INTO valuemap (valuemapid,hostid,name) VALUES (399,50009,'API value map for update');
+INSERT INTO valuemap (valuemapid,hostid,name) VALUES (400,50009,'API value map for update with mappings');
+INSERT INTO valuemap (valuemapid,hostid,name) VALUES (401,50009,'API value map delete');
+INSERT INTO valuemap (valuemapid,hostid,name) VALUES (402,50009,'API value map delete2');
+INSERT INTO valuemap (valuemapid,hostid,name) VALUES (403,50009,'API value map delete3');
+INSERT INTO valuemap (valuemapid,hostid,name) VALUES (404,50009,'API value map delete4');
+INSERT INTO valuemap (valuemapid,hostid,name) VALUES (405,50009,'API value duplicate');
+INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9904,399,'1','Unknown');
+INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9905,400,'One','Online');
+INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9906,400,'Two','Offline');
+INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9907,401,'1','Unknown');
+INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9908,402,'Three','Other');
+INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9909,403,'Four','Unknown');
+INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9910,404,'1','Unknown');
+INSERT INTO valuemap_mapping (valuemap_mappingid,valuemapid,value,newvalue) VALUES (9911,405,'1','Unknown');
+
-- scripts
INSERT INTO hosts (hostid, host, name, status, description) VALUES (50013, 'API disabled host', 'API disabled host', 1, '');
INSERT INTO interface (interfaceid,hostid,main,type,useip,ip,dns,port) values (50024,50013,1,1,1,'127.0.0.1','','10050');
@@ -296,9 +273,7 @@ INSERT INTO httpstep (httpstepid, httptestid, name, no, url, posts) VALUES (1501
INSERT INTO httpstep (httpstepid, httptestid, name, no, url, posts) VALUES (15014, 15013, 'Api step 2', 2, 'http://api.com', '');
-- web scenario for webitem update testing
-INSERT INTO applications (applicationid,hostid,name,flags) VALUES (15015,50009,'Webtest key_name application',0);
-INSERT INTO applications (applicationid,hostid,name,flags) VALUES (15016,50009,'Webtest key_name application2',0);
-INSERT INTO httptest (httptestid, name, delay, agent, hostid, applicationid) VALUES (15015, 'Webtest key_name', 60, 'Zabbix', 50009, 15015);
+INSERT INTO httptest (httptestid, name, delay, agent, hostid) VALUES (15015, 'Webtest key_name', 60, 'Zabbix', 50009);
INSERT INTO httpstep (httpstepid, httptestid, name, no, url, posts) VALUES (15015, 15015, 'Webstep name 1', 1, 'http://api.com', '');
INSERT INTO httpstep (httpstepid, httptestid, name, no, url, posts) VALUES (15016, 15015, 'Webstep name 2', 2, 'http://api.com', '');
INSERT INTO items (itemid,hostid,interfaceid,type,value_type,name,key_,delay,history,status,params,description,flags,posts,headers) VALUES (150151, 50009, 1, 9, 0,'Download speed for scenario "$1".','web.test.in[Webtest key_name,,bps]','2m','30d',0,'','',0,'','');
@@ -319,15 +294,6 @@ INSERT INTO httpstepitem (httpstepitemid, httpstepid, itemid, type) VALUES (1501
INSERT INTO httpstepitem (httpstepitemid, httpstepid, itemid, type) VALUES (150157, 15016, 150157, 2);
INSERT INTO httpstepitem (httpstepitemid, httpstepid, itemid, type) VALUES (150158, 15016, 150158, 1);
INSERT INTO httpstepitem (httpstepitemid, httpstepid, itemid, type) VALUES (150159, 15016, 150159, 0);
-INSERT INTO items_applications (itemappid,applicationid,itemid) VALUES (150151,15015,150151);
-INSERT INTO items_applications (itemappid,applicationid,itemid) VALUES (150152,15015,150152);
-INSERT INTO items_applications (itemappid,applicationid,itemid) VALUES (150153,15015,150153);
-INSERT INTO items_applications (itemappid,applicationid,itemid) VALUES (150154,15015,150154);
-INSERT INTO items_applications (itemappid,applicationid,itemid) VALUES (150155,15015,150155);
-INSERT INTO items_applications (itemappid,applicationid,itemid) VALUES (150156,15015,150156);
-INSERT INTO items_applications (itemappid,applicationid,itemid) VALUES (150157,15015,150157);
-INSERT INTO items_applications (itemappid,applicationid,itemid) VALUES (150158,15015,150158);
-INSERT INTO items_applications (itemappid,applicationid,itemid) VALUES (150159,15015,150159);
-- proxy
INSERT INTO hosts (hostid, host, status, description) VALUES (99000, 'Api active proxy for delete0', 5, '');
@@ -352,7 +318,7 @@ INSERT INTO sysmaps (sysmapid, name, width, height, backgroundid, label_type, la
INSERT INTO sysmap_user (sysmapuserid, sysmapid, userid, permission) VALUES (1, 10001, 5, 3);
INSERT INTO sysmap_user (sysmapuserid, sysmapid, userid, permission) VALUES (2, 10003, 5, 3);
INSERT INTO sysmap_user (sysmapuserid, sysmapid, userid, permission) VALUES (3, 10004, 5, 3);
-INSERT INTO sysmaps_elements (selementid, sysmapid, elementid, elementtype, iconid_off, iconid_on, label, label_location, x, y, iconid_disabled, iconid_maintenance, elementsubtype, areatype, width, height, viewtype, use_iconmap, application) VALUES (7, 10001, 0, 4, 151, NULL, 'New element', -1, 189, 77, NULL, NULL, 0, 0, 200, 200, 0, 1, '');
+INSERT INTO sysmaps_elements (selementid, sysmapid, elementid, elementtype, iconid_off, iconid_on, label, label_location, x, y, iconid_disabled, iconid_maintenance, elementsubtype, areatype, width, height, viewtype, use_iconmap) VALUES (7, 10001, 0, 4, 151, NULL, 'New element', -1, 189, 77, NULL, NULL, 0, 0, 200, 200, 0, 1);
-- disabled item and LLD rule
INSERT INTO items (itemid,hostid,interfaceid,type,value_type,name,key_,delay,history,status,params,description,flags,posts,headers) VALUES (90000, 10084, 1, 0, 3,'Api disabled item','disabled.item','30d','90d',1,'','',0,'','');
diff --git a/ui/tests/api_json/testApplication.php b/ui/tests/api_json/testApplication.php
deleted file mode 100644
index 89acdbfcd06..00000000000
--- a/ui/tests/api_json/testApplication.php
+++ /dev/null
@@ -1,661 +0,0 @@
-<?php
-/*
-** Zabbix
-** Copyright (C) 2001-2021 Zabbix SIA
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-**/
-
-
-require_once dirname(__FILE__).'/../include/CAPITest.php';
-
-/**
- * @backup applications
- */
-class testApplication extends CAPITest {
- public static function application_create() {
- return [
- [
- 'application' => [
- 'name' => 'non existent parameter',
- 'hostid' => '50009',
- 'flags' => '4'
- ],
- 'expected_error' => 'Invalid parameter "/1": unexpected parameter "flags".'
- ],
- // Check application hostid.
- [
- 'application' => [
- 'name' => 'application without hostid'
- ],
- 'expected_error' => 'Invalid parameter "/1": the parameter "hostid" is missing.'
- ],
- [
- 'application' => [
- 'name' => 'application with empty hostid',
- 'hostid' => ''
- ],
- 'expected_error' => 'Invalid parameter "/1/hostid": a number is expected.'
- ],
- [
- 'application' => [
- 'name' => 'application with not existing hostid',
- 'hostid' => '123456'
- ],
- 'expected_error' => 'No permissions to referred object or it does not exist!'
- ],
- [
- 'application' => [
- 'name' => 'hostid not number',
- 'hostid' => 'abc'
- ],
- 'expected_error' => 'Invalid parameter "/1/hostid": a number is expected.'
- ],
- [
- 'application' => [
- 'name' => 'hostid not number',
- 'hostid' => '.'
- ],
- 'expected_error' => 'Invalid parameter "/1/hostid": a number is expected.'
- ],
- // Check application name.
- [
- 'application' => [
- 'hostid' => '50009'
- ],
- 'expected_error' => 'Invalid parameter "/1": the parameter "name" is missing.'
- ],
- [
- 'application' => [
- 'name' => '',
- 'hostid' => '50009'
- ],
- 'expected_error' => 'Invalid parameter "/1/name": cannot be empty.'
- ],
- [
- 'application' => [
- 'name' => 'Suspendisse sagittis euismod consequat. Vivamus pretium, lectus vitae lacinia sodales, metus nisi viverra lectus, vel fermentum dui eros et est. Mauris vitae velit ac massa imperdiet molestie ut sed diam? Quisque vehicula nulla at mauris aliquam, nec condd',
- 'hostid' => '50009'
- ],
- 'expected_error' => 'Invalid parameter "/1/name": value is too long.'
- ],
- // Check name duplicates.
- [
- 'application' => [
- 'name' => 'API application',
- 'hostid' => '50009'
- ],
- 'expected_error' => 'Application "API application" already exists.'
- ],
- [
- 'application' => [
- [
- 'name' => 'One application with existing name',
- 'hostid' => '50009'
- ],
- [
- 'name' => 'API application',
- 'hostid' => '50009'
- ]
- ],
- 'expected_error' => 'Application "API application" already exists.'
- ],
- [
- 'application' => [
- 'name' => 'API templated application',
- 'hostid' => '50009'
- ],
- 'expected_error' => 'Application "API templated application" already exists.'
- ],
- [
- 'application' => [
- 'name' => 'API discovery application',
- 'hostid' => '50009'
- ],
- 'expected_error' => 'Application "API discovery application" already exists.'
- ],
- [
- 'application' => [
- [
- 'name' => 'Applications with two identical name',
- 'hostid' => '50009'
- ],
- [
- 'name' => 'Applications with two identical name',
- 'hostid' => '50009'
- ]
- ],
- 'expected_error' => 'Invalid parameter "/2": value (hostid, name)=(50009, Applications with two identical name) already exists.'
- ],
- // Check successfully creation of application.
- [
- 'application' => [
- [
- 'name' => 'API host application create',
- 'hostid' => '50009'
- ]
- ],
- 'expected_error' => null
- ],
- [
- 'application' => [
- [
- 'name' => 'æų',
- 'hostid' => '50009'
- ],
- [
- 'name' => 'УТФ-8/создать',
- 'hostid' => '50009'
- ]
- ],
- 'expected_error' => null
- ],
- [
- 'application' => [
- [
- 'name' => 'API template application create',
- 'hostid' => '10093'
- ]
- ],
- 'expected_error' => null
- ]
- ];
- }
-
- /**
- * @dataProvider application_create
- */
- public function testApplication_Create($application, $expected_error) {
- $result = $this->call('application.create', $application, $expected_error);
-
- if ($expected_error === null) {
- foreach ($result['result']['applicationids'] as $key => $id) {
- $dbResult = DBSelect('select * from applications where applicationid='.zbx_dbstr($id));
- $dbRow = DBFetch($dbResult);
- $this->assertEquals($dbRow['hostid'], $application[$key]['hostid']);
- $this->assertEquals($dbRow['name'], $application[$key]['name']);
- $this->assertEquals($dbRow['flags'], 0);
- }
- }
- }
-
- public static function application_template() {
- return [
- // Check new template application successfully templated to the host.
- [
- 'template_application' => [
- 'name' => 'API create new templated application',
- 'hostid' => '50010'
- ],
- 'new_template_application' => true,
- 'host_application_id' => null,
- 'method' => 'application.create'
- ],
- // Check that, existing application of host changed to templated.
- [
- 'template_application' => [
- 'name' => 'API application',
- 'hostid' => '50010'
- ],
- 'new_template_application' => false,
- 'host_application_id' => '366',
- 'method' => 'application.create'
- ],
- // Check that, host templated application name successfully changed after template application name update.
- [
- 'template_application' => [
- 'applicationid' => '369',
- 'name' => 'API templated application update'
- ],
- 'new_template_application' => false,
- 'host_application_id' => '370',
- 'method' => 'application.update'
- ]
- ];
- }
-
- /**
- * @dataProvider application_template
- */
- public function testApplication_CreateTemplated($template_application, $new_template_application, $host_application_id, $method) {
- $result = $this->call($method, [$template_application]);
-
- $dbResult = DBSelect('select * from applications where applicationid='.zbx_dbstr($result['result']['applicationids'][0]));
- $dbRow = DBFetch($dbResult);
- if (array_key_exists('hostid', $template_application)) {
- $this->assertEquals($dbRow['hostid'], $template_application['hostid']);
- }
- $this->assertEquals($dbRow['name'], $template_application['name']);
- $this->assertEquals($dbRow['flags'], 0);
-
- $dbResultTemplate = DBSelect('select * from application_template where templateid='.zbx_dbstr($result['result']['applicationids'][0]));
- $dbRowTemplate = DBFetch($dbResultTemplate);
-
- if ($new_template_application) {
- $this->assertEquals($dbRowTemplate['applicationid'], $result['result']['applicationids'][0]+1);
-
- $dbResultHost = DBSelect('select * from applications where applicationid='.zbx_dbstr($result['result']['applicationids'][0]+1));
- $dbRowHost = DBFetch($dbResultHost);
- $this->assertEquals($dbRowHost['name'], $template_application['name']);
- $this->assertEquals($dbRowHost['flags'], 0);
- }
- else {
- $this->assertEquals($dbRowTemplate['applicationid'], $host_application_id);
-
- $dbResultHost = DBSelect('select * from applications where applicationid='.zbx_dbstr($host_application_id));
- $dbRowHost = DBFetch($dbResultHost);
- $this->assertEquals($dbRowHost['name'], $template_application['name']);
- $this->assertEquals($dbRowHost['flags'], 0);
- }
- }
-
- public static function application_update() {
- return [
- [
- 'application' => [
- [
- 'applicationid' => '367',
- 'name' => 'non existent parameter',
- 'flags' => '4'
- ]
- ],
- 'expected_error' => 'Invalid parameter "/1": unexpected parameter "flags".'
- ],
- // Check application id.
- [
- 'application' => [
- [
- 'name' => 'without application id'
- ]
- ],
- 'expected_error' => 'Invalid parameter "/1": the parameter "applicationid" is missing.'
- ],
- [
- 'application' => [
- [
- 'applicationid' => ''
- ]
- ],
- 'expected_error' => 'Invalid parameter "/1/applicationid": a number is expected.'
- ],
- [
- 'application' => [
- [
- 'applicationid' => '123456',
- 'name' => 'application with not existing id'
- ]
- ],
- 'expected_error' => 'No permissions to referred object or it does not exist!'
- ],
- [
- 'application' => [
- [
- 'applicationid' => 'abc',
- 'name' => 'id not number'
- ]
- ],
- 'expected_error' => 'Invalid parameter "/1/applicationid": a number is expected.'
- ],
- [
- 'application' => [
- [
- 'applicationid' => '0.0',
- 'name' => 'invalid application id'
- ]
- ],
- 'expected_error' => 'Invalid parameter "/1/applicationid": a number is expected.'
- ],
- [
- 'application' => [
- [
- 'applicationid' => '367',
- 'name' => 'update the same application id1'
- ],
- [
- 'applicationid' => '367',
- 'name' => 'update the same application id2'
- ]
- ],
- 'expected_error' => 'Invalid parameter "/2": value (applicationid)=(367) already exists.'
- ],
- // Check templated and discovered applications.
- [
- 'application' => [
- [
- 'applicationid' => '370',
- 'name' => 'Update templated application'
- ]
- ],
- 'expected_error' => 'Cannot update templated applications.'
- ],
- [
- 'application' => [
- [
- 'applicationid' => '375',
- 'name' => 'API discovery application update'
- ]
- ],
- 'expected_error' => 'Cannot update discovered application "API discovery application".'
- ],
- // Check application name.
- [
- 'application' => [
- [
- 'applicationid' => '367',
- 'name' => ''
- ]
- ],
- 'expected_error' => 'Invalid parameter "/1/name": cannot be empty.'
- ],
- [
- 'application' => [
- [
- 'applicationid' => '367',
- 'name' => 'Suspendisse sagittis euismod consequat. Vivamus pretium, lectus vitae lacinia sodales, metus nisi viverra lectus, vel fermentum dui eros et est. Mauris vitae velit ac massa imperdiet molestie ut sed diam? Quisque vehicula nulla at mauris aliquam, nec condd'
- ]
- ],
- 'expected_error' => 'Invalid parameter "/1/name": value is too long.'
- ],
- // Check name duplicates.
- [
- 'application' => [
- [
- 'applicationid' => '367',
- 'name' => 'API application'
- ]
- ],
- 'expected_error' => 'Application "API application" already exists.'
- ],
- [
- 'application' => [
- [
- 'applicationid' => '367',
- 'name' => 'update two the same application name'
- ],
- [
- 'applicationid' => '371',
- 'name' => 'update two the same application name'
- ]
- ],
- 'expected_error' => 'Invalid parameter "/2": value (hostid, name)=(50009, update two the same application name) already exists.'
- ],
- // Check successfully update.
- [
- 'application' => [
- 'applicationid' => '367',
- 'name' => '☺'
- ],
- 'expected_error' => null
- ],
- [
- 'application' => [
- 'applicationid' => '368',
- 'name' => 'API template application updated'
- ],
- 'expected_error' => null
- ],
- [
- 'application' => [
- 'applicationid' => '367',
- 'name' => 'УТФ-8 обновлённый'
- ],
- 'expected_error' => null
- ]
- ];
- }
-
- /**
- * @dataProvider application_update
- */
- public function testApplication_Update($applications, $expected_error) {
- $result = $this->call('application.update', $applications, $expected_error);
-
- if ($expected_error === null) {
- $dbResult = DBSelect('select * from applications where applicationid='.zbx_dbstr($result['result']['applicationids'][0]));
- $dbRow = DBFetch($dbResult);
- $this->assertEquals($dbRow['applicationid'], $applications['applicationid']);
- $this->assertEquals($dbRow['name'], $applications['name']);
- $this->assertEquals($dbRow['flags'], 0);
- }
- else {
- foreach ($applications as $application) {
- if (array_key_exists('name', $application) && $application['name'] != 'API application'){
- $dbResult = 'select * from applications where name='.zbx_dbstr($application['name']);
- $this->assertEquals(0, CDBHelper::getCount($dbResult));
- }
- }
- }
- }
-
- public static function application_delete() {
- return [
- [
- 'application' => [
- ''
- ],
- 'expected_error' => 'Invalid parameter "/1": a number is expected.'
- ],
- [
- 'application' => [
- '123456'
- ],
- 'expected_error' => 'No permissions to referred object or it does not exist!'
- ],
- [
- 'application' => [
- 'abc'
- ],
- 'expected_error' => 'Invalid parameter "/1": a number is expected.'
- ],
- [
- 'application' => [
- '0.0'
- ],
- 'expected_error' => 'Invalid parameter "/1": a number is expected.'
- ],
- [
- 'application' => [
- '371',
- '123456'
- ],
- 'expected_error' => 'No permissions to referred object or it does not exist!'
- ],
- [
- 'application' => [
- '371',
- '.'
- ],
- 'expected_error' => 'Invalid parameter "/2": a number is expected.'
- ],
- [
- 'application' => [
- '371',
- ''
- ],
- 'expected_error' => 'Invalid parameter "/2": a number is expected.'
- ],
- [
- 'application' => [
- '371',
- '371'
- ],
- 'expected_error' => 'Invalid parameter "/2": value (371) already exists.'
- ],
- [
- 'application' => [
- '370'
- ],
- 'expected_error' => 'Cannot delete templated application.'
- ],
- [
- 'application' => [
- '375'
- ],
- 'expected_error' => 'Cannot delete discovered application "API discovery application".'
- ],
- [
- 'application' => [
- '372'
- ],
- 'expected_error' => null
- ],
- [
- 'application' => [
- '373',
- '374'
- ],
- 'expected_error' => null
- ]
- ];
- }
-
- /**
- * @dataProvider application_delete
- */
- public function testApplication_delete($application, $expected_error) {
- $result = $this->call('application.delete', $application, $expected_error);
-
- if ($expected_error === null) {
- foreach ($result['result']['applicationids'] as $id) {
- $dbResult = 'select * from applications where applicationid='.zbx_dbstr($id);
- $this->assertEquals(0, CDBHelper::getCount($dbResult));
- }
- }
- }
-
- public static function application_get_data() {
- return [
- [
- 'application' => [
- 'applicationids' => '123456'
- ],
- 'get_result' =>[
- ],
- 'expected_error' => true
- ],
- [
- 'application' => [
- 'applicationids' => '374'
- ],
- 'get_result' => [
- 'applicationid' => '374',
- 'hostid' => '50009',
- 'name' => 'API application for items',
- 'flags' => '0',
- 'templateids'=> []
- ],
- 'expected_error' => false
- ],
- [
- 'application' => [
- 'applicationids' => '207'
- ],
- 'get_result' => [
- 'applicationid' => '207',
- 'hostid' => '10001',
- 'name' => 'Zabbix agent',
- 'flags' => '0',
- 'templateids'=> ['206']
- ],
- 'expected_error' => false
- ]
- ];
- }
-
- /**
- * @dataProvider application_get_data
- */
- public function testApplication_get($application, $get_result, $expected_error) {
- $result = $this->call('application.get', $application);
-
- if ($expected_error === false) {
- foreach ($result['result'] as $name) {
- $this->assertEquals($name['applicationid'], $get_result['applicationid']);
- $this->assertEquals($name['hostid'], $get_result['hostid']);
- $this->assertEquals($name['name'], $get_result['name']);
- $this->assertEquals($name['flags'], $get_result['flags']);
- $this->assertEquals($name['templateids'], $get_result['templateids']);
- }
- }
- else {
- $this->assertEquals($result['result'], $get_result);
- }
- }
-
- public static function application_user_permissions() {
- return [
- [
- 'method' => 'application.create',
- 'user' => ['user' => 'zabbix-admin', 'password' => 'zabbix'],
- 'application' => [
- 'name' => 'API host application create as zabbix admin',
- 'hostid' => '10084'
- ],
- 'expected_error' => 'No permissions to referred object or it does not exist!'
- ],
- [
- 'method' => 'application.update',
- 'user' => ['user' => 'zabbix-admin', 'password' => 'zabbix'],
- 'application' => [
- 'applicationid' => '376',
- 'name' => 'API application update as zabbix admin'
- ],
- 'expected_error' => 'No permissions to referred object or it does not exist!'
- ],
- [
- 'method' => 'application.delete',
- 'user' => ['user' => 'zabbix-admin', 'password' => 'zabbix'],
- 'application' => [
- '376'
- ],
- 'expected_error' => 'No permissions to referred object or it does not exist!'
- ],
- [
- 'method' => 'application.create',
- 'user' => ['user' => 'zabbix-user', 'password' => 'zabbix'],
- 'application' => [
- 'name' => 'API host application create as zabbix user',
- 'hostid' => '10084'
- ],
- 'expected_error' => 'No permissions to call "application.create".'
- ],
- [
- 'method' => 'application.update',
- 'user' => ['user' => 'zabbix-user', 'password' => 'zabbix'],
- 'application' => [
- 'applicationid' => '376',
- 'name' => 'API application update as zabbix user'
- ],
- 'expected_error' => 'No permissions to call "application.update".'
- ],
- [
- 'method' => 'application.delete',
- 'user' => ['user' => 'zabbix-user', 'password' => 'zabbix'],
- 'application' => [
- '376'
- ],
- 'expected_error' => 'No permissions to call "application.delete".'
- ]
- ];
- }
-
- /**
- * @dataProvider application_user_permissions
- */
- public function testApplication_UserPermissions($method, $user, $application, $expected_error) {
- $this->authorize($user['user'], $user['password']);
- $this->call($method, $application, $expected_error);
- }
-}
diff --git a/ui/tests/api_json/testAuditLog.php b/ui/tests/api_json/testAuditLog.php
index 9ec93f16216..d2efc831bb7 100644
--- a/ui/tests/api_json/testAuditLog.php
+++ b/ui/tests/api_json/testAuditLog.php
@@ -781,7 +781,7 @@ class testAuditLog extends CAPITest {
'expected_error' => 'Invalid parameter "/filter/resourcetype/1": value must be one of '.implode(', ', [
AUDIT_RESOURCE_USER, AUDIT_RESOURCE_ZABBIX_CONFIG, AUDIT_RESOURCE_MEDIA_TYPE, AUDIT_RESOURCE_HOST,
AUDIT_RESOURCE_ACTION, AUDIT_RESOURCE_GRAPH, AUDIT_RESOURCE_GRAPH_ELEMENT,
- AUDIT_RESOURCE_USER_GROUP, AUDIT_RESOURCE_APPLICATION, AUDIT_RESOURCE_TRIGGER,
+ AUDIT_RESOURCE_USER_GROUP, AUDIT_RESOURCE_TRIGGER,
AUDIT_RESOURCE_HOST_GROUP, AUDIT_RESOURCE_ITEM, AUDIT_RESOURCE_IMAGE, AUDIT_RESOURCE_VALUE_MAP,
AUDIT_RESOURCE_IT_SERVICE, AUDIT_RESOURCE_MAP, AUDIT_RESOURCE_SCENARIO,
AUDIT_RESOURCE_DISCOVERY_RULE, AUDIT_RESOURCE_SCRIPT, AUDIT_RESOURCE_PROXY,
diff --git a/ui/tests/api_json/testConfiguration.php b/ui/tests/api_json/testConfiguration.php
index 91455e704f8..5be9c8dd935 100644
--- a/ui/tests/api_json/testConfiguration.php
+++ b/ui/tests/api_json/testConfiguration.php
@@ -74,17 +74,6 @@ class testConfiguration extends CAPITest {
[
'export' => [
'options' => [
- 'applications' => [
- '366'
- ]
- ],
- 'format' => 'xml'
- ],
- 'expected_error' => 'Invalid parameter "/options": unexpected parameter "applications".'
- ],
- [
- 'export' => [
- 'options' => [
'groups' => [
'50009'
],
@@ -402,11 +391,6 @@ class testConfiguration extends CAPITest {
public static function import_rules_parameters() {
return [
[[
- 'parameter' => 'applications',
- 'expected' => ['createMissing', 'deleteMissing'],
- 'unexpected' => ['updateExisting']
- ]],
- [[
'parameter' => 'discoveryRules',
'expected' => ['createMissing', 'deleteMissing', 'updateExisting'],
'unexpected' => []
diff --git a/ui/tests/api_json/testDiscoveryRule.php b/ui/tests/api_json/testDiscoveryRule.php
index 178f036bff2..22e05e388da 100644
--- a/ui/tests/api_json/testDiscoveryRule.php
+++ b/ui/tests/api_json/testDiscoveryRule.php
@@ -3462,7 +3462,7 @@ class testDiscoveryRule extends CAPITest {
]
])
],
- 'expected_error' => 'Invalid parameter "/1/overrides/1/operations/1": value must be one of opstatus, opdiscover, opperiod, ophistory, optrends.'
+ 'expected_error' => 'Invalid parameter "/1/overrides/1/operations/1": value must be one of opstatus, opdiscover, opperiod, ophistory, optrends, optag.'
],
// LLD rule override operation status
'Test /1/overrides/1/operations/1/opstatus/status is mandatory.' => [
@@ -4159,26 +4159,6 @@ class testDiscoveryRule extends CAPITest {
],
'expected_error' => 'Invalid parameter "/1/overrides/1/operations/1/optag/1/tag": cannot be empty.'
],
- 'Test /1/overrides/1/operations/1/optag is is not supported for item prototype object.' => [
- 'discoveryrules' => [
- $new_lld_overrides([
- [
- 'name' => 'override',
- 'step' => 1,
- 'operations' => [
- [
- 'operationobject' => OPERATION_OBJECT_ITEM_PROTOTYPE,
- 'operator' => CONDITION_OPERATOR_NOT_REGEXP,
- 'optag' => [
- ['tag' => 'www']
- ]
- ]
- ]
- ]
- ])
- ],
- 'expected_error' => 'Invalid parameter "/1/overrides/1/operations/1": unexpected parameter "optag".'
- ],
'Test /1/overrides/1/operations/1/optag is is not supported for graph prototype object.' => [
'discoveryrules' => [
$new_lld_overrides([
diff --git a/ui/tests/api_json/testItem.php b/ui/tests/api_json/testItem.php
index 9893034dd41..19b558b5c49 100644
--- a/ui/tests/api_json/testItem.php
+++ b/ui/tests/api_json/testItem.php
@@ -95,6 +95,27 @@ class testItem extends CAPITest {
[
'request_data' => [
'hostid' => '50009',
+ 'name' => 'Item with some tags',
+ 'key_' => 'trapper_item_1',
+ 'value_type' => ITEM_VALUE_TYPE_UINT64,
+ 'type' => ITEM_TYPE_TRAPPER,
+ 'delay' => '0',
+ 'tags' => [
+ [
+ 'tag' => 'tag',
+ 'value' => 'value 1'
+ ],
+ [
+ 'tag' => 'tag',
+ 'value' => 'value 2'
+ ]
+ ]
+ ],
+ 'expected_error' => null
+ ],
+ [
+ 'request_data' => [
+ 'hostid' => '50009',
'name' => 'Test mqtt with wrong key and 0 delay',
'key_' => 'mqt.get[5]',
'interfaceid' => '50022',
@@ -145,6 +166,17 @@ class testItem extends CAPITest {
foreach (['hostid', 'name', 'key_', 'type', 'delay'] as $field) {
$this->assertSame($db_item[$field], strval($request_data[$field]));
}
+
+ if (array_key_exists('tags', $request_data)) {
+ $db_tags = DBFetchArray(DBSelect('SELECT tag, value FROM item_tag WHERE itemid='.zbx_dbstr($id)));
+ uasort($request_data['tags'], function ($a, $b) {
+ return strnatcasecmp($a['value'], $b['value']);
+ });
+ uasort($db_tags, function ($a, $b) {
+ return strnatcasecmp($a['value'], $b['value']);
+ });
+ $this->assertTrue(array_values($db_tags) === array_values($request_data['tags']));
+ }
}
}
}
diff --git a/ui/tests/api_json/testMap.php b/ui/tests/api_json/testMap.php
index a95a4d13e87..d08f6ad4559 100644
--- a/ui/tests/api_json/testMap.php
+++ b/ui/tests/api_json/testMap.php
@@ -116,7 +116,8 @@ class testMap extends CAPITest {
'height' => '200',
'viewtype' => '0',
'use_iconmap' => '1',
- 'application' => '',
+ 'evaltype' => TAG_EVAL_TYPE_AND_OR,
+ 'tags' => [],
'urls' => [],
'elements' => [
['sysmapid' => '1']
@@ -180,7 +181,8 @@ class testMap extends CAPITest {
'height' => '200',
'viewtype' => '0',
'use_iconmap' => '1',
- 'application' => '',
+ 'evaltype' => TAG_EVAL_TYPE_AND_OR,
+ 'tags' => [],
'urls' => [],
'elements' => [
['sysmapid' => '1']
@@ -282,7 +284,8 @@ class testMap extends CAPITest {
'height' => '200',
'viewtype' => '0',
'use_iconmap' => '1',
- 'application' => '',
+ 'evaltype' => TAG_EVAL_TYPE_AND_OR,
+ 'tags' => [],
'urls' => [],
'elements' => [
['sysmapid' => '10008']
diff --git a/ui/tests/api_json/testTemplateImport.php b/ui/tests/api_json/testTemplateImport.php
deleted file mode 100644
index a6033c0da46..00000000000
--- a/ui/tests/api_json/testTemplateImport.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/*
-** Zabbix
-** Copyright (C) 2001-2021 Zabbix SIA
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-**/
-
-
-require_once dirname(__FILE__).'/../include/CAPITest.php';
-
-/**
- * @backup applications
- * @backup items
- * @backup hosts
- */
-class testTemplateImport extends CAPITest {
-
- public function testDeleteMissingForLinkedTemplateApplication() {
- $import_tmpl = file_get_contents(dirname(__FILE__).'/xml/testDeleteMissingForLinkedTemplateApplication.xml');
- $import1 = strtr($import_tmpl, ['@application' => 'App X']);
- $import2 = strtr($import_tmpl, ['@application' => 'App Y']);
-
- $rules = [
- 'applications' => [
- 'createMissing' => true
- ],
- 'items' => [
- 'updateExisting' => true,
- 'createMissing' => true
- ],
- 'templateLinkage' => [
- 'createMissing' => true
- ],
- 'templates' => [
- 'updateExisting' => true,
- 'createMissing' => true
- ]
- ];
-
- $this->call('configuration.import', [
- 'format' => 'xml',
- 'source' => $import1,
- 'rules' => $rules
- ], null);
-
- $this->assertNotEquals(0, CDBHelper::getCount('SELECT * FROM applications WHERE name='.zbx_dbstr('App X')));
-
- $rules['applications']['deleteMissing'] = true;
- $this->call('configuration.import', [
- 'format' => 'xml',
- 'source' => $import2,
- 'rules' => $rules
- ], null);
-
- $this->assertEquals(0, CDBHelper::getCount('SELECT * FROM applications WHERE name='.zbx_dbstr('App X')));
- }
-}
diff --git a/ui/tests/api_json/testWebScenario.php b/ui/tests/api_json/testWebScenario.php
index 5d4df931372..448ac09ef22 100644
--- a/ui/tests/api_json/testWebScenario.php
+++ b/ui/tests/api_json/testWebScenario.php
@@ -181,7 +181,6 @@ class testWebScenario extends CAPITest {
'name' => 'api-symbols☺æų""\\//!@#$%^&*()_+',
'hostid' => '50009',
'agent' => 'api-symbols☺æų""\\//!@#$%^&*()_+',
- 'applicationid' => 0,
'authentication' => '2',
'http_user' => 'api-symbols☺æų""\\//!@#$%^&*()_+',
'http_proxy' => 'api-symbols☺æų""\\//!@#$%^&*()_+',
@@ -334,6 +333,35 @@ class testWebScenario extends CAPITest {
]
]],
'expected_error' => null
+ ],
+ [
+ 'httptest' => [[
+ 'name' => 'Http test with some tags',
+ 'hostid' => '50009',
+ 'steps' => [
+ [
+ 'name' => 'Step 1',
+ 'url' => 'http://zabbix.com',
+ 'no' => 0
+ ],
+ [
+ 'name' => 'Step 2',
+ 'url' => 'http://zabbix.com',
+ 'no' => 1
+ ]
+ ],
+ 'tags' => [
+ [
+ 'tag' => 'tag',
+ 'value' => 'value 1'
+ ],
+ [
+ 'tag' => 'tag',
+ 'value' => 'value 2'
+ ]
+ ]
+ ]],
+ 'expected_error' => null
]
];
}
@@ -351,6 +379,28 @@ class testWebScenario extends CAPITest {
$this->assertEquals($db_row_web['name'], $httptests[$key]['name']);
$this->assertEquals($db_row_web['hostid'], $httptests[$key]['hostid']);
+ if (array_key_exists('tags', $httptests[$key])) {
+ // CHeck http test tags.
+ $db_tags = DBFetchArray(DBSelect('SELECT tag, value FROM httptest_tag WHERE httptestid='.zbx_dbstr($id)));
+ uasort($httptests[$key]['tags'], function ($a, $b) {
+ return strnatcasecmp($a['value'], $b['value']);
+ });
+ uasort($db_tags, function ($a, $b) {
+ return strnatcasecmp($a['value'], $b['value']);
+ });
+ $this->assertTrue(array_values($db_tags) === array_values($httptests[$key]['tags']));
+
+ // Check http test item tags.
+ $db_items = DBFetchArray(DBSelect('SELECT itemid FROM httptestitem WHERE httptestid='.zbx_dbstr($id)));
+ foreach ($db_items as $itemid) {
+ $db_tags = DBFetchArray(DBSelect('SELECT tag, value FROM item_tag WHERE itemid='.zbx_dbstr($itemid['itemid'])));
+ uasort($db_tags, function ($a, $b) {
+ return strnatcasecmp($a['value'], $b['value']);
+ });
+ $this->assertTrue(array_values($db_tags) === array_values($httptests[$key]['tags']));
+ }
+ }
+
$db_result_steps = DBSelect('SELECT * FROM httpstep WHERE httptestid='.zbx_dbstr($id).' order by no;');
$db_rows_steps = DBFetchArray($db_result_steps);
$this->assertCount(count($httptests[$key]['steps']), $db_rows_steps);
@@ -367,6 +417,18 @@ class testWebScenario extends CAPITest {
$debug_msg = 'Case, httptest['.$key.']->step['.$no.']->property['.$property_name.']';
$this->assertEquals($expected, $db_step[$property_name], $debug_msg);
}
+
+ // Check http test step item tags.
+ if (array_key_exists('tags', $httptests[$key])) {
+ $db_items = DBFetchArray(DBSelect('SELECT itemid FROM httpstepitem WHERE httpstepid='.zbx_dbstr($db_step['httpstepid'])));
+ foreach ($db_items as $itemid) {
+ $db_tags = DBFetchArray(DBSelect('SELECT tag, value FROM item_tag WHERE itemid='.zbx_dbstr($itemid['itemid'])));
+ uasort($db_tags, function ($a, $b) {
+ return strnatcasecmp($a['value'], $b['value']);
+ });
+ $this->assertTrue(array_values($db_tags) === array_values($httptests[$key]['tags']));
+ }
+ }
}
}
}
@@ -515,7 +577,6 @@ class testWebScenario extends CAPITest {
$dbRow = DBFetch($dbResult);
$this->assertEquals($dbRow['name'], $httptests[$key]['name']);
$this->assertEquals($dbRow['httptestid'], $httptests[$key]['httptestid']);
- $this->assertEquals($dbRow['applicationid'], 0);
$this->assertEquals($dbRow['nextcheck'], 0);
$this->assertEquals($dbRow['delay'], 60);
$this->assertEquals($dbRow['status'], 0);
@@ -575,98 +636,6 @@ class testWebScenario extends CAPITest {
],
'expected_error' => 'Invalid parameter "/1/agent": value is too long.'
],
- // Check web applicationid.
- [
- 'httptest' => [
- 'name' => 'Api web with empty applicationid',
- 'applicationid' => ''
- ],
- 'expected_error' => 'Invalid parameter "/1/applicationid": a number is expected.'
- ],
- [
- 'httptest' => [
- 'name' => 'Api web with nonexistent applicationid',
- 'applicationid' => '123456',
- 'steps' => [
- [
- 'name' => 'Homepage',
- 'url' => 'http://zabbix.com',
- 'no' => 0
- ]
- ]
- ],
- 'expected_error' => 'Application with applicationid "123456" does not exist.'
- ],
- [
- 'httptest' => [
- 'name' => 'Api web with wrong applicationid',
- 'applicationid' => 'test',
- 'steps' => [
- [
- 'name' => 'Homepage',
- 'url' => 'http://zabbix.com',
- 'no' => 0
- ]
- ]
- ],
- 'expected_error' => 'Invalid parameter "/1/applicationid": a number is expected.'
- ],
- [
- 'httptest' => [
- 'name' => 'Api web with wrong applicationid',
- 'applicationid' => '☺æų',
- 'steps' => [
- [
- 'name' => 'Homepage',
- 'url' => 'http://zabbix.com',
- 'no' => 0
- ]
- ]
- ],
- 'expected_error' => 'Invalid parameter "/1/applicationid": a number is expected.'
- ],
- [
- 'httptest' => [
- 'name' => 'Api web with wrong applicationid',
- 'applicationid' => '36.6',
- 'steps' => [
- [
- 'name' => 'Homepage',
- 'url' => 'http://zabbix.com',
- 'no' => 0
- ]
- ]
- ],
- 'expected_error' => 'Invalid parameter "/1/applicationid": a number is expected.'
- ],
- [
- 'httptest' => [
- 'name' => 'Api web with applicationid from another host',
- 'applicationid' => '376',
- 'steps' => [
- [
- 'name' => 'Homepage',
- 'url' => 'http://zabbix.com',
- 'no' => 0
- ]
- ]
- ],
- 'expected_error' => 'The web scenario application belongs to a different host than the web scenario host.'
- ],
- [
- 'httptest' => [
- 'name' => 'Api web with discovered applicationid',
- 'applicationid' => '375',
- 'steps' => [
- [
- 'name' => 'Homepage',
- 'url' => 'http://zabbix.com',
- 'no' => 0
- ]
- ]
- ],
- 'expected_error' => 'Cannot add a discovered application "API discovery application" to a web scenario.'
- ],
// Check web authentication.
[
'httptest' => [
@@ -1509,7 +1478,6 @@ class testWebScenario extends CAPITest {
'httptestid' => '15015',
'name' => 'Webtest key_name_new',
'status' => '1',
- 'applicationid' => '15016',
'steps' => [
[
'httpstepid' => '15015',
@@ -1546,13 +1514,6 @@ class testWebScenario extends CAPITest {
[
'httptest' => [[
'httptestid' => '15015',
- 'applicationid' => '15016'
- ]],
- 'expected_error' => null
- ],
- [
- 'httptest' => [[
- 'httptestid' => '15015',
'steps' => [
[
'httpstepid' => '15015',
@@ -1613,7 +1574,6 @@ class testWebScenario extends CAPITest {
[
'httptest' => [[
'httptestid' => '15015',
- 'applicationid' => '15016',
'steps' => [
[
'httpstepid' => '15015'
@@ -1634,7 +1594,6 @@ class testWebScenario extends CAPITest {
'httptestid' => '15015',
'name' => 'Webtest key_name',
'status' => '0',
- 'applicationid' => '15015',
'steps' => [
[
'httpstepid' => '15015',
@@ -1664,14 +1623,11 @@ class testWebScenario extends CAPITest {
if ($expected_error === null) {
foreach ($result['result']['httptestids'] as $key => $httptestid) {
- $db_httptest = CDBHelper::getRow('SELECT httptestid, name, applicationid FROM httptest WHERE httptestid='.zbx_dbstr($httptestid));
+ $db_httptest = CDBHelper::getRow('SELECT httptestid, name FROM httptest WHERE httptestid='.zbx_dbstr($httptestid));
if (array_key_exists('name', $httptests[$key])) {
$this->assertEquals($httptests[$key]['name'], $db_httptest['name']);
}
- if (array_key_exists('applicationid', $httptests[$key])) {
- $this->assertEquals($httptests[$key]['applicationid'], $db_httptest['applicationid']);
- }
$db_httptest_items = CDBHelper::getAll(
'SELECT i.itemid, i.name, i.key_, i.status'.
@@ -1681,8 +1637,6 @@ class testWebScenario extends CAPITest {
$this->assertCount(3, $db_httptest_items,
'Incorrect item count for web scenario [httpstepid='.$httptestid.'].');
- $application_itemids = array_flip(array_column($db_httptest_items, 'itemid'));
-
foreach ($db_httptest_items as $db_httptest_item) {
$this->assertContains('"'.$db_httptest['name'].'"', $db_httptest_item['name']);
$this->assertRegExp('/\['.preg_quote($db_httptest['name'],'/').'[,\]]/',
@@ -1720,8 +1674,6 @@ class testWebScenario extends CAPITest {
' WHERE '.dbConditionInt('hsi.httpstepid', $db_httpstepids)
);
- $application_itemids += array_flip(array_column($db_httpstep_items, 'itemid'));
-
foreach ($db_httpstep_items as $db_httpstep_item) {
$db_httpsteps[$db_httpstep_item['httpstepid']]['db_items'][] = $db_httpstep_item;
}
@@ -1746,18 +1698,6 @@ class testWebScenario extends CAPITest {
}
}
}
-
- if (array_key_exists('applicationid', $httptests[$key])) {
- $db_applicationids_count = CDBHelper::getCount(
- 'SELECT NULL'.
- ' FROM items_applications ia'.
- ' WHERE '.dbConditionInt('ia.itemid', array_keys($application_itemids)).
- ' AND '.dbConditionInt('ia.applicationid', [$httptests[$key]['applicationid']])
- );
-
- $this->assertCount($db_applicationids_count, $application_itemids,
- 'Application not updated for some items.');
- }
}
}
}
diff --git a/ui/tests/api_json/xml/testDeleteMissingForLinkedTemplateApplication.xml b/ui/tests/api_json/xml/testDeleteMissingForLinkedTemplateApplication.xml
deleted file mode 100644
index 2f4785d09fa..00000000000
--- a/ui/tests/api_json/xml/testDeleteMissingForLinkedTemplateApplication.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<zabbix_export>
- <version>4.0</version>
- <date>2020-03-20T09:47:39Z</date>
- <groups>
- <group>
- <name>Zabbix servers</name>
- </group>
- </groups>
- <templates>
- <template>
- <template>Template A</template>
- <name>Template A</name>
- <description/>
- <groups>
- <group>
- <name>Zabbix servers</name>
- </group>
- </groups>
- <applications/>
- <items/>
- <discovery_rules/>
- <httptests/>
- <macros/>
- <templates>
- <template>
- <name>Template B</name>
- </template>
- </templates>
- </template>
- <template>
- <template>Template B</template>
- <name>Template B</name>
- <description/>
- <groups>
- <group>
- <name>Zabbix servers</name>
- </group>
- </groups>
- <applications>
- <application>
- <name>@application</name>
- </application>
- </applications>
- <items>
- <item>
- <name>a</name>
- <type>0</type>
- <snmp_community/>
- <snmp_oid/>
- <key>a</key>
- <delay>30s</delay>
- <history>90d</history>
- <trends>365d</trends>
- <status>0</status>
- <value_type>3</value_type>
- <allowed_hosts/>
- <units/>
- <snmpv3_contextname/>
- <snmpv3_securityname/>
- <snmpv3_securitylevel>0</snmpv3_securitylevel>
- <snmpv3_authprotocol>0</snmpv3_authprotocol>
- <snmpv3_authpassphrase/>
- <snmpv3_privprotocol>0</snmpv3_privprotocol>
- <snmpv3_privpassphrase/>
- <params/>
- <ipmi_sensor/>
- <authtype>0</authtype>
- <username/>
- <password/>
- <publickey/>
- <privatekey/>
- <port/>
- <description/>
- <inventory_link>0</inventory_link>
- <applications>
- <application>
- <name>@application</name>
- </application>
- </applications>
- <valuemap/>
- <logtimefmt/>
- <preprocessing/>
- <jmx_endpoint/>
- <timeout>3s</timeout>
- <url/>
- <query_fields/>
- <posts/>
- <status_codes>200</status_codes>
- <follow_redirects>1</follow_redirects>
- <post_type>0</post_type>
- <http_proxy/>
- <headers/>
- <retrieve_mode>0</retrieve_mode>
- <request_method>0</request_method>
- <output_format>0</output_format>
- <allow_traps>0</allow_traps>
- <ssl_cert_file/>
- <ssl_key_file/>
- <ssl_key_password/>
- <verify_peer>0</verify_peer>
- <verify_host>0</verify_host>
- <master_item/>
- </item>
- </items>
- <discovery_rules/>
- <httptests/>
- <macros/>
- <templates/>
- </template>
- </templates>
-</zabbix_export>
diff --git a/ui/tests/selenium/SeleniumTests.php b/ui/tests/selenium/SeleniumTests.php
index a7a53b61837..ced63e45e0e 100644
--- a/ui/tests/selenium/SeleniumTests.php
+++ b/ui/tests/selenium/SeleniumTests.php
@@ -126,6 +126,8 @@ require_once dirname(__FILE__).'/testFormSysmap.php';
require_once dirname(__FILE__).'/testFormTabIndicators.php';
require_once dirname(__FILE__).'/testFormTagsHost.php';
require_once dirname(__FILE__).'/testFormTagsHostPrototype.php';
+require_once dirname(__FILE__).'/testFormTagsItem.php';
+require_once dirname(__FILE__).'/testFormTagsItemPrototype.php';
require_once dirname(__FILE__).'/testFormTagsTemplate.php';
require_once dirname(__FILE__).'/testFormTagsTrigger.php';
require_once dirname(__FILE__).'/testFormTagsTriggerPrototype.php';
@@ -139,10 +141,7 @@ require_once dirname(__FILE__).'/testFormValueMappingsHost.php';
require_once dirname(__FILE__).'/testFormValueMappingsTemplate.php';
require_once dirname(__FILE__).'/testFormWeb.php';
require_once dirname(__FILE__).'/testFormWebStep.php';
-require_once dirname(__FILE__).'/testFormApplication.php';
-require_once dirname(__FILE__).'/testPageApplications.php';
require_once dirname(__FILE__).'/testPageBrowserWarning.php';
-require_once dirname(__FILE__).'/testInheritanceApplication.php';
require_once dirname(__FILE__).'/testInheritanceItem.php';
require_once dirname(__FILE__).'/testInheritanceTrigger.php';
require_once dirname(__FILE__).'/testInheritanceGraph.php';
@@ -284,6 +283,8 @@ class SeleniumTests {
$suite->addTestSuite('testFormTabIndicators');
$suite->addTestSuite('testFormTagsHost');
$suite->addTestSuite('testFormTagsHostPrototype');
+ $suite->addTestSuite('testFormTagsItem');
+ $suite->addTestSuite('testFormTagsItemPrototype');
$suite->addTestSuite('testFormTagsTemplate');
$suite->addTestSuite('testFormTagsTrigger');
$suite->addTestSuite('testFormTagsTriggerPrototype');
@@ -297,10 +298,7 @@ class SeleniumTests {
$suite->addTestSuite('testFormValueMappingsTemplate');
$suite->addTestSuite('testFormWeb');
$suite->addTestSuite('testFormWebStep');
- $suite->addTestSuite('testFormApplication');
- $suite->addTestSuite('testPageApplications');
$suite->addTestSuite('testPageBrowserWarning');
- $suite->addTestSuite('testInheritanceApplication');
$suite->addTestSuite('testInheritanceItem');
$suite->addTestSuite('testInheritanceTrigger');
$suite->addTestSuite('testInheritanceGraph');
diff --git a/ui/tests/selenium/common/testFormTags.php b/ui/tests/selenium/common/testFormTags.php
index 8978b4cbb46..2e2c1e9f0d0 100644
--- a/ui/tests/selenium/common/testFormTags.php
+++ b/ui/tests/selenium/common/testFormTags.php
@@ -124,9 +124,8 @@ class testFormTags extends CWebTest {
'value' => 'value1'
]
],
- 'error_details' => 'Invalid parameter "/tags/1/tag": cannot be empty.',
- 'trigger_error_details' => 'Invalid parameter "/1/tags/1/tag": cannot be empty.',
- 'host_prototype_error_details' => 'Invalid parameter "/1/tags/1/tag": cannot be empty.'
+ 'host_and_template_error_details' => 'Invalid parameter "/tags/1/tag": cannot be empty.',
+ 'error_details' => 'Invalid parameter "/1/tags/1/tag": cannot be empty.'
]
],
[
@@ -145,9 +144,8 @@ class testFormTags extends CWebTest {
'value' => 'value'
]
],
- 'error_details' => 'Invalid parameter "/tags/2": value (tag, value)=(tag, value) already exists.',
- 'trigger_error_details' => 'Invalid parameter "/1/tags/2": value (tag, value)=(tag, value) already exists.',
- 'host_prototype_error_details' => 'Invalid parameter "/1/tags/2": value (tag, value)=(tag, value) already exists.'
+ 'host_and_template_error_details' => 'Invalid parameter "/tags/2": value (tag, value)=(tag, value) already exists.',
+ 'error_details' => 'Invalid parameter "/1/tags/2": value (tag, value)=(tag, value) already exists.'
]
],
[
@@ -186,20 +184,32 @@ class testFormTags extends CWebTest {
* Check create host, template, trigger or prototype with tags.
*
* @param arary $data data provider
- * @param string $object host, template, trigger or prototype
+ * @param string $object host, template, trigger, item or prototype
* @param string $expression trigger or trigger prototype expression
*/
public function checkTagsCreate($data, $object, $expression = null) {
$sql = null;
$old_hash = null;
- if ($object === 'trigger' || $object === 'trigger prototype') {
- $sql = 'SELECT * FROM triggers ORDER BY triggerid';
- $locator = 'name:triggersForm';
- }
- else {
- $sql = 'SELECT * FROM hosts ORDER BY hostid';
- $locator = ($object === 'host prototype') ? 'name:hostPrototypeForm' : 'name:'.$object.'sForm';
+ switch ($object) {
+ case 'trigger':
+ case 'trigger prototype':
+ $sql = 'SELECT * FROM triggers ORDER BY triggerid';
+ $locator = 'name:triggersForm';
+ $fields = ['Name' => $data['name'], 'Expression' => $expression];
+ break;
+
+ case 'item':
+ case 'item prototype':
+ $sql = 'SELECT * FROM items ORDER BY itemid';
+ $locator = 'name:itemForm';
+ $fields = ['Name' => $data['name'], 'Key' => 'itemtag_'.microtime(true)];
+ break;
+
+ default:
+ $sql = 'SELECT * FROM hosts ORDER BY hostid';
+ $locator = ($object === 'host prototype') ? 'name:hostPrototypeForm' : 'name:'.$object.'sForm';
+ $fields = [ucfirst($object).' name' => $data['name'], 'Groups' => 'Zabbix servers'];
}
if (CTestArrayHelper::get($data, 'expected', TEST_GOOD) === TEST_BAD) {
@@ -210,10 +220,6 @@ class testFormTags extends CWebTest {
$this->query('button:Create '.$object)->waitUntilClickable()->one()->click();
$form = $this->query($locator)->waitUntilPresent()->asForm()->one();
- $fields = ($object === 'host' || $object === 'template')
- ? [ucfirst($object).' name' => $data['name'], 'Groups' => 'Zabbix servers']
- : ['Name' => $data['name'], 'Expression' => $expression];
-
if ($object === 'host prototype') {
$data['name'] = $data['name'].' {#KEY}';
$form->fill(['Host name' => $data['name']]);
@@ -253,9 +259,8 @@ class testFormTags extends CWebTest {
'value' => 'value1'
]
],
- 'error_details' => 'Invalid parameter "/tags/1/tag": cannot be empty.',
- 'trigger_error_details'=>'Invalid parameter "/1/tags/1/tag": cannot be empty.',
- 'host_prototype_error_details' => 'Invalid parameter "/1/tags/1/tag": cannot be empty.'
+ 'host_and_template_error_details' => 'Invalid parameter "/tags/1/tag": cannot be empty.',
+ 'error_details'=>'Invalid parameter "/1/tags/1/tag": cannot be empty.'
]
],
[
@@ -269,9 +274,8 @@ class testFormTags extends CWebTest {
'value' => 'update'
]
],
- 'error_details' => 'Invalid parameter "/tags/2": value (tag, value)=(action, update) already exists.',
- 'trigger_error_details' => 'Invalid parameter "/1/tags/2": value (tag, value)=(action, update) already exists.',
- 'host_prototype_error_details' => 'Invalid parameter "/1/tags/2": value (tag, value)=(action, update) already exists.'
+ 'host_and_template_error_details' => 'Invalid parameter "/tags/2": value (tag, value)=(action, update) already exists.',
+ 'error_details' => 'Invalid parameter "/1/tags/2": value (tag, value)=(action, update) already exists.'
]
],
[
@@ -339,13 +343,22 @@ class testFormTags extends CWebTest {
$sql = null;
$old_hash = null;
- if ($object === 'trigger' || $object === 'trigger prototype') {
- $sql = 'SELECT * FROM triggers ORDER BY triggerid';
- $locator = 'name:triggersForm';
- }
- else {
- $sql = 'SELECT * FROM hosts ORDER BY hostid';
- $locator = ($object === 'host prototype') ? 'name:hostPrototypeForm' : 'name:'.$object.'sForm';
+ switch ($object) {
+ case 'trigger':
+ case 'trigger prototype':
+ $sql = 'SELECT * FROM triggers ORDER BY triggerid';
+ $locator = 'name:triggersForm';
+ break;
+
+ case 'item':
+ case 'item prototype':
+ $sql = 'SELECT * FROM items ORDER BY itemid';
+ $locator = 'name:itemForm';
+ break;
+
+ default:
+ $sql = 'SELECT * FROM hosts ORDER BY hostid';
+ $locator = ($object === 'host prototype') ? 'name:hostPrototypeForm' : 'name:'.$object.'sForm';
}
if (CTestArrayHelper::get($data, 'expected', TEST_GOOD) === TEST_BAD) {
@@ -368,7 +381,7 @@ class testFormTags extends CWebTest {
* Check result after creating or updating object with tags.
*
* @param arary $data data provider
- * @param string $object host, template, trigger or prototype
+ * @param string $object host, template, trigger, item or prototype
* @param element $form object configuration form
* @param string $action create or update object
* @param string $sql selected table from db
@@ -376,36 +389,36 @@ class testFormTags extends CWebTest {
*/
private function checkResult($data, $object, $form, $action, $sql = null, $old_hash = null) {
if (CTestArrayHelper::get($data, 'expected', TEST_GOOD) === TEST_BAD) {
+ $error_details = ($object === 'host' || $object === 'template')
+ ? CTestArrayHelper::get($data, 'host_and_template_error_details')
+ : CTestArrayHelper::get($data, 'error_details');
$title = ($action === 'add') ? 'Cannot add '.$object : 'Cannot update '.$object;
+ $this->assertMessage(TEST_BAD, $title, $error_details);
+ // Check that DB hash is not changed.
+ $this->assertEquals($old_hash, CDBHelper::getHash($sql));
+ }
+ else {
switch ($object) {
case 'host':
case 'template':
- $error_details = $data['error_details'];
+ case 'host prototype':
+ $success_sql = 'SELECT NULL FROM hosts WHERE host='.zbx_dbstr($data['name']);
break;
case 'trigger':
case 'trigger prototype':
- $error_details = $data['trigger_error_details'];
+ $success_sql = 'SELECT NULL FROM triggers WHERE description='.zbx_dbstr($data['name']);
break;
- case 'host prototype':
- $error_details = $data['host_prototype_error_details'];
+ case 'item':
+ case 'item prototype':
+ $success_sql = 'SELECT NULL FROM items WHERE name='.zbx_dbstr($data['name']);
break;
}
- $this->assertMessage(TEST_BAD, $title, $error_details);
- // Check that DB hash is not changed.
- $this->assertEquals($old_hash, CDBHelper::getHash($sql));
- }
- else {
$title = ($action === 'add') ? ucfirst($object).' added' : ucfirst($object).' updated';
$this->assertMessage(TEST_GOOD, $title);
-
- $success_sql = ($object === 'trigger' || $object === 'trigger prototype')
- ? 'SELECT NULL FROM triggers WHERE description='.zbx_dbstr($data['name'])
- : 'SELECT NULL FROM hosts WHERE host='.zbx_dbstr($data['name']);
-
$this->assertEquals(1, CDBHelper::getCount($success_sql));
// Check the results in form.
$this->checkTagFields($data, $object, $form);
@@ -429,6 +442,16 @@ class testFormTags extends CWebTest {
case 'trigger prototype':
$form = $this->query('name:triggersForm')->asForm()->waitUntilPresent()->one();
$form->fill(['Name' => $new_name]);
+ $sql_old_name = 'SELECT NULL FROM triggers WHERE description='.zbx_dbstr($this->clone_name);
+ $sql_new_name = 'SELECT NULL FROM triggers WHERE description='.zbx_dbstr($new_name);
+ break;
+
+ case 'item':
+ case 'item prototype':
+ $form = $this->query('name:itemForm')->asForm()->waitUntilPresent()->one();
+ $form->fill(['Name' => $new_name, 'Key' => 'newkey_'.microtime(true)]);
+ $sql_old_name = 'SELECT NULL FROM items WHERE name='.zbx_dbstr($this->clone_name);
+ $sql_new_name = 'SELECT NULL FROM items WHERE name='.zbx_dbstr($new_name);
break;
case 'host':
@@ -436,11 +459,15 @@ class testFormTags extends CWebTest {
$form_name = ($object === 'host prototype') ? 'name:hostPrototypeForm' : 'name:hostsForm';
$form = $this->query($form_name)->asForm()->waitUntilPresent()->one();
$form->fill(['Host name' => $new_name]);
+ $sql_old_name = 'SELECT NULL FROM hosts WHERE host='.zbx_dbstr($this->clone_name);
+ $sql_new_name = 'SELECT NULL FROM hosts WHERE host='.zbx_dbstr($new_name);
break;
case 'template':
$form = $this->query('name:templatesForm')->asForm()->waitUntilPresent()->one();
$form->fill(['Template name' => $new_name]);
+ $sql_old_name = 'SELECT NULL FROM hosts WHERE host='.zbx_dbstr($this->clone_name);
+ $sql_new_name = 'SELECT NULL FROM hosts WHERE host='.zbx_dbstr($new_name);
break;
}
@@ -455,16 +482,7 @@ class testFormTags extends CWebTest {
$this->assertMessage(TEST_GOOD, ucfirst($object).' added');
// Check the results in DB.
- $sql_old_name = ($object === 'trigger' || $object === 'trigger prototype')
- ? 'SELECT NULL FROM triggers WHERE description='.zbx_dbstr($this->clone_name)
- : 'SELECT NULL FROM hosts WHERE host='.zbx_dbstr($this->clone_name);
-
$this->assertEquals(1, CDBHelper::getCount($sql_old_name));
-
- $sql_new_name = ($object === 'trigger' || $object === 'trigger prototype')
- ? 'SELECT NULL FROM triggers WHERE description='.zbx_dbstr($new_name)
- : 'SELECT NULL FROM hosts WHERE host='.zbx_dbstr($new_name);
-
$this->assertEquals(1, CDBHelper::getCount($sql_new_name));
// Check created clone.
@@ -483,6 +501,8 @@ class testFormTags extends CWebTest {
case 'trigger prototype':
case 'trigger':
+ case 'item prototype':
+ case 'item':
$this->assertEquals($new_name, $form->getField('Name')->getValue());
break;
}
@@ -495,13 +515,19 @@ class testFormTags extends CWebTest {
* Function for checking saved tag fields in form.
*
* @param arary $data data provider
- * @param string $object host, template, trigger or prototype
+ * @param string $object host, template, trigger, item or prototype
* @param string $form object configuration form
*/
private function checkTagFields($data, $object, $form) {
- $id = ($object === 'trigger' || $object === 'trigger prototype')
- ? CDBHelper::getValue('SELECT triggerid FROM triggers WHERE description='.zbx_dbstr($data['name']))
- : CDBHelper::getValue('SELECT hostid FROM hosts WHERE host='.zbx_dbstr($data['name']));
+ if ($object === 'trigger' || $object === 'trigger prototype') {
+ $id = CDBHelper::getValue('SELECT triggerid FROM triggers WHERE description='.zbx_dbstr($data['name']));
+ }
+ elseif ($object === 'item' || $object === 'item prototype') {
+ $id = CDBHelper::getValue('SELECT itemid FROM items WHERE name='.zbx_dbstr($data['name']));
+ }
+ else {
+ $id = CDBHelper::getValue('SELECT hostid FROM hosts WHERE host='.zbx_dbstr($data['name']));
+ }
$this->page->open($this->saved_link.$id);
$form->selectTab('Tags');
diff --git a/ui/tests/selenium/dashboard/testDashboardCopyWidgets.php b/ui/tests/selenium/dashboard/testDashboardCopyWidgets.php
index 33db04ad130..34db2ae6055 100644
--- a/ui/tests/selenium/dashboard/testDashboardCopyWidgets.php
+++ b/ui/tests/selenium/dashboard/testDashboardCopyWidgets.php
@@ -35,8 +35,8 @@ class testDashboardCopyWidgets extends CWebTest {
* Data provider for copying widgets.
*/
public static function getCopyWidgetsData() {
- return CDBHelper::getDataProvider('SELECT * FROM widget w '.
- 'WHERE EXISTS ('.
+ return CDBHelper::getDataProvider('SELECT * FROM widget w'.
+ ' WHERE EXISTS ('.
'SELECT NULL'.
' FROM dashboard_page dp'.
' WHERE w.dashboard_pageid=dp.dashboard_pageid'.
@@ -151,8 +151,8 @@ class testDashboardCopyWidgets extends CWebTest {
$dashboard->save();
$this->page->waitUntilReady();
- $copied_widget_size = CDBHelper::getRow('SELECT w.width, w.height '.
- 'FROM widget w WHERE EXISTS ('.
+ $copied_widget_size = CDBHelper::getRow('SELECT w.width, w.height'.
+ ' FROM widget w WHERE EXISTS ('.
'SELECT NULL'.
' FROM dashboard_page dp'.
' WHERE w.dashboard_pageid=dp.dashboard_pageid'.
diff --git a/ui/tests/selenium/dashboard/testDashboardGraphPrototypeWidget.php b/ui/tests/selenium/dashboard/testDashboardGraphPrototypeWidget.php
index 2b9171aa808..807c2ce19e0 100644
--- a/ui/tests/selenium/dashboard/testDashboardGraphPrototypeWidget.php
+++ b/ui/tests/selenium/dashboard/testDashboardGraphPrototypeWidget.php
@@ -351,7 +351,7 @@ class testDashboardGraphPrototypeWidget extends CWebTest {
sleep(1);
$screenshot_area = $this->query('class:dashboard-grid')->one();
$screenshot_area->query('xpath:.//div[contains(@class, "dashboard-grid-iterator-focus")]')->waitUntilNotVisible();
-// $this->assertScreenshot($screenshot_area, $data['screenshot_id']);
+ $this->assertScreenshot($screenshot_area, $data['screenshot_id']);
}
private function checkGraphPrototypeWidget($data, $update = false) {
diff --git a/ui/tests/selenium/dashboard/testDashboardProblemsBySeverityWidget.php b/ui/tests/selenium/dashboard/testDashboardProblemsBySeverityWidget.php
index c0af613f7a1..5fb4420c02f 100644
--- a/ui/tests/selenium/dashboard/testDashboardProblemsBySeverityWidget.php
+++ b/ui/tests/selenium/dashboard/testDashboardProblemsBySeverityWidget.php
@@ -568,8 +568,8 @@ class testDashboardProblemsBySeverityWidget extends CWebTest {
'pages' => [
[
'name' => 'Test Dashboard Page',
- 'display_period' => 1800,
- 'widgets' => array_values($widgets)
+ 'display_period' => 1800,
+ 'widgets' => array_values($widgets)
]
]
]);
diff --git a/ui/tests/selenium/data/data_test.sql b/ui/tests/selenium/data/data_test.sql
index f393dfa6465..e382a44d5c2 100644
--- a/ui/tests/selenium/data/data_test.sql
+++ b/ui/tests/selenium/data/data_test.sql
@@ -75,10 +75,10 @@ INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) V
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (503, 9, 20, 0, '20000');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (504, 10, 16, 11, '');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (505, 11, 16, 11, '');
-INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (507, 12, 16, 10, '');
-INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (508, 12, 15, 3, 'PostgreSQL');
-INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (509, 12, 15, 2, 'MYSQL');
-INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (510, 12, 15, 0, 'MySQL');
+INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value, value2) VALUES (507, 12, 26, 3, 'PostgreSQL', 'Database');
+INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value, value2) VALUES (508, 12, 26, 2, 'MYSQL', 'Database');
+INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value2) VALUES (509, 12, 26, 0, 'MySQL');
+INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (510, 12, 16, 10, '');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (511, 12, 13, 1, '10081');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (512, 12, 13, 0, '10001');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (513, 12, 6, 7, '6-7,08:00-18:00');
@@ -96,10 +96,10 @@ INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) V
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (527, 12, 1, 0, '10084');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (528, 12, 0, 1, '4');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (529, 12, 0, 0, '2');
-INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (530, 13, 16, 11, '');
-INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (532, 13, 15, 3, 'PostgreSQL');
-INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (533, 13, 15, 2, 'MYSQL');
-INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (534, 13, 15, 0, 'MySQL');
+INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value, value2) VALUES (530, 13, 26, 3, 'PostgreSQL', 'Database');
+INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value, value2) VALUES (531, 13, 26, 2, 'MYSQL', 'Database');
+INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value2) VALUES (532, 13, 26, 0, 'MySQL');
+INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (533, 13, 16, 11, '');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (535, 13, 13, 1, '10081');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (536, 13, 13, 0, '10001');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (537, 13, 6, 7, '6-7,08:00-18:00');
@@ -117,10 +117,10 @@ INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) V
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (551, 13, 1, 0, '10084');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (552, 13, 0, 1, '4');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (553, 13, 0, 0, '2');
-INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (554, 14, 16, 11, '');
-INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (556, 14, 15, 3, 'PostgreSQL');
-INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (557, 14, 15, 2, 'MYSQL');
-INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (558, 14, 15, 0, 'MySQL');
+INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value, value2) VALUES (554, 14, 26, 3, 'PostgreSQL', 'Database');
+INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value, value2) VALUES (555, 14, 26, 2, 'MYSQL', 'Database');
+INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value2) VALUES (556, 14, 26, 0, 'MySQL');
+INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (557, 14, 16, 11, '');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (559, 14, 13, 1, '10081');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (560, 14, 13, 0, '10001');
INSERT INTO conditions (conditionid, actionid, conditiontype, operator, value) VALUES (561, 14, 6, 7, '6-7,08:00-18:00');
@@ -434,23 +434,6 @@ INSERT INTO auditlog (auditid, userid, clock, action, resourcetype, note, ip, re
-- delete action
INSERT INTO auditlog (auditid, userid, clock, action, resourcetype, note, ip, resourceid, resourcename) VALUES (524, 1, 1411543800, 2, 5, 'Actions [11] deleted', '192.168.3.32', 11, 'Action deleted');
--- add application
-INSERT INTO auditlog (auditid, userid, clock, action, resourcetype, note, ip, resourceid, resourcename) VALUES (525, 1, 1411543800, 0, 12, 'Application [App1 ] [177]', '192.168.3.32', 0, '');
-
--- update application
-INSERT INTO auditlog (auditid, userid, clock, action, resourcetype, note, ip, resourceid, resourcename) VALUES (526, 1, 1411543800, 1, 12, 'Application [App1 updated ] []', '192.168.3.32', 0, '');
-
--- disable application (work in the same way as update app- disable all items on this host), such records do not exist at this moment
-INSERT INTO auditlog (auditid, userid, clock, action, resourcetype, note, ip, resourceid, resourcename) VALUES (527, 1, 1411543800, 1, 12, '0', '192.168.3.32', 22165, 'test_item');
-INSERT INTO auditlog_details (auditdetailid, auditid, table_name, field_name, oldvalue, newvalue) VALUES (508, 527, 'items', 'status', '0', '1');
-
--- enable application (work in the same way as update app- disable all items on this host), such records do not exist at this moment
-INSERT INTO auditlog (auditid, userid, clock, action, resourcetype, note, ip, resourceid, resourcename) VALUES (528, 1, 1411543800, 1, 12, '0', '192.168.3.32', 22165, 'test_item');
-INSERT INTO auditlog_details (auditdetailid, auditid, table_name, field_name, oldvalue, newvalue) VALUES (509, 528, 'items', 'status', '1', '0');
-
--- delete application
-INSERT INTO auditlog (auditid, userid, clock, action, resourcetype, note, ip, resourceid, resourcename) VALUES (529, 1, 1411543800, 2, 12, 'Application [App1] from host [H1]', '192.168.3.32', 0, '');
-
-- add graph
INSERT INTO auditlog (auditid, userid, clock, action, resourcetype, note, ip, resourceid, resourcename) VALUES (530, 1, 1411543800, 0, 6, 'Graph [graph1]', '192.168.3.32', 0, '');
@@ -1180,13 +1163,6 @@ INSERT INTO hosts_groups (hostgroupid, hostid, groupid) VALUES (50002, 50001, 4)
INSERT INTO hosts_templates (hosttemplateid, hostid, templateid) VALUES (50000, 50001, 50002);
INSERT INTO hosts_templates (hosttemplateid, hostid, templateid) VALUES (50002, 50000, 50002);
INSERT INTO interface (type, ip, dns, useip, port, main, hostid, interfaceid) VALUES (1, '127.0.7.1', '', '1', '10071', '1', 50001, 50015);
-INSERT INTO applications (applicationid,hostid,name) VALUES (359,50000,'App ZBX6663 First');
-INSERT INTO applications (applicationid,hostid,name) VALUES (362,50000,'App ZBX6663 Second');
-INSERT INTO applications (applicationid,hostid,name) VALUES (360,50001,'App ZBX6663');
-INSERT INTO applications (applicationid,hostid,name) VALUES (365,50001,'App ZBX6663 Second');
-INSERT INTO applications (applicationid,hostid,name) VALUES (361,50002,'App ZBX6663 Second');
-INSERT INTO application_template (application_templateid,applicationid,templateid) VALUES (50,365,361);
-INSERT INTO application_template (application_templateid,applicationid,templateid) VALUES (51,362,361);
INSERT INTO items (itemid,type,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,logtimefmt,templateid,valuemapid,params,ipmi_sensor,authtype,username,password,publickey,privatekey,flags,interfaceid,description,inventory_link,lifetime,posts,headers) VALUES (40008,9,50000,'Download speed for scenario "$1".','web.test.in[Web ZBX6663 First,,bps]','60s','30d','90d',0,0,'','Bps','',NULL,NULL,'','',0,'','','','',0,NULL,'',0,'30','','');
INSERT INTO items (itemid,type,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,logtimefmt,templateid,valuemapid,params,ipmi_sensor,authtype,username,password,publickey,privatekey,flags,interfaceid,description,inventory_link,lifetime,posts,headers) VALUES (40009,9,50000,'Failed step of scenario "$1".','web.test.fail[Web ZBX6663 First]','60s','30d','90d',0,3,'','','',NULL,NULL,'','',0,'','','','',0,NULL,'',0,'30','','');
INSERT INTO items (itemid,type,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,logtimefmt,templateid,valuemapid,params,ipmi_sensor,authtype,username,password,publickey,privatekey,flags,interfaceid,description,inventory_link,lifetime,posts,headers) VALUES (40010,9,50000,'Last error message of scenario "$1".','web.test.error[Web ZBX6663 First]','60s','30d','90d',0,1,'','','',NULL,NULL,'','',0,'','','','',0,NULL,'',0,'30','','');
@@ -1399,17 +1375,17 @@ INSERT INTO users_groups (id, usrgrpid, userid) VALUES (107, 7, 93);
INSERT INTO users (userid, username, passwd, autologin, autologout, lang, refresh, roleid, theme, attempt_failed, attempt_clock, rows_per_page) VALUES (94, 'filter-update', '$2y$10$rHPaFkVgIx.ceaZYTlMTiuH9HyCv5M/GXQkrCyQLcK2sdubp303ze', 0, 0, 'default', 30, 3, 'default', 0, 0, 50);
INSERT INTO users_groups (id, usrgrpid, userid) VALUES (108, 7, 94);
-INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (24, 93, 'web.monitoring.problem.properties', 1, 0, 0, '{"hostids":["10084"],"filter_name":"delete_problems_1"}', 3);
-INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (25, 93, 'web.monitoring.problem.properties', 0, 0, 0, '{"filter_name":""}', 3);
-INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (20, 93, 'web.monitoring.hosts.properties', 1, 0, 0, '{"groupids":["4"],"filter_name":"delete_hosts_1"}', 3);
-INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (21, 93, 'web.monitoring.hosts.properties', 0, 0, 0, '{"filter_name":""}', 3);
+INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (24, 93, 'web.monitoring.problem.properties', 0, 0, 0, '{"filter_name":""}', 3);
+INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (25, 93, 'web.monitoring.problem.properties', 1, 0, 0, '{"hostids":["10084"],"filter_name":"delete_problems_1"}', 3);
INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (30, 93, 'web.monitoring.problem.properties', 2, 0, 0, '{"filter_name":"delete_problems_2"}', 3);
+INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (20, 93, 'web.monitoring.hosts.properties', 0, 0, 0, '{"filter_name":""}', 3);
+INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (21, 93, 'web.monitoring.hosts.properties', 1, 0, 0, '{"groupids":["4"],"filter_name":"delete_hosts_1"}', 3);
INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (31, 93, 'web.monitoring.hosts.properties', 2, 0, 0, '{"filter_name":"delete_hosts_2"}', 3);
-INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (26, 94, 'web.monitoring.problem.properties', 1, 0, 0, '{"filter_name":"update_tab","filter_show_counter":1,"show_timeline":"0"}', 3);
-INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (27, 94, 'web.monitoring.problem.properties', 0, 0, 0, '{"filter_name":""}', 3);
-INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (28, 94, 'web.monitoring.hosts.properties', 1, 0, 0, '{"filter_name":"update_tab","filter_show_counter":1}', 3);
-INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (29, 94, 'web.monitoring.hosts.properties', 0, 0, 0, '{"filter_name":""}', 3);
+INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (26, 94, 'web.monitoring.problem.properties', 0, 0, 0, '{"filter_name":""}', 3);
+INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (27, 94, 'web.monitoring.problem.properties', 1, 0, 0, '{"filter_name":"update_tab","filter_show_counter":1,"show_timeline":"0"}', 3);
+INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (28, 94, 'web.monitoring.hosts.properties', 0, 0, 0, '{"filter_name":""}', 3);
+INSERT INTO profiles (profileid, userid, idx, idx2, value_id, value_int, value_str, type) VALUES (29, 94, 'web.monitoring.hosts.properties', 1, 0, 0, '{"filter_name":"update_tab","filter_show_counter":1}', 3);
-- testTimezone
INSERT INTO users (userid, username, passwd, autologin, autologout, lang, refresh, roleid, theme, attempt_failed, attempt_clock, rows_per_page) VALUES (9, 'test-timezone', '$2y$10$TUIJdrXgEUaoCmbOdhiLhe8kWc3M.EE.paOv0rC7bgSP2til3643O', 0, 0, 'default', 30, 3, 'default', 0, 0, 50);
@@ -1433,11 +1409,6 @@ INSERT INTO usrgrp (usrgrpid, name) VALUES (15, 'Selenium user group in configur
INSERT INTO scripts (scriptid, type, name, command, host_access, usrgrpid, groupid, description, scope) VALUES (5, 0, 'Selenium script','test',2,14,NULL,'selenium script description', 1);
UPDATE config SET alert_usrgrpid = 15 WHERE configid = 1;
--- testPageApplication
-INSERT INTO applications (applicationid,hostid,name) VALUES (99000,10084,'Selenium test application');
-INSERT INTO items (itemid, hostid, interfaceid, type, value_type, name, key_, delay, history, status, params, description, flags, posts, headers) VALUES (99000, 10084, 1, 0, 2, 'Selenium item for testPageApplication','item-with-app', '30s', '90d', 0, '', '', 0, '', '');
-INSERT INTO items_applications (itemappid,applicationid,itemid) VALUES (999000,99000,99000);
-
-- Disable warning if Zabbix server is down
UPDATE config SET server_check_interval = 0 WHERE configid = 1;
-- Super admin rows per page
@@ -1755,23 +1726,6 @@ INSERT INTO valuemap (valuemapid, hostid, name) VALUES (5501, 50010, 'Service st
INSERT INTO valuemap_mapping (valuemap_mappingid, valuemapid, value, newvalue) VALUES (55001, 5501, 0, 'Down');
INSERT INTO valuemap_mapping (valuemap_mappingid, valuemapid, value, newvalue) VALUES (55002, 5501, 1, 'Up');
--- testInheritanceApplication
-INSERT INTO applications (applicationid, hostid, name) VALUES (99001, 15000, 'Inheritance application');
-INSERT INTO applications (applicationid, hostid, name) VALUES (99002, 15001, 'Inheritance application');
-INSERT INTO application_template (application_templateid, applicationid, templateid) VALUES (900, 99002, 99001);
-INSERT INTO applications (applicationid, hostid, name) VALUES (99003, 15000, 'Inheritance application for delete without items');
-INSERT INTO applications (applicationid, hostid, name) VALUES (99004, 15001, 'Inheritance application for delete without items');
-INSERT INTO application_template (application_templateid, applicationid, templateid) VALUES (901, 99004, 99003);
-INSERT INTO applications (applicationid, hostid, name) VALUES (99005, 15000, 'Inheritance application for delete with items');
-INSERT INTO applications (applicationid, hostid, name) VALUES (99006, 15001, 'Inheritance application for delete with items');
-INSERT INTO application_template (application_templateid, applicationid, templateid) VALUES (902, 99006, 99005);
-INSERT INTO items (itemid, hostid, interfaceid, type, value_type, name, key_, delay, history, status, params, description, flags, posts, headers) VALUES (99085, 15001, 1, 0, 2, 'Item for testInheritanceApplication','item-with-inheritance-app', '30s', '90d', 0, '', '', 0, '', '');
-INSERT INTO items_applications (itemappid, applicationid, itemid) VALUES (999001, 99006, 99085);
-INSERT INTO applications (applicationid, hostid, name) VALUES (99007, 15000, 'Inheritance application for update');
-INSERT INTO applications (applicationid, hostid, name) VALUES (99008, 15001, 'Inheritance application for update');
-INSERT INTO application_template (application_templateid, applicationid, templateid) VALUES (903, 99008, 99007);
-INSERT INTO applications (applicationid, hostid, name) VALUES (99009, 15001, 'Application on host');
-
-- testPageProblems_TagPriority
INSERT INTO triggers (description,expression,recovery_mode,type,url,priority,comments,manual_close,status,correlation_mode,recovery_expression,correlation_tag,triggerid) VALUES ('First test trigger with tag priority','{100181}>100','0','1','','2','','1','0','0','','','99252');
INSERT INTO functions (functionid,triggerid,itemid,name,parameter) VALUES ('100181','99252','29192','avg','5m');
@@ -2005,18 +1959,14 @@ INSERT INTO hosts_groups (hostgroupid, hostid, groupid) VALUES (90284, 50013, 50
INSERT INTO interface (interfaceid, hostid, main, type, useip, ip, dns, port) values (50039,50011,1,1,1,'127.0.0.1','','10050');
INSERT INTO interface (interfaceid, hostid, main, type, useip, ip, dns, port) values (50040,50012,1,1,1,'127.0.0.1','','10050');
INSERT INTO interface (interfaceid, hostid, main, type, useip, ip, dns, port) values (50041,50013,1,1,1,'127.0.0.1','','10050');
-INSERT INTO applications (applicationid, hostid, name) VALUES (99010, 50011, '1 application');
-INSERT INTO applications (applicationid, hostid, name) VALUES (99011, 50011, '2 application');
-INSERT INTO applications (applicationid, hostid, name) VALUES (99012, 50012, '3 application');
-INSERT INTO applications (applicationid, hostid, name) VALUES (99013, 50013, '4 application');
INSERT INTO items (itemid, hostid, interfaceid, type, value_type, name, key_, delay, history, status, params, description, flags, posts, headers) VALUES (99086, 50011, 50039, 2, 3, '1_item','trap[1]', '30s', '90d', 0, '', '', 0, '', '');
-INSERT INTO items_applications (itemappid, applicationid, itemid) VALUES (999002, 99010, 99086);
+INSERT INTO item_tag (itemtagid, itemid, tag, value) VALUES (99000, 99086, 'DataBase', 'mysql');
INSERT INTO items (itemid, hostid, interfaceid, type, value_type, name, key_, delay, history, status, params, description, flags, posts, headers) VALUES (99091, 50011, 50039, 2, 3, '2_item','trap[2]', '30s', '90d', 0, '', '', 0, '', '');
-INSERT INTO items_applications (itemappid, applicationid, itemid) VALUES (999003, 99011, 99091);
+INSERT INTO item_tag (itemtagid, itemid, tag, value) VALUES (99001, 99091, 'DataBase', 'PostgreSQL');
INSERT INTO items (itemid, hostid, interfaceid, type, value_type, name, key_, delay, history, status, params, description, flags, posts, headers) VALUES (99088, 50012, 50040, 2, 3, '3_item','trap[3]', '30s', '90d', 0, '', '', 0, '', '');
-INSERT INTO items_applications (itemappid, applicationid, itemid) VALUES (999004, 99012, 99088);
+INSERT INTO item_tag (itemtagid, itemid, tag, value) VALUES (99002, 99088, 'DataBase', 'Oracle');
INSERT INTO items (itemid, hostid, interfaceid, type, value_type, name, key_, delay, history, status, params, description, flags, posts, headers) VALUES (99089, 50013, 50041, 2, 3, '4_item','trap[4]', '30s', '90d', 0, '', '', 0, '', '');
-INSERT INTO items_applications (itemappid, applicationid, itemid) VALUES (999005, 99013, 99089);
+INSERT INTO item_tag (itemtagid, itemid, tag, value) VALUES (99003, 99089, 'DataBase', 'Oracle DB');
INSERT INTO triggers (triggerid, description, expression, value, state, lastchange, comments, priority, url) VALUES (100032, '1_trigger_Not_classified', '{100032}>0', 1, 0, '1533555726', 'Macro should be resolved, host IP should be visible here: {HOST.CONN}', 0, 'tr_events.php?triggerid={TRIGGER.ID}&eventid={EVENT.ID}');
INSERT INTO triggers (triggerid, description, expression, value, state, lastchange, comments, priority) VALUES (100033, '1_trigger_Warning', '{100033}>0', 1, 0, '1533555726', 'The following url should be clickable: https://zabbix.com', 2);
INSERT INTO triggers (triggerid, description, expression, value, state, lastchange, comments, priority, url) VALUES (100034, '1_trigger_Average', '{100034}>0', 1, 0, '1533555726', 'https://zabbix.com', 3, 'tr_events.php?triggerid={TRIGGER.ID}&eventid={EVENT.ID}');
@@ -2185,6 +2135,24 @@ INSERT INTO functions (functionid, itemid, triggerid, name, parameter) VALUES (1
INSERT INTO trigger_tag (triggertagid, triggerid, tag, value) VALUES (184, 100112, 'action', 'update');
INSERT INTO trigger_tag (triggertagid, triggerid, tag, value) VALUES (185, 100112, 'tag', 'trigger');
+INSERT INTO items (itemid, type, hostid, name, key_, params, description, posts, headers) VALUES (99116, 2, 99109, 'Item with tags for updating', 'tags.update', '', '', '', '');
+INSERT INTO item_tag (itemtagid, itemid, tag, value) VALUES (99004, 99116, 'action', 'update');
+INSERT INTO item_tag (itemtagid, itemid, tag, value) VALUES (99005, 99116, 'without value', '');
+
+INSERT INTO items (itemid, type, hostid, name, key_, params, description, posts, headers) VALUES (99117, 2, 99109, 'Item with tags for cloning', 'tags.cloning', '', '', '', '');
+INSERT INTO item_tag (itemtagid, itemid, tag, value) VALUES (99006, 99117, 'action', 'clone');
+INSERT INTO item_tag (itemtagid, itemid, tag, value) VALUES (99007, 99117, 'without value', '');
+
+INSERT INTO items (itemid, type, hostid, name, key_, params, flags, description, posts, headers) VALUES (99118, 2, 40001, 'Item prototype with tags for updating', 'prototype.tags.update', '', 2, '', '', '');
+INSERT INTO item_discovery (itemdiscoveryid, itemid, parent_itemid) values (15090, 99118, 133800);
+INSERT INTO item_tag (itemtagid, itemid, tag, value) VALUES (99008, 99118, 'action', 'update');
+INSERT INTO item_tag (itemtagid, itemid, tag, value) VALUES (99009, 99118, 'without value prototype', '');
+
+INSERT INTO items (itemid, type, hostid, name, key_, params, flags, description, posts, headers) VALUES (99119, 2, 40001, 'Item prototype with tags for cloning', 'prototype.tags.cloning', '', 2, '', '', '');
+INSERT INTO item_discovery (itemdiscoveryid, itemid, parent_itemid) values (15091, 99119, 133800);
+INSERT INTO item_tag (itemtagid, itemid, tag, value) VALUES (99010, 99119, 'action', 'clone');
+INSERT INTO item_tag (itemtagid, itemid, tag, value) VALUES (99011, 99119, 'without value prototype', '');
+
-- testFormAdministrationMediaTypes
INSERT INTO media_type (mediatypeid, type, name, exec_path, status, script, description) VALUES (100, 1, 'Test script', 'Selenium test script', 1, '', '');
@@ -2600,21 +2568,21 @@ INSERT INTO widget (widgetid, dashboard_pageid, type, name, x, y, width, height)
INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904009, 1060, 1, 'reference', 0, 'OYKZW');
INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_sysmapid) VALUES (904010, 1060, 8, 'sysmapid', 0, 3);
--- INSERT INTO widget (widgetid, dashboard_pageid, type, name, x, y, width, height) VALUES (1061, 130, 'navtree', 'Test copy Map navigation tree', 0, 10, 6, 2);
--- INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int) VALUES (904011, 1061, 0, 'navtree.order.2', 2);
--- INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int) VALUES (904012, 1061, 0, 'rf_rate', 60);
--- INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int) VALUES (904013, 1061, 0, 'show_unavailable', 1);
--- INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904014, 1061, 1, 'navtree.name.1', 0, 'Map with icon mapping');
--- INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904015, 1061, 1, 'navtree.name.2', 0, 'Public map with image');
--- INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904016, 1061, 1, 'reference', 0, 'STZDI');
--- INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904017, 1061, 8, 'navtree.sysmapid.1', 0, 6);
--- INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904018, 1061, 8, 'navtree.sysmapid.2', 0, 10);
-
--- INSERT INTO widget (widgetid, dashboard_pageid, type, name, x, y, width, height) VALUES (1062, 130, 'map', 'Test copy Map from tree', 6, 10, 7, 2);
--- INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int) VALUES (904019, 1062, 0, 'rf_rate', 120);
--- INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int) VALUES (904020, 1062, 0, 'source_type', 2);
--- INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904021, 1062, 1, 'filter_widget_reference', 0, 'STZDI');
--- INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904022, 1062, 1, 'reference', 0, 'PVEYR');
+INSERT INTO widget (widgetid, dashboard_pageid, type, name, x, y, width, height) VALUES (1061, 130, 'navtree', 'Test copy Map navigation tree', 0, 10, 6, 2);
+INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int) VALUES (904011, 1061, 0, 'navtree.order.2', 2);
+INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int) VALUES (904012, 1061, 0, 'rf_rate', 60);
+INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int) VALUES (904013, 1061, 0, 'show_unavailable', 1);
+INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904014, 1061, 1, 'navtree.name.1', 0, 'Map with icon mapping');
+INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904015, 1061, 1, 'navtree.name.2', 0, 'Public map with image');
+INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904016, 1061, 1, 'reference', 0, 'STZDI');
+INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904017, 1061, 8, 'navtree.sysmapid.1', 0, 6);
+INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904018, 1061, 8, 'navtree.sysmapid.2', 0, 10);
+
+INSERT INTO widget (widgetid, dashboard_pageid, type, name, x, y, width, height) VALUES (1062, 130, 'map', 'Test copy Map from tree', 6, 10, 7, 2);
+INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int) VALUES (904019, 1062, 0, 'rf_rate', 120);
+INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int) VALUES (904020, 1062, 0, 'source_type', 2);
+INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904021, 1062, 1, 'filter_widget_reference', 0, 'STZDI');
+INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int, value_str) VALUES (904022, 1062, 1, 'reference', 0, 'PVEYR');
INSERT INTO widget (widgetid, dashboard_pageid, type, name, x, y, width, height) VALUES (1063, 130, 'plaintext', 'Test copy plain text', 13, 10, 5, 2);
INSERT INTO widget_field (widget_fieldid, widgetid, type, name, value_int) VALUES (904023, 1063, 0, 'dynamic', 1);
diff --git a/ui/tests/selenium/modules/module_number_6/manifest.json b/ui/tests/selenium/modules/module_number_6/manifest.json
index 4bfe4affd19..d0a79518577 100644
--- a/ui/tests/selenium/modules/module_number_6/manifest.json
+++ b/ui/tests/selenium/modules/module_number_6/manifest.json
@@ -3,7 +3,7 @@
"id": "6",
"name": "шестой модуль",
"author": "Работник Заббикса",
- "description": "Удалить \"Reports\" и \"Maps\" из меню верхнего уровня.",
+ "description": "Удалить \"Reports\" из меню верхнего уровня, а так же удалить \"Maps\" из секции \"Monitoring\".",
"version": "бета 2",
"namespace": "Example_F",
"url": ""
diff --git a/ui/tests/selenium/testFormAction.php b/ui/tests/selenium/testFormAction.php
index 38e18bb154d..daaac68a569 100644
--- a/ui/tests/selenium/testFormAction.php
+++ b/ui/tests/selenium/testFormAction.php
@@ -81,7 +81,10 @@ class testFormAction extends CLegacyWebTest {
['eventsource' => 'Triggers', 'evaltype' => 'Or']
],
[
- ['eventsource' => 'Triggers', 'new_condition_conditiontype' => 'Application']
+ ['eventsource' => 'Triggers', 'new_condition_conditiontype' => 'Tag name']
+ ],
+ [
+ ['eventsource' => 'Triggers', 'new_condition_conditiontype' => 'Tag value']
],
[
['eventsource' => 'Triggers', 'new_condition_conditiontype' => 'Host group']
@@ -227,7 +230,10 @@ class testFormAction extends CLegacyWebTest {
['eventsource' => 'Internal', 'recovery_msg' => true]
],
[
- ['eventsource' => 'Internal', 'new_condition_conditiontype' => 'Application']
+ ['eventsource' => 'Internal', 'new_condition_conditiontype' => 'Tag name']
+ ],
+ [
+ ['eventsource' => 'Internal', 'new_condition_conditiontype' => 'Tag value']
],
[
['eventsource' => 'Internal', 'new_condition_conditiontype' => 'Event type']
@@ -366,7 +372,8 @@ class testFormAction extends CLegacyWebTest {
switch ($eventsource) {
case 'Triggers':
$this->zbxTestDropdownHasOptions('condition_type', [
- 'Application',
+ 'Tag name',
+ 'Tag value',
'Host group',
'Template',
'Host',
@@ -400,7 +407,8 @@ class testFormAction extends CLegacyWebTest {
break;
case 'Internal':
$this->zbxTestDropdownHasOptions('condition_type', [
- 'Application',
+ 'Tag name',
+ 'Tag value',
'Event type',
'Host group',
'Template',
@@ -414,9 +422,11 @@ class testFormAction extends CLegacyWebTest {
}
switch ($new_condition_conditiontype) {
- case 'Application':
+ case 'Tag name':
+ case 'Tag value':
$this->zbxTestTextPresent([
'equals',
+ 'does not equal',
'contains',
'does not contain'
]);
@@ -488,7 +498,8 @@ class testFormAction extends CLegacyWebTest {
}
switch ($new_condition_conditiontype) {
- case 'Application':
+ case 'Tag name':
+ case 'Tag value':
case 'Trigger name':
case 'Time period':
case 'Host IP':
@@ -505,7 +516,8 @@ class testFormAction extends CLegacyWebTest {
}
switch ($new_condition_conditiontype) {
- case 'Application':
+ case 'Tag name':
+ case 'Tag value':
case 'Trigger name':
case 'Time period':
case 'Host IP':
@@ -522,7 +534,8 @@ class testFormAction extends CLegacyWebTest {
}
switch ($new_condition_conditiontype) {
- case 'Application':
+ case 'Tag name':
+ case 'Tag value':
case 'Trigger name':
case 'Received value':
case 'Host name':
@@ -1259,10 +1272,6 @@ class testFormAction extends CLegacyWebTest {
'value' => 'Warning'
],
[
- 'type' => 'Application',
- 'value' => 'application'
- ],
- [
'type' => 'Tag name',
'operator' => 'does not contain',
'value' => 'Does not contain Tag'
@@ -1367,8 +1376,9 @@ class testFormAction extends CLegacyWebTest {
'value' => 'Trigger in "unknown" state'
],
[
- 'type' => 'Application',
- 'value' => 'application'
+ 'type' => 'Tag name',
+ 'operator' => 'does not contain',
+ 'value' => 'Does not contain Tag'
]
],
'operations' => [
@@ -1413,7 +1423,6 @@ class testFormAction extends CLegacyWebTest {
$this->zbxTestDropdownSelectWait('condition_type', $condition['type']);
COverlayDialogElement::find()->one()->waitUntilReady();
switch ($condition['type']) {
- case 'Application':
case 'Host name':
case 'Host metadata':
case 'Trigger name':
@@ -1424,10 +1433,6 @@ class testFormAction extends CLegacyWebTest {
$this->zbxTestInputTypeWait('value', $condition['value']);
$this->zbxTestClickXpath("//div[@class='overlay-dialogue-footer']//button[text()='Add']");
switch($condition['type']){
- case 'Application':
- $this->zbxTestAssertElementText("//tr[@id='conditions_".$conditionCount."']/td[2]", 'Application equals '.$condition['value']);
- $conditionCount++;
- break;
case 'Host name':
$this->zbxTestAssertElementText('//tr[@id="conditions_'.$conditionCount.'"]/td[2]', 'Host name contains '.$condition['value']);
$conditionCount++;
@@ -1570,10 +1575,10 @@ class testFormAction extends CLegacyWebTest {
$this->zbxTestClickXpathWait('//button[text()="Add" and contains(@onclick, "popup.condition.actions")]');
$this->zbxTestLaunchOverlayDialog('New condition');
$this->zbxTestWaitUntilElementVisible(WebDriverBy::id('condition-type'));
- $this->zbxTestDropdownSelectWait('condition_type', 'Application');
- $this->zbxTestInputTypeWait('value', 'app');
+ $this->zbxTestDropdownSelectWait('condition_type', 'Tag name');
+ $this->zbxTestInputTypeWait('value', 'zabbix');
$this->zbxTestClickXpath("//div[@class='overlay-dialogue-footer']//button[text()='Add']");
- $this->zbxTestAssertElementText("//tr[@id='conditions_2']/td[2]", 'Application equals app');
+ $this->zbxTestAssertElementText("//tr[@id='conditions_2']/td[2]", 'Tag name equals zabbix');
// adding operations
$this->zbxTestTabSwitch('Operations');
diff --git a/ui/tests/selenium/testFormApplication.php b/ui/tests/selenium/testFormApplication.php
deleted file mode 100644
index 2cc9be43437..00000000000
--- a/ui/tests/selenium/testFormApplication.php
+++ /dev/null
@@ -1,238 +0,0 @@
-<?php
-/*
-** Zabbix
-** Copyright (C) 2001-2021 Zabbix SIA
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-**/
-
-require_once dirname(__FILE__).'/../include/CLegacyWebTest.php';
-
-/**
- * Test checks Configuration -> Hosts or Templates -> Applications form.
- *
- * @backup applications
- */
-class testFormApplication extends CLegacyWebTest {
-
- /**
- * The name of the test application used in the test data set.
- *
- * @var string
- */
- public static $application;
-
- /**
- * @beforeClass
- */
- public static function initializeTest() {
- // Initialize test application name - random name is used.
- self::$application = 'Test application '.microtime(true);
- }
-
- /**
- * Update application data.
- *
- * @param string $name current application name
- * @param string $new_name new application name (can be null if application should not be renamed)
- */
- protected function updateApplication($name, $new_name = null) {
- if ($new_name === null) {
- $new_name = $name;
- }
-
- // Open an application.
- $this->zbxTestLogin('zabbix.php?action=application.list&filter_rst=1');
- $filter = $this->query('name:zbx_filter')->asForm()->one();
- $filter->getField('Host groups')->select('Zabbix servers');
- $filter->getField('Hosts')->select('Simple form test host');
- $filter->submit();
- $this->zbxTestClickLinkTextWait($name);
-
- // Change application name if new name differs from existing name.
- if ($new_name !== $name) {
- $this->zbxTestInputTypeOverwrite('name', $new_name);
- }
-
- $this->zbxTestClickWait('update');
-
- // Check the results of an update.
- $this->zbxTestCheckTitle('Configuration of applications');
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Application updated');
- $this->zbxTestTextPresent($new_name);
-
- // Check the results in DB.
- $this->assertEquals(1, CDBHelper::getCount("SELECT NULL FROM applications WHERE name='".$new_name."'"));
-
- if ($new_name !== $name) {
- // There should be no application with previous name if name was changed.
- $this->assertEquals(0, CDBHelper::getCount("SELECT NULL FROM applications WHERE name='".$name."'"));
- }
- }
-
- /**
- * Test creation of an application.
- */
- public function testFormApplication_Create() {
- $name = self::$application;
-
- // Select hostgroup and host, open a form.
- $this->zbxTestLogin('zabbix.php?action=application.list&filter_rst=1');
- $filter = $this->query('name:zbx_filter')->asForm()->one();
- $filter->getField('Host groups')->select('Zabbix servers');
- $filter->getField('Hosts')->select('Simple form test host');
- $filter->submit();
- $this->zbxTestContentControlButtonClickTextWait('Create application');
-
- // Set application name and submit the form.
- $this->zbxTestInputTypeWait('name', $name);
- $this->zbxTestClickWait('add');
-
- // Check the results in frontend.
- $this->zbxTestCheckTitle('Configuration of applications');
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Application added');
- $this->zbxTestTextPresent($name);
-
- // Check the results in DB.
- $this->assertEquals(1, CDBHelper::getCount("SELECT NULL FROM applications WHERE name='".$name."'"));
- }
-
- /**
- * Test form validations.
- */
- public function testFormApplication_CheckValidation() {
- // Select hostgroup and host, open a form.
- $this->zbxTestLogin('zabbix.php?action=application.list&filter_rst=1');
- $filter = $this->query('name:zbx_filter')->asForm()->one();
- $filter->getField('Host groups')->select('Zabbix servers');
- $filter->getField('Hosts')->select('Simple form test host');
- $filter->submit();
- $this->zbxTestContentControlButtonClickTextWait('Create application');
-
- // Check error message on posting the empty form.
- $this->zbxTestClickWait('add');
- $this->zbxTestWaitUntilMessageTextPresent('msg-bad', 'Invalid parameter "/1/name": cannot be empty.');
-
- // Change application name to multiple spaces and check an error message.
- $this->zbxTestInputTypeOverwrite('name', ' ');
- $this->zbxTestClickWait('add');
- $this->zbxTestWaitUntilMessageTextPresent('msg-bad', 'Invalid parameter "/1/name": cannot be empty.');
- }
-
- /**
- * Test update without any modification of application data.
- */
- public function testFormApplication_SimpleUpdate() {
- $sql_hash = 'SELECT * FROM applications ORDER BY applicationid';
- $old_hash = CDBHelper::getHash($sql_hash);
-
- $this->updateApplication(self::$application);
-
- $this->assertEquals($old_hash, CDBHelper::getHash($sql_hash));
- }
-
- /**
- * Test update by changing application name.
- */
- public function testFormApplication_Update() {
- $suffix = ' (updated)';
-
- // Update performing multiple times to assure that consequential updates are not broken.
- for ($i = 0; $i < 3; $i++) {
- $this->updateApplication(self::$application, self::$application.$suffix);
-
- // Application name is also updated for the other test cases
- self::$application .= $suffix;
- }
- }
-
- /**
- * Test form canceling functionality.
- */
- public function testFormApplication_Cancel() {
- $sql_hash = 'SELECT * FROM applications ORDER BY applicationid';
- $old_hash = CDBHelper::getHash($sql_hash);
-
- // Select hostgroup and host, open a form.
- $this->zbxTestLogin('zabbix.php?action=application.list&filter_rst=1');
- $filter = $this->query('name:zbx_filter')->asForm()->one();
- $filter->getField('Host groups')->select('Zabbix servers');
- $filter->getField('Hosts')->select('Simple form test host');
- $filter->submit();
- $this->zbxTestClickLinkTextWait(self::$application);
-
- // Change application name.
- $this->zbxTestInputTypeOverwrite('name', self::$application.' (updated)');
-
- // Close the form.
- $this->zbxTestClickWait('cancel');
-
- // Check the result in frontend.
- $this->zbxTestCheckTitle('Configuration of applications');
-
- $this->assertEquals($old_hash, CDBHelper::getHash($sql_hash));
- }
-
- /**
- * Test cloning of application.
- */
- public function testFormApplication_Clone() {
- $suffix = ' (clone)';
- $name = self::$application;
-
- // Select hostgroup and host, open a form.
- $this->zbxTestLogin('zabbix.php?action=application.list&filter_rst=1');
- $filter = $this->query('name:zbx_filter')->asForm()->one();
- $filter->getField('Host groups')->select('Zabbix servers');
- $filter->getField('Hosts')->select('Simple form test host');
- $filter->submit();
- $this->zbxTestClickLinkTextWait($name);
-
- // Clone the application, rename the clone and save it.
- $this->zbxTestClickWait('clone');
- $this->zbxTestInputTypeOverwrite('name', $name.$suffix);
- $this->zbxTestClickWait('add');
-
- // Check the result in frontend.
- $this->zbxTestCheckTitle('Configuration of applications');
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Application added');
- $this->zbxTestTextPresent($name.$suffix);
- }
-
- /**
- * Test deleting of application.
- */
- public function testFormApplication_Delete() {
- $name = self::$application;
-
- // Select hostgroup and host, open a form.
- $this->zbxTestLogin('zabbix.php?action=application.list&filter_rst=1');
- $filter = $this->query('name:zbx_filter')->asForm()->one();
- $filter->getField('Host groups')->select('Zabbix servers');
- $filter->getField('Hosts')->select('Simple form test host');
- $filter->submit();
- $this->zbxTestClickLinkTextWait($name);
-
- // Delete an application.
- $this->zbxTestClickAndAcceptAlert('delete');
-
- // Check the result in frontend.
- $this->zbxTestCheckTitle('Configuration of applications');
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Application deleted');
-
- // Check the result in DB.
- $this->assertEquals(0, CDBHelper::getCount("SELECT NULL FROM applications WHERE name='".$name."'"));
- }
-}
diff --git a/ui/tests/selenium/testFormHost.php b/ui/tests/selenium/testFormHost.php
index 86dfe51d2a7..2945fb1d17c 100644
--- a/ui/tests/selenium/testFormHost.php
+++ b/ui/tests/selenium/testFormHost.php
@@ -1729,7 +1729,7 @@ class testFormHost extends CWebTest {
case TEST_GOOD:
$this->assertMessage(TEST_GOOD, 'Host deleted');
// Check if all host records have been deleted.
- $tables=['hosts', 'interface', 'items', 'applications', 'hostmacro', 'hosts_groups', 'hosts_templates',
+ $tables=['hosts', 'interface', 'items', 'hostmacro', 'hosts_groups', 'hosts_templates',
'maintenances_hosts', 'host_inventory'];
foreach ($tables as $table) {
$this->assertEquals(0, CDBHelper::getCount('SELECT null FROM '.$table.' WHERE hostid='.$hostid));
diff --git a/ui/tests/selenium/testFormHostLinkTemplates.php b/ui/tests/selenium/testFormHostLinkTemplates.php
index 8c268550412..31be55982cf 100644
--- a/ui/tests/selenium/testFormHostLinkTemplates.php
+++ b/ui/tests/selenium/testFormHostLinkTemplates.php
@@ -91,16 +91,15 @@ class testFormHostLinkTemplates extends CLegacyWebTest {
$this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Host updated');
// this should be a separate test
- // should check that items, triggers, graphs and applications are not linked to the template anymore
- $this->zbxTestDoubleClickXpath("//a[contains(@href,'items.php?filter_set=1&filter_hostids%5B0%5D=".$hostid."')]", 'filter_application');
+ // should check that items, triggers and graphs are not linked to the template anymore
+ $this->zbxTestClickXpathWait("//a[contains(@href,'items.php?filter_set=1&filter_hostids%5B0%5D=".$hostid."')]");
+ $this->page->waitUntilReady();
$this->zbxTestTextNotPresent($template.':');
// using "host navigation bar" at the top of entity list
$this->zbxTestHrefClickWait('triggers.php?filter_set=1&filter_hostids%5B0%5D='.$hostid);
$this->zbxTestTextNotPresent($template.':');
$this->zbxTestHrefClickWait('graphs.php?filter_set=1&filter_hostids%5B0%5D='.$hostid);
$this->zbxTestTextNotPresent($template.':');
- $this->zbxTestHrefClickWait('zabbix.php?action=application.list&filter_set=1&filter_hostids%5B0%5D='.$hostid);
- $this->zbxTestTextNotPresent($template.':');
}
public function testFormHostLinkTemplates_TemplateLinkUpdate() {
@@ -154,14 +153,13 @@ class testFormHostLinkTemplates extends CLegacyWebTest {
$this->zbxTestCheckTitle('Configuration of hosts');
$this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Host updated');
- $this->zbxTestDoubleClickXpath("//a[contains(@href,'items.php?filter_set=1&filter_hostids%5B0%5D=".$hostid."')]", 'filter_application');
+ $this->zbxTestClickXpathWait("//a[contains(@href,'items.php?filter_set=1&filter_hostids%5B0%5D=".$hostid."')]");
+ $this->page->waitUntilReady();
$this->zbxTestTextNotPresent($template.':');
$this->zbxTestHrefClickWait('triggers.php?filter_set=1&filter_hostids%5B0%5D='.$hostid);
$this->zbxTestTextNotPresent($template.':');
$this->zbxTestHrefClickWait('graphs.php?filter_set=1&filter_hostids%5B0%5D='.$hostid);
$this->zbxTestTextNotPresent($template.':');
- $this->zbxTestHrefClickWait('zabbix.php?action=application.list&filter_set=1&filter_hostids%5B0%5D='.$hostid);
- $this->zbxTestTextNotPresent($template.':');
}
}
diff --git a/ui/tests/selenium/testFormItem.php b/ui/tests/selenium/testFormItem.php
index b33c935b3b2..7bead28a1f9 100644
--- a/ui/tests/selenium/testFormItem.php
+++ b/ui/tests/selenium/testFormItem.php
@@ -813,21 +813,7 @@ class testFormItem extends CLegacyWebTest {
$this->zbxTestAssertNotVisibleId('logtimefmt');
}
- $this->zbxTestTextPresent('New application');
- $this->zbxTestAssertVisibleId('new_application');
- $this->zbxTestAssertAttribute("//input[@id='new_application']", 'maxlength', 255);
- $this->zbxTestAssertAttribute("//input[@id='new_application']", 'size', 20);
-
- $this->zbxTestTextPresent('Applications');
- $this->zbxTestAssertVisibleId('applications_');
- $this->zbxTestDropdownAssertSelected('applications[]', '-None-');
-
- $options = ['-None-'];
- $result = DBselect('SELECT name FROM applications WHERE hostid='.$hostid);
- while ($row = DBfetch($result)) {
- $options[] = $row['name'];
- }
- $this->zbxTestDropdownHasOptions('applications_', $options);
+ $this->zbxTestTextNotPresent(['Applications', 'New application']);
if ($value_type != 'Log') {
$this->zbxTestTextPresent('Populates host inventory field');
diff --git a/ui/tests/selenium/testFormItemPrototype.php b/ui/tests/selenium/testFormItemPrototype.php
index b00798f2f2c..dee338c9eed 100644
--- a/ui/tests/selenium/testFormItemPrototype.php
+++ b/ui/tests/selenium/testFormItemPrototype.php
@@ -1019,14 +1019,7 @@ class testFormItemPrototype extends CLegacyWebTest {
$this->zbxTestAssertNotVisibleId('logtimefmt');
}
- $this->zbxTestTextPresent('New application');
- $this->zbxTestAssertVisibleId('new_application');
- $this->zbxTestAssertAttribute("//input[@id='new_application']", 'maxlength', 255);
- $this->zbxTestAssertAttribute("//input[@id='new_application']", 'size', 20);
-
- $this->zbxTestTextPresent('Applications');
- $this->zbxTestAssertVisibleId('applications_');
- $this->zbxTestDropdownAssertSelected('applications[]', '-None-');
+ $this->zbxTestTextNotPresent(['Applications','New application']);
$this->zbxTestTextPresent('Description');
$this->zbxTestAssertVisibleId('description');
diff --git a/ui/tests/selenium/testFormTabIndicators.php b/ui/tests/selenium/testFormTabIndicators.php
index 0c67c77ff2d..6b25c689179 100644
--- a/ui/tests/selenium/testFormTabIndicators.php
+++ b/ui/tests/selenium/testFormTabIndicators.php
@@ -763,6 +763,8 @@ class testFormTabIndicators extends CWebTest {
public function testFormTabIndicators_CheckUserGroupIndicators() {
$this->page->login()->open('zabbix.php?action=usergroup.edit')->waitUntilReady();
+ $permissions_table = $this->query('id:group-right-table')->one();
+ $tag_table = $this->query('id:tag-filter-table')->one();
// Check status indicator in Permissions tab.
$form = $this->query('id:user-group-form')->asForm()->one();
@@ -777,6 +779,7 @@ class testFormTabIndicators extends CWebTest {
$permission_level->fill('Read');
$add_button = $form->query('id:new-group-right-table')->query('button:Add')->one();
$add_button->click();
+ $permissions_table->waitUntilReloaded();
$tab_selector->waitUntilReady();
$this->assertTabIndicator($tab_selector, true);
@@ -784,6 +787,7 @@ class testFormTabIndicators extends CWebTest {
$group_selector->fill('Discovered hosts');
$permission_level->fill('None');
$add_button->click();
+ $permissions_table->waitUntilReloaded();
$tab_selector->waitUntilReady();
$this->assertTabIndicator($tab_selector, false);
@@ -795,7 +799,7 @@ class testFormTabIndicators extends CWebTest {
// Add tag filter for Discovered hosts group and check indicator.
$form->query('xpath:.//div[@id="new_tag_filter_groupids_"]/..')->asMultiselect()->one()->fill('Discovered hosts');
$form->query('id:new-tag-filter-table')->query('button:Add')->one()->click();
- $tab_selector->waitUntilReady();
+ $tag_table->waitUntilReloaded();
$this->assertTabIndicator($tab_selector, true);
// Remove the tag filter for Discovered hosts group and check indicator.
diff --git a/ui/tests/selenium/testFormTagsItem.php b/ui/tests/selenium/testFormTagsItem.php
new file mode 100644
index 00000000000..b14449eded1
--- /dev/null
+++ b/ui/tests/selenium/testFormTagsItem.php
@@ -0,0 +1,58 @@
+<?php
+/*
+** Zabbix
+** Copyright (C) 2001-2021 Zabbix SIA
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+**/
+
+require_once dirname(__FILE__).'/common/testFormTags.php';
+
+/**
+ * @backup items
+ */
+class testFormTagsItem extends testFormTags {
+
+ public $update_name = 'Item with tags for updating';
+ public $clone_name = 'Item with tags for cloning';
+ public $link = 'items.php?filter_set=1&filter_hostids%5B0%5D=99109&context=host';
+ public $saved_link = 'items.php?form=update&context=host&itemid=';
+ public $new_name = 'Cloned Item';
+
+ /**
+ * Test creating of Item with tags.
+ *
+ * @dataProvider getCreateData
+ */
+ public function testFormTagsItem_Create($data) {
+ $this->checkTagsCreate($data, 'item');
+ }
+
+ /**
+ * Test update of Item with tags.
+ *
+ * @dataProvider getUpdateData
+ */
+ public function testFormTagsItem_Update($data) {
+ $this->checkTagsUpdate($data, 'item');
+ }
+
+ /**
+ * Test cloning of Item prototype with tags.
+ */
+ public function testFormTagsItem_Clone() {
+ $this->executeCloning('item', 'Clone');
+ }
+}
diff --git a/ui/tests/selenium/testFormTagsItemPrototype.php b/ui/tests/selenium/testFormTagsItemPrototype.php
new file mode 100644
index 00000000000..4f73ca125c5
--- /dev/null
+++ b/ui/tests/selenium/testFormTagsItemPrototype.php
@@ -0,0 +1,58 @@
+<?php
+/*
+** Zabbix
+** Copyright (C) 2001-2021 Zabbix SIA
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+**/
+
+require_once dirname(__FILE__).'/common/testFormTags.php';
+
+/**
+ * @backup items
+ */
+class testFormTagsItemPrototype extends testFormTags {
+
+ public $update_name = 'Item prototype with tags for updating';
+ public $clone_name = 'Item prototype with tags for cloning';
+ public $link = 'disc_prototypes.php?parent_discoveryid=133800&context=host';
+ public $saved_link = 'disc_prototypes.php?form=update&context=host&parent_discoveryid=133800&itemid=';
+ public $new_name = 'Cloned Item prototype {#KEY}';
+
+ /**
+ * Test creating of Item prototype with tags.
+ *
+ * @dataProvider getCreateData
+ */
+ public function testFormTagsItemPrototype_Create($data) {
+ $this->checkTagsCreate($data, 'item prototype');
+ }
+
+ /**
+ * Test update of Item prototype with tags.
+ *
+ * @dataProvider getUpdateData
+ */
+ public function testFormTagsItemPrototype_Update($data) {
+ $this->checkTagsUpdate($data, 'item prototype');
+ }
+
+ /**
+ * Test cloning of Item prototype with tags.
+ */
+ public function testFormTagsItemPrototype_Clone() {
+ $this->executeCloning('item prototype', 'Clone');
+ }
+}
diff --git a/ui/tests/selenium/testFormTemplate.php b/ui/tests/selenium/testFormTemplate.php
index 062cdc21d05..9fa48064b99 100644
--- a/ui/tests/selenium/testFormTemplate.php
+++ b/ui/tests/selenium/testFormTemplate.php
@@ -253,8 +253,6 @@ class testFormTemplate extends CLegacyWebTest {
$template = CDBHelper::getRow("select hostid from hosts where host like '".$cloned_template_name."'");
$this->assertEquals(66, CDBHelper::getCount("SELECT itemid FROM items WHERE hostid='".$template['hostid']."'"));
- $this->assertEquals(11, CDBHelper::getCount("SELECT applicationid FROM applications WHERE hostid='".$template['hostid']."'"));
- $this->assertEquals(1, CDBHelper::getCount("SELECT hostgroupid FROM hosts_groups WHERE hostid='".$template['hostid']."'"));
$this->assertEquals(0, CDBHelper::getCount("SELECT dashboardid FROM dashboard WHERE templateid='".$template['hostid']."'"));
}
@@ -272,8 +270,6 @@ class testFormTemplate extends CLegacyWebTest {
$template = CDBHelper::getRow("select hostid from hosts where host like '".$cloned_template_name."'");
$this->assertEquals(66, CDBHelper::getCount("SELECT itemid FROM items WHERE hostid='".$template['hostid']."'"));
- $this->assertEquals(11, CDBHelper::getCount("SELECT applicationid FROM applications WHERE hostid='".$template['hostid']."'"));
- $this->assertEquals(1, CDBHelper::getCount("SELECT hostgroupid FROM hosts_groups WHERE hostid='".$template['hostid']."'"));
$this->assertEquals(1, CDBHelper::getCount("SELECT dashboardid FROM dashboard WHERE templateid='".$template['hostid']."'"));
}
diff --git a/ui/tests/selenium/testFormUser.php b/ui/tests/selenium/testFormUser.php
index 60adfd9823a..179f934643a 100644
--- a/ui/tests/selenium/testFormUser.php
+++ b/ui/tests/selenium/testFormUser.php
@@ -1057,6 +1057,14 @@ class testFormUser extends CWebTest {
'error_details' => 'User "user-zabbix" is map "Local network" owner.'
]
],
+ // Attempt to delete a user that owns a dashboard.
+ [
+ [
+ 'expected' => TEST_BAD,
+ 'username' => 'test-timezone',
+ 'error_details' => 'User "test-timezone" is dashboard "Testing share dashboard" owner.'
+ ]
+ ],
// Attempt to delete a user that is mentioned in an action.
[
[
@@ -1089,7 +1097,7 @@ class testFormUser extends CWebTest {
$this->query('link', $username)->one()->click();
$userid = CDBHelper::getValue('SELECT userid FROM users WHERE username =' . zbx_dbstr($username));
- // Link user with map, screen, slideshow, action to validate user deletion.
+ // Link user with map, action to validate user deletion.
if (array_key_exists('parameters', $data)) {
DBexecute(
'UPDATE '.$data['parameters']['DB_table'].' SET userid ='.zbx_dbstr($userid).
diff --git a/ui/tests/selenium/testFormWeb.php b/ui/tests/selenium/testFormWeb.php
index 830bd72d94d..a3cfdb8bc9f 100644
--- a/ui/tests/selenium/testFormWeb.php
+++ b/ui/tests/selenium/testFormWeb.php
@@ -230,12 +230,7 @@ class testFormWeb extends CLegacyWebTest {
$this->zbxTestAssertAttribute("//input[@id='name']", 'autofocus');
}
- $this->zbxTestTextPresent('Application');
-
- $this->zbxTestTextPresent('New application');
- $this->zbxTestAssertVisibleId('new_application');
- $this->zbxTestAssertAttribute("//input[@id='new_application']", 'maxlength', 255);
- $this->zbxTestAssertAttribute("//input[@id='new_application']", 'size', 20);
+ $this->zbxTestTextNotPresent(['Application', 'New application']);
$this->zbxTestTextPresent('Update interval');
$this->zbxTestAssertVisibleId('delay');
@@ -476,43 +471,6 @@ class testFormWeb extends CLegacyWebTest {
]
]
],
- // Application -numbers
- [
- [
- 'expected' => TEST_GOOD,
- 'name' => 'Application numbers only',
- 'new_application' => '1234567890',
- 'add_step' => [
- ['step' => 'Application numbers only']
- ]
- ]
- ],
- // Application -symbols
- [
- [
- 'expected' => TEST_GOOD,
- 'name' => 'Application symbols only',
- 'new_application' => '!@#$%^&*()_+{}:"|<>?,./',
- 'add_step' => [
- ['step' => 'Application symbols only']
- ]
- ]
- ],
- // Application -max length
- [
- [
- 'expected' => TEST_GOOD,
- 'name' => 'Application max length',
- 'new_application' => 'qwertyuiopqwertyuiopqwertyuiopqwertyui'.
- 'opqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwe.'.
- 'rtyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqw'.
- 'ertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwer'.
- 'tyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiop123456789012345',
- 'add_step' => [
- ['step' => 'Application max length']
- ]
- ]
- ],
// User/password empty
[
[
@@ -1430,11 +1388,6 @@ class testFormWeb extends CLegacyWebTest {
}
$name = $this->zbxTestGetValue("//input[@id='name']");
- if (isset($data['new_application'])) {
- $this->zbxTestInputType('new_application', $data['new_application']);
- }
- $new_application = $this->zbxTestGetValue("//input[@id='new_application']");
-
if (isset($data['delay'])) {
$this->zbxTestInputTypeOverwrite('delay', $data['delay']);
}
diff --git a/ui/tests/selenium/testInheritanceApplication.php b/ui/tests/selenium/testInheritanceApplication.php
deleted file mode 100644
index 5a63ffd8f6c..00000000000
--- a/ui/tests/selenium/testInheritanceApplication.php
+++ /dev/null
@@ -1,292 +0,0 @@
-<?php
-/*
-** Zabbix
-** Copyright (C) 2001-2021 Zabbix SIA
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-**/
-
-require_once dirname(__FILE__).'/../include/CLegacyWebTest.php';
-
-use Facebook\WebDriver\WebDriverBy;
-
-/**
- * @backup applications
- */
-class testInheritanceApplication extends CLegacyWebTest {
-
- private $template = 'Inheritance test template';
- private $host = 'Template inheritance test host';
-
- /**
- * Select a single value from DB.
- *
- * @param string $query sql query
- *
- * @return mixed
- */
- private function DBSelectValue($query) {
- return (($result = DBSelect($query)) && ($row = DBfetch($result)) && $row) ? reset($row) : null;
- }
-
- /**
- * Select host or template to open applications page.
- */
- private function openApplicationsPage($host) {
- $this->zbxTestLogin('zabbix.php?action=application.list&filter_rst=1');
- $filter = $this->query('name:zbx_filter')->asForm()->waitUntilVisible()->one();
- $filter->getField('Hosts')->clear()->fill($host);
- $filter->submit();
- $this->zbxTestCheckHeader('Applications');
- }
-
- public function testInheritanceApplication_CheckLayout() {
- $this->openApplicationsPage($this->host);
-
- // Get application names linked to host.
- $applications = 'SELECT name FROM applications WHERE hostid IN ('.
- 'SELECT hostid FROM hosts WHERE host='.zbx_dbstr($this->host).
- ')'.
- ' AND applicationid IN ('.
- 'SELECT applicationid FROM application_template'.
- ')';
-
- // Check inherited application name near template name.
- foreach (CDBHelper::getAll($applications) as $application) {
- $get_text = $this->zbxTestGetText('//table//td[text()=": '.$application['name'].'"]');
- $this->assertEquals($get_text, $this->template.': '.$application['name']);
- }
- }
-
- public static function getCreateData() {
- return [
- // Create a new application on template and check it on host.
- [
- [
- 'template' => 'Inheritance test template',
- 'host' => 'Template inheritance test host',
- 'application' => 'NEW inheritance application'
- ]
- ],
- // Create a new application on template with the same name as on host, and check that appliance is inherited now.
- [
- [
- 'template' => 'Inheritance test template',
- 'host' => 'Template inheritance test host',
- 'application' => 'Application on host'
- ]
- ],
- // Try to create application on host with the same name as inherited application name.
- [
- [
- 'host' => 'Template inheritance test host',
- 'application' => 'Inheritance application',
- 'error' => 'Cannot add application',
- 'error_datails' => 'Application "Inheritance application" already exists.'
- ]
- ]
- ];
- }
-
- /**
- * @dataProvider getCreateData
- */
- public function testInheritanceApplication_Create($data) {
- // Add application.
- $this->openApplicationsPage(CTestArrayHelper::get($data, 'template', $data['host']));
- $this->zbxTestContentControlButtonClickText('Create application');
- $this->zbxTestInputTypeWait('name', $data['application']);
- $this->zbxTestClick('add');
-
- if (array_key_exists('template', $data)) {
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Application added');
-
- // Check created application on host.
- $this->page->waitUntilReady();
- $filter = $this->query('name:zbx_filter')->asForm()->one();
- $filter->getField('Hosts')->fill($data['host']);
- $filter->submit();
- $get_text = $this->zbxTestGetText('//table//td[text()=": '.$data['application'].'"]');
- $this->assertEquals($get_text, $data['template'].': '.$data['application']);
-
- // Check the results in DB.
- $host_application = $this->DBSelectValue('SELECT applicationid FROM applications'.
- ' WHERE name='.zbx_dbstr($data['application']).' AND hostid IN ('.
- 'SELECT hostid FROM hosts WHERE host='.zbx_dbstr($data['host']).
- ')');
- $template_application = $this->DBSelectValue('SELECT applicationid FROM applications'.
- ' WHERE name='.zbx_dbstr($data['application']).' AND hostid IN ('.
- 'SELECT hostid FROM hosts WHERE host='.zbx_dbstr($data['template']).
- ')');
- $linked_application = 'SELECT NULL FROM application_template WHERE applicationid='.zbx_dbstr($host_application).
- ' AND templateid='.zbx_dbstr($template_application);
- $this->assertEquals(1, CDBHelper::getCount($linked_application));
- }
- else {
- $this->zbxTestWaitUntilMessageTextPresent('msg-bad', $data['error']);
- $this->zbxTestTextPresentInMessageDetails($data['error_datails']);
-
- // Check the results in DB.
- $host_application = 'SELECT NULL FROM applications WHERE name='.zbx_dbstr($data['application']).
- ' AND hostid IN ('.
- 'SELECT hostid FROM hosts WHERE host='.zbx_dbstr($data['host']).
- ')';
- $this->assertEquals(1, CDBHelper::getCount($host_application));
- }
- }
-
- public function testInheritanceApplication_SimpleUpdate() {
- $sql_hash = 'SELECT * FROM applications ORDER BY applicationid';
- $old_hash = CDBHelper::getHash($sql_hash);
-
- // Get application names on template.
- $applications = 'SELECT name FROM applications WHERE hostid IN ('.
- 'SELECT hostid FROM hosts WHERE host='.zbx_dbstr($this->template).
- ')'.
- ' AND applicationid IN ('.
- 'SELECT templateid FROM application_template'.
- ')';
-
- $this->openApplicationsPage($this->template, 'Templates');
-
- foreach (CDBHelper::getAll($applications) as $application) {
- // Update application on template.
- $this->zbxTestClickLinkTextWait($application['name']);
- $this->zbxTestClickWait('update');
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Application updated');
- }
-
- $this->assertEquals($old_hash, CDBHelper::getHash($sql_hash));
- }
-
- public function testInheritanceApplication_Update() {
- $application = 'Inheritance application for update';
- $new_name = 'UPDATED '.$application;
- $application_id = $this->DBSelectValue('SELECT applicationid FROM applications WHERE name='.zbx_dbstr($application).
- ' AND hostid IN ('.
- 'SELECT hostid FROM hosts WHERE host='.zbx_dbstr($this->template).
- ')');
-
- // Open template page and update application name.
- $this->openApplicationsPage($this->template, 'Templates');
- $this->zbxTestClickLinkTextWait($application);
- $this->zbxTestWaitUntilElementPresent(WebDriverBy::id('name'));
- $this->zbxTestInputType('name', $new_name);
- $this->zbxTestClickWait('update');
-
- // Check updated application name on template.
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Application updated');
- $get_template_application = $this->zbxTestGetText('//table//a[contains(@href, "applicationid='.$application_id.'")]');
- $this->assertEquals($new_name, $get_template_application);
-
- // Check updated application name on host.
- $filter = $this->query('name:zbx_filter')->asForm()->one();
- $filter->getField('Hosts')->clear()->fill($this->host);
- $filter->submit();
- $this->zbxTestWaitUntilElementPresent(WebDriverBy::xpath('//table//td[text()=": '.$new_name.'"]'));
- $get_host_application = $this->zbxTestGetText('//table//td[text()=": '.$new_name.'"]');
- $this->assertEquals($get_host_application, $this->template.': '.$new_name);
-
- // Check the results in DB.
- $hosts = ['templateid' => $this->template, 'applicationid' => $this->host];
- foreach ($hosts as $db_column => $host) {
- $sql = 'SELECT NULL FROM applications WHERE name='.zbx_dbstr($new_name).
- ' AND hostid IN ('.
- 'SELECT hostid FROM hosts WHERE host='.zbx_dbstr($host).
- ')'.
- ' AND applicationid IN ('.
- 'SELECT '.$db_column.' FROM application_template'.
- ')';
- $this->assertEquals(1, CDBHelper::getCount($sql));
- }
- }
-
- public static function getDeleteData() {
- return [
- // Delete template application without items on host. Application deleted on template and host.
- [
- [
- 'template' => 'Inheritance test template',
- 'host' => 'Template inheritance test host',
- 'application' => 'Inheritance application for delete without items'
- ]
- ],
- // Delete template application with items on host. Application deleted only on template.
- [
- [
- 'template' => 'Inheritance test template',
- 'host' => 'Template inheritance test host',
- 'application' => 'Inheritance application for delete with items',
- 'items' => true
- ]
- ],
- // Try to delete inherited application on host.
- [
- [
- 'host' => 'Template inheritance test host',
- 'application' => 'Inheritance application',
- 'error' => 'Cannot delete application',
- 'error_datails' => 'Cannot delete templated application.'
- ]
- ]
- ];
- }
-
- /**
- * @dataProvider getDeleteData
- */
- public function testInheritanceApplication_Delete($data) {
- $this->openApplicationsPage(CTestArrayHelper::get($data, 'template', $data['host']));
-
- if (array_key_exists('template', $data)) {
- // Delete application.
- $this->zbxTestClickLinkTextWait($data['application']);
- $this->zbxTestClickAndAcceptAlert('delete');
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Application deleted');
- $this->zbxTestAssertElementNotPresentXpath('//tbody//td[text()=": '.$data['application'].'"]');
-
- // Check application on host.
- $this->page->waitUntilReady();
- $filter = $this->query('name:zbx_filter')->asForm()->one();
- $filter->getField('Hosts')->clear()->fill($data['host']);
- $filter->submit();
-
- // Check the results in DB.
- $sql = 'SELECT NULL FROM applications WHERE name='.zbx_dbstr($data['application']);
-
- if (array_key_exists('items', $data)) {
- $this->zbxTestAssertElementPresentXpath('//tbody//a[text()="'.$data['application'].'"]');
-
- $this->assertEquals(1, CDBHelper::getCount($sql));
- }
- else {
- $this->zbxTestAssertElementNotPresentXpath('//tbody//td[text()=": '.$data['application'].'"]');
-
- $this->assertEquals(0, CDBHelper::getCount($sql));
- }
- }
- else {
- $this->zbxTestClickXpath('//table//td[text()=": '.$data['application'].'"]/..//input');
- $this->zbxTestClickButtonText('Delete');
- $this->zbxTestAcceptAlert();
- $this->zbxTestWaitUntilMessageTextPresent('msg-bad', $data['error']);
- $this->zbxTestTextPresentInMessageDetails($data['error_datails']);
-
- // Check the results in DB.
- $sql = 'SELECT NULL FROM applications WHERE name='.zbx_dbstr($data['application']);
- $this->assertEquals(2, CDBHelper::getCount($sql));
- }
- }
-}
diff --git a/ui/tests/selenium/testInheritanceTrigger.php b/ui/tests/selenium/testInheritanceTrigger.php
index 6c9a8028da6..0fa9f92fd32 100644
--- a/ui/tests/selenium/testInheritanceTrigger.php
+++ b/ui/tests/selenium/testInheritanceTrigger.php
@@ -199,7 +199,6 @@ class testInheritanceTrigger extends CLegacyWebTest {
$host_triggers_table->query('link', $inherited_trigger)->one()->click();
// Check trigger name.
$triggers_form->invalidate();
-// $form = $this->query('name:triggersForm')->waitUntilPresent()->asForm()->one();
$name = $triggers_form->getField('Name')->getValue();
$this->assertEquals($name, $inherited_trigger);
// Check tags.
diff --git a/ui/tests/selenium/testPageAdministrationGeneralModules.php b/ui/tests/selenium/testPageAdministrationGeneralModules.php
index c271222a47c..53aef3a39d2 100644
--- a/ui/tests/selenium/testPageAdministrationGeneralModules.php
+++ b/ui/tests/selenium/testPageAdministrationGeneralModules.php
@@ -75,7 +75,7 @@ class testPageAdministrationGeneralModules extends CWebTest {
'Name' => 'шестой модуль',
'Version' => 'бета 2',
'Author' => 'Работник Заббикса',
- 'Description' => 'Удалить "Reports" и "Maps" из меню верхнего уровня.',
+ 'Description' => 'Удалить "Reports" из меню верхнего уровня, а так же удалить "Maps" из секции "Monitoring".',
'Status' => 'Disabled'
]
];
@@ -172,7 +172,7 @@ class testPageAdministrationGeneralModules extends CWebTest {
'Name' => 'шестой модуль',
'Version' => 'бета 2',
'Author' => 'Работник Заббикса',
- 'Description' => 'Удалить "Reports" и "Maps" из меню верхнего уровня.',
+ 'Description' => 'Удалить "Reports" из меню верхнего уровня, а так же удалить "Maps" из секции "Monitoring".',
'Directory' => 'module_number_6',
'Namespace' => 'Example_F',
'Homepage' => '-',
diff --git a/ui/tests/selenium/testPageApplications.php b/ui/tests/selenium/testPageApplications.php
deleted file mode 100644
index b9b7a8c06d1..00000000000
--- a/ui/tests/selenium/testPageApplications.php
+++ /dev/null
@@ -1,299 +0,0 @@
-<?php
-/*
-** Zabbix
-** Copyright (C) 2001-2021 Zabbix SIA
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-**/
-
-require_once dirname(__FILE__).'/../include/CLegacyWebTest.php';
-
-/**
- * @backup applications
- */
-class testPageApplications extends CLegacyWebTest {
-
- public static function select_host_group() {
- return [
- [
- [
- 'filter' => [
- 'Hosts' => 'ЗАББИКС Сервер'
- ],
- 'Host name' => 'Test host'
- ]
- ],
- [
- [
- 'filter' => [
- 'Hosts' => 'Apache Tomcat JMX'
- ]
- ]
- ],
- [
- [
- 'filter' => [
- 'Hosts' => ['ЗАББИКС Сервер', 'Empty host']
- ]
- ]
- ],
- [
- [
- 'filter' => [
- 'Host groups' => 'Templates/Applications'
- ]
- ]
- ],
- [
- [
- 'filter' => []
- ]
- ]
- ];
- }
-
- /**
- * @dataProvider select_host_group
- *
- * Test application list when select host and/or host group.
- */
- public function testPageApplications_CheckApplicationList($data) {
- // Open hosts page.
- $this->zbxTestLogin('hosts.php');
- $this->zbxTestClickLinkTextWait('ЗАББИКС Сервер');
-
- // Navigate to host applications.
- $this->zbxTestClickLinkTextWait('Applications');
- $this->zbxTestCheckTitle('Configuration of applications');
- $this->zbxTestCheckHeader('Applications');
-
- // Check selected host and group.
- $filter = $this->query('name:zbx_filter')->asForm()->one();
- $filter->checkValue([
- 'Hosts' => 'ЗАББИКС Сервер',
- 'Host groups' => []
- ]);
-
- $filter->getField('Hosts')->clear();
- $filter->fill($data['filter']);
- $filter->submit();
- $this->page->waitUntilReady();
-
- if (CTestArrayHelper::get($data, 'filter.Hosts', false) && !is_array($data['filter']['Hosts'])) {
- // Get host id
- $host = CTestArrayHelper::get($data, 'Host name', $data['filter']['Hosts']);
- $sql_host_id = DBfetch(DBselect("SELECT hostid FROM hosts WHERE host='".$host."'"));
- $host_id= $sql_host_id['hostid'];
-
- // Check the application names in frontend
- $host_app = [];
- $sql_all_applications = "SELECT applicationid, name FROM applications WHERE hostid=".$host_id;
- $result = DBselect($sql_all_applications);
- while ($row = DBfetch($result)) {
- $host_app[$row['applicationid']] = $row['name'];
- }
- $this->zbxTestTextPresent($host_app);
-
- // Check items number in frontend
- foreach ($host_app as $appid => $app_name) {
- $sql_count_item = CDBHelper::getCount('SELECT NULL FROM items WHERE flags<>2 AND itemid IN'
- .'(SELECT itemid FROM items_applications WHERE applicationid='.$appid.')');
- $xpath = '//input[@id="applicationids_'.$appid.'"]/../..//sup';
-
- if ($sql_count_item === 0) {
- $this->zbxTestAssertElementNotPresentXpath($xpath);
- }
- else {
- $items = $this->zbxTestGetText($xpath);
- $this->assertEquals($sql_count_item, $items);
- }
- }
- }
- else {
- // Check disabled creation button of application
- $this->zbxTestAssertElementText("//button[@id='form']", 'Create application (select host first)');
- $this->zbxTestAssertAttribute("//button[@id='form']",'disabled','true');
- $this->zbxTestAssertElementNotPresentXpath("//ul[contains(@class, 'object-group')]");
- }
-
- if (CTestArrayHelper::get($data['filter'], 'Host groups', false)) {
- $filter = $this->query('name:zbx_filter')->asForm()->one();
- $filter->getField('Hosts')->clear();
- $filter->submit();
-
- $group_app= [];
- $sql_all_applications = "SELECT a.name FROM hosts_groups hg LEFT JOIN applications a ON hg.hostid=a.hostid"
- . " WHERE hg.groupid=(SELECT groupid FROM hstgrp WHERE name='".$data['filter']['Host groups']."')";
- $result = DBselect($sql_all_applications);
- while ($row = DBfetch($result)) {
- $group_app[] = $row['name'];
- }
- $this->zbxTestTextPresent($group_app);
- }
- }
-
- public function selectApplications($app_names, $host, $hostgroup) {
- CMultiselectElement::setDefaultFillMode(CMultiselectElement::MODE_SELECT);
-
- $this->zbxTestLogin('zabbix.php?action=application.list&filter_set=1');
- $this->zbxTestWaitForPageToLoad();
- // Filter applications by host
- $filter = $this->query('name:zbx_filter')->asForm()->one();
- $filter->getField('Hosts')->fill([
- 'values' => $host,
- 'context' => $hostgroup
- ]);
- $filter->submit();
-
- $result = [];
- $hosts = DBfetch(DBselect('SELECT hostid FROM hosts WHERE name=' . zbx_dbstr($host)));
- $this->assertFalse(empty($hosts));
-
- $result['hostid'] = $hosts['hostid'];
- $result['apps'] = [];
-
- // Select applications
- if ($app_names === 'all') {
- $this->zbxTestCheckboxSelect('all_applications');
- }
- else {
- $sql = 'SELECT applicationid, name FROM applications WHERE '.dbConditionString('name', $app_names)
- . ' AND hostid=' . $result['hostid'];
- $cursor = DBselect($sql);
- while ($row = DBfetch($cursor)) {
- $result['apps'][$row['applicationid']] = $row['name'];
- }
-
- $this->assertEquals([], array_diff($result['apps'], $app_names));
-
- foreach (array_keys($result['apps']) as $appid) {
- $this->zbxTestCheckboxSelect('applicationids_'.$appid);
- }
- }
-
- return $result;
- }
-
- /**
- * Test deactivation of selected applications.
- */
- public function testPageApplications_DisableSelected() {
- $result = $this->selectApplications(['General','OS'], 'ЗАББИКС Сервер', 'Zabbix servers');
-
- $this->zbxTestClickButtonText('Disable');
- $this->zbxTestAcceptAlert();
-
- // Check the result in frontend.
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Items disabled');
-
- // Check the results in DB, that selected application items disabled.
- $sql='SELECT NULL FROM items i INNER JOIN items_applications ia ON ia.itemid=i.itemid WHERE '
- . dbConditionInt('ia.applicationid', array_keys($result['apps'])) . ' AND i.flags<>2 AND i.status='
- . ITEM_STATUS_ACTIVE;
- $this->assertEquals(0, CDBHelper::getCount($sql));
- }
-
- /**
- * Test deactivation of all applications in host.
- */
- public function testPageApplications_DisableAll() {
- $result = $this->selectApplications('all', 'ЗАББИКС Сервер', 'Zabbix servers');
-
- $this->zbxTestClickButtonText('Disable');
- $this->zbxTestAcceptAlert();
-
- // Check the result in frontend.
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Items disabled');
-
- // Check the results in DB, that all application items disabled.
- $sql = 'SELECT NULL FROM items i LEFT JOIN items_applications ia ON ia.itemid=i.itemid '
- . 'WHERE i.hostid=' . $result['hostid'] . ' AND i.flags=0 AND i.status='.ITEM_STATUS_ACTIVE;
- $this->assertEquals(0, CDBHelper::getCount($sql));
- }
-
- /**
- * Test activation of selected applications.
- */
- public function testPageApplications_EnableSelected() {
- $result = $this->selectApplications(['General','OS'], 'ЗАББИКС Сервер', 'Zabbix servers');
-
- $this->zbxTestClickButtonText('Enable');
- $this->zbxTestAcceptAlert();
-
- // Check the result in frontend.
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Items enabled');
-
- // Check the results in DB, that selected application items enabled.
- $sql='SELECT NULL FROM items i INNER JOIN items_applications ia ON ia.itemid=i.itemid WHERE '
- . dbConditionInt('ia.applicationid', array_keys($result['apps'])) . ' AND i.flags<>2 AND i.status='
- . ITEM_STATUS_DISABLED;
- $this->assertEquals(0, CDBHelper::getCount($sql));
- }
-
- /**
- * Test activation of all applications in host.
- */
- public function testPageApplications_EnableAll() {
- $result = $this->selectApplications('all', 'ЗАББИКС Сервер', 'Zabbix servers');
-
- $this->zbxTestClickButtonText('Enable');
- $this->zbxTestAcceptAlert();
-
- // Check the result in frontend.
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Items enabled');
-
- // Check the results in DB, that all application items enabled.
- $sql = 'SELECT NULL FROM items i LEFT JOIN items_applications ia ON ia.itemid=i.itemid '
- . 'WHERE i.hostid=' . $result['hostid'] . ' AND i.flags=0 AND i.status='.ITEM_STATUS_DISABLED;
- $this->assertEquals(0, CDBHelper::getCount($sql));
- }
-
- /**
- * Test deleting of application.
- */
- public function testPageApplications_DeleteSelected() {
- $result = $this->selectApplications(['Selenium test application'], 'ЗАББИКС Сервер', 'Zabbix servers');
- $items = CDBHelper::getCount('SELECT NULL FROM items');
-
- $this->zbxTestClickButtonText('Delete');
- $this->zbxTestAcceptAlert();
-
- // Check the result in frontend.
- $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Application deleted');
-
- // Check the result in DB.
- $this->assertEquals(0, CDBHelper::getCount('SELECT NULL FROM applications WHERE ' . dbConditionInt('applicationid', array_keys($result['apps']))));
- $this->assertEquals(0, CDBHelper::getCount('SELECT NULL FROM items_applications WHERE ' . dbConditionInt('applicationid', array_keys($result['apps']))));
- $this->assertEquals($items, CDBHelper::getCount('SELECT NULL FROM items'));
- }
-
- /**
- * Test impossible deleting of templated application.
- */
- public function testPageApplications_CannotDelete() {
- $sql_hash = 'SELECT * FROM applications ORDER BY applicationid';
- $old_hash = CDBHelper::getHash($sql_hash);
-
- $result = $this->selectApplications('all', 'ЗАББИКС Сервер', 'Zabbix servers');
-
- $this->zbxTestClickButtonText('Delete');
- $this->zbxTestAcceptAlert();
-
- $this->zbxTestWaitUntilMessageTextPresent('msg-bad', 'Cannot delete applications');
- $this->zbxTestTextPresent('Cannot delete templated application.');
-
- $this->assertEquals($old_hash, CDBHelper::getHash($sql_hash));
- }
-}
diff --git a/ui/tests/selenium/testPageDashboard.php b/ui/tests/selenium/testPageDashboard.php
index 47766cc08e5..2579198f2b7 100644
--- a/ui/tests/selenium/testPageDashboard.php
+++ b/ui/tests/selenium/testPageDashboard.php
@@ -120,8 +120,8 @@ class testPageDashboard extends CLegacyWebTest {
$this->zbxTestOpen('zabbix.php?action=dashboard.view');
$this->zbxTestAssertElementText('//div[@class="dashboard-grid"]/div[7]//a[@href="zabbix.php?action=charts.view&view_as=showgraph&filter_search_type=0&filter_graphids%5B0%5D='.$this->graphCpuId.'&filter_set=1"]', 'ЗАББИКС Сервер: '.$this->graphCpu);
$this->zbxTestAssertElementText('//div[@class="dashboard-grid"]/div[7]//a[@href="zabbix.php?action=charts.view&view_as=showgraph&filter_search_type=0&filter_graphids%5B0%5D='.$this->graphMemoryId.'&filter_set=1"]', 'ЗАББИКС Сервер: '.$this->graphMemory);
- $this->assertEquals(1, CDBHelper::getCount('SELECT profileid FROM profiles WHERE idx='.zbx_dbstr("web.favorite.graphids").' AND value_id='.$this->graphCpuId));
- $this->assertEquals(1, CDBHelper::getCount('SELECT profileid FROM profiles WHERE idx='.zbx_dbstr("web.favorite.graphids").' AND value_id='.$this->graphMemoryId));
+ $this->assertEquals(1, CDBHelper::getCount('SELECT profileid FROM profiles WHERE idx='.zbx_dbstr('web.favorite.graphids').' AND value_id='.$this->graphCpuId));
+ $this->assertEquals(1, CDBHelper::getCount('SELECT profileid FROM profiles WHERE idx='.zbx_dbstr('web.favorite.graphids').' AND value_id='.$this->graphMemoryId));
}
public function testPageDashboard_RemoveFavouriteGraphs() {
@@ -129,14 +129,14 @@ class testPageDashboard extends CLegacyWebTest {
try {
$this->zbxTestLogin('zabbix.php?action=dashboard.view');
- $FavouriteGraphs = DBfetchArray(DBselect('SELECT value_id FROM profiles WHERE idx='.zbx_dbstr("web.favorite.graphids")));
+ $FavouriteGraphs = DBfetchArray(DBselect('SELECT value_id FROM profiles WHERE idx='.zbx_dbstr('web.favorite.graphids')));
foreach ($FavouriteGraphs as $FavouriteGraph) {
$this->zbxTestWaitUntilElementPresent(WebDriverBy::xpath('//div[@class="dashboard-grid-widget-container"]/div[2]//button[@onclick="rm4favorites(\'graphid\',\''.$FavouriteGraph['value_id'].'\')"]'));
$this->zbxTestClickXpathWait('//div[@class="dashboard-grid-widget-container"]/div[2]//button[@onclick="rm4favorites(\'graphid\',\''.$FavouriteGraph['value_id'].'\')"]');
$this->zbxTestWaitUntilElementNotVisible(WebDriverBy::xpath('//div[@class="dashboard-grid-widget-container"]/div[2]//button[@onclick="rm4favorites(\'graphid\',\''.$FavouriteGraph['value_id'].'\')"]'));
}
$this->zbxTestAssertElementText('//div[@class="dashboard-grid-widget-container"]//tr[@class="nothing-to-show"]/td', 'No graphs added.');
- $this->assertEquals(0, CDBHelper::getCount('SELECT profileid FROM profiles WHERE idx='.zbx_dbstr("web.favorite.graphids")));
+ $this->assertEquals(0, CDBHelper::getCount('SELECT profileid FROM profiles WHERE idx='.zbx_dbstr('web.favorite.graphids')));
}
catch (Exception $e) {
$exception = $e;
@@ -159,19 +159,27 @@ class testPageDashboard extends CLegacyWebTest {
$this->zbxTestOpen('zabbix.php?action=dashboard.view');
$this->zbxTestAssertElementText('//div[@class="dashboard-grid-widget-container"]/div[2]//a[@href="zabbix.php?action=map.view&sysmapid='.$this->mapTestId.'"]', $this->mapTest);
- $this->assertEquals(1, CDBHelper::getCount('SELECT profileid FROM profiles WHERE idx='.zbx_dbstr("web.favorite.sysmapids").' AND value_id='.$this->mapTestId));
+ $this->assertEquals(1, CDBHelper::getCount('SELECT profileid FROM profiles WHERE idx='.zbx_dbstr('web.favorite.sysmapids').' AND value_id='.$this->mapTestId));
}
public function testPageDashboard_RemoveFavouriteMaps() {
- $this->zbxTestLogin('zabbix.php?action=dashboard.view');
- $FavouriteScreens = DBfetchArray(DBselect('SELECT value_id FROM profiles WHERE idx='.zbx_dbstr("web.favorite.sysmapids")));
+ $this->page->login()->open('zabbix.php?action=dashboard.view&dashboardid=1');
+ $widget_content = CDashboardElement::find()->one()->getWidget('Favourite maps')->getContent();
+ $FavouriteScreens = DBfetchArray(DBselect('SELECT value_id FROM profiles WHERE idx='.
+ zbx_dbstr('web.favorite.sysmapid')));
+
foreach ($FavouriteScreens as $FavouriteScreen) {
- $this->zbxTestWaitUntilElementPresent(WebDriverBy::xpath("//div[@class='dashboard-grid-widget-container']/div[2]//button[@onclick=\"rm4favorites('sysmapid','".$FavouriteScreen['value_id']."')\"]"));
- $this->zbxTestClickXpathWait("//div[@class='dashboard-grid-widget-container']/div[2]//button[@onclick=\"rm4favorites('sysmapid','".$FavouriteScreen['value_id']."')\"]");
- $this->zbxTestWaitUntilElementNotVisible(WebDriverBy::xpath("//div[@class='dashboard-grid']/div[2]//button[@onclick=\"rm4favorites('sysmapid','".$FavouriteScreen['value_id']."')\"]"));
+ $widget_content->query('xpath://button[contains(@onclick, "(\'sysmapid\',\''.
+ $FavouriteScreen['value_id'].'\')")]')->waitUntilClickable()->one()->click();
+ $map_name = CDBHelper::getValue('SELECT name FROM sysmaps WHERE sysmapid='.
+ zbx_dbstr($FavouriteScreen['value_id']));
+ $widget_content->query('link', $map_name)->waitUntilNotPresent();
}
- $this->zbxTestAssertElementText("//div[@class='dashboard-grid-widget-container']/div[2]//tr[@class='nothing-to-show']/td", 'No maps added.');
- $this->assertEquals(0, CDBHelper::getCount('SELECT profileid FROM profiles WHERE idx='.zbx_dbstr("web.favorite.sysmapids")));
+
+ $this->assertTrue($widget_content->query('xpath://table//td[text()="No maps added."]')->waitUntilVisible()
+ ->one()->isPresent());
+ $this->assertEquals(0, CDBHelper::getCount('SELECT profileid FROM profiles WHERE idx='.
+ zbx_dbstr('web.favorite.sysmapids')));
}
public function testPageDashboard_KioskMode() {
diff --git a/ui/tests/selenium/testPageDashboardWidgets.php b/ui/tests/selenium/testPageDashboardWidgets.php
index b358c390971..9d44566ca1d 100644
--- a/ui/tests/selenium/testPageDashboardWidgets.php
+++ b/ui/tests/selenium/testPageDashboardWidgets.php
@@ -57,8 +57,8 @@ class testPageDashboardWidgets extends CWebTest {
$this->checkLastSelectedWidgetType();
// Add widget with current default type "Action log".
- $dashboard->addWidget()->asForm();
- $this->query('xpath://div[@role="dialog"]//button[text()="Add"]')->waitUntilPresent()->one()->click();;
+ $dashboard->addWidget();
+ $this->query('xpath://div[@role="dialog"]//button[text()="Add"]')->waitUntilPresent()->one()->click();
// Check if widget was added.
$dashboard->getWidget('Action log');
$this->checkLastSelectedWidgetType();
diff --git a/ui/tests/selenium/testPageHostGraph.php b/ui/tests/selenium/testPageHostGraph.php
index 464427f58ad..3930452f008 100644
--- a/ui/tests/selenium/testPageHostGraph.php
+++ b/ui/tests/selenium/testPageHostGraph.php
@@ -65,7 +65,6 @@ class testPageHostGraph extends CLegacyWebTest {
$breadcrumbs = [
'hosts.php' => 'All hosts',
'hosts.php?form=update&hostid='.$hostid => $host_name,
- 'zabbix.php?action=application.list&filter_set=1&filter_hostids%5B0%5D='.$hostid => 'Applications',
'items.php?filter_set=1&filter_hostids%5B0%5D='.$hostid.'&context=host' => 'Items',
'triggers.php?filter_set=1&filter_hostids%5B0%5D='.$hostid.'&context=host' => 'Triggers',
'graphs.php?filter_set=1&filter_hostids%5B0%5D='.$hostid.'&context=host' => 'Graphs',
diff --git a/ui/tests/selenium/testPageHosts.php b/ui/tests/selenium/testPageHosts.php
index 1ed5870811f..2657ab106ec 100644
--- a/ui/tests/selenium/testPageHosts.php
+++ b/ui/tests/selenium/testPageHosts.php
@@ -62,7 +62,6 @@ class testPageHosts extends CLegacyWebTest {
$this->zbxTestAssertElementPresentXpath('//div[@id="filter_proxyids_"]/..//button[@disabled]');
$this->zbxTestAssertElementPresentXpath("//thead//th/a[text()='Name']");
- $this->zbxTestAssertElementPresentXpath("//thead//th[contains(text(),'Applications')]");
$this->zbxTestAssertElementPresentXpath("//thead//th[contains(text(),'Items')]");
$this->zbxTestAssertElementPresentXpath("//thead//th[contains(text(),'Triggers')]");
$this->zbxTestAssertElementPresentXpath("//thead//th[contains(text(),'Graphs')]");
@@ -102,8 +101,6 @@ class testPageHosts extends CLegacyWebTest {
$oldHashHosts = CDBHelper::getHash($sqlHosts);
$sqlItems = "select * from items where hostid=$hostid order by itemid";
$oldHashItems = CDBHelper::getHash($sqlItems);
- $sqlApplications = "select * from applications where hostid=$hostid order by applicationid";
- $oldHashApplications = CDBHelper::getHash($sqlApplications);
$sqlInterface = "select * from interface where hostid=$hostid order by interfaceid";
$oldHashInterface = CDBHelper::getHash($sqlInterface);
$sqlHostMacro = "select * from hostmacro where hostid=$hostid order by hostmacroid";
@@ -131,7 +128,6 @@ class testPageHosts extends CLegacyWebTest {
$this->assertEquals($oldHashHosts, CDBHelper::getHash($sqlHosts));
$this->assertEquals($oldHashItems, CDBHelper::getHash($sqlItems));
- $this->assertEquals($oldHashApplications, CDBHelper::getHash($sqlApplications));
$this->assertEquals($oldHashInterface, CDBHelper::getHash($sqlInterface));
$this->assertEquals($oldHashHostMacro, CDBHelper::getHash($sqlHostMacro));
$this->assertEquals($oldHashHostsGroups, CDBHelper::getHash($sqlHostsGroups));
diff --git a/ui/tests/selenium/testPageItemPrototypes.php b/ui/tests/selenium/testPageItemPrototypes.php
index ac54c42712a..97fec924aa9 100644
--- a/ui/tests/selenium/testPageItemPrototypes.php
+++ b/ui/tests/selenium/testPageItemPrototypes.php
@@ -54,9 +54,7 @@ class testPageItemPrototypes extends CLegacyWebTest {
$this->zbxTestTextPresent('All templates');
}
- $this->zbxTestTextPresent(
- ['Name', 'Key', 'Interval', 'History', 'Trends', 'Type', 'Applications', 'Create enabled']
- );
+ $this->zbxTestTextPresent(['Name', 'Key', 'Interval', 'History', 'Trends', 'Type', 'Create enabled']);
$this->zbxTestTextNotPresent('Info');
// TODO someday should check that interval is not shown for trapper items, trends not shown for non-numeric items etc
diff --git a/ui/tests/selenium/testPageItems.php b/ui/tests/selenium/testPageItems.php
index a4de90c068d..4560f56e43c 100644
--- a/ui/tests/selenium/testPageItems.php
+++ b/ui/tests/selenium/testPageItems.php
@@ -51,7 +51,6 @@ class testPageItems extends CLegacyWebTest {
'History',
'Trends',
'Type',
- 'Applications',
'Status',
'Info'
]
@@ -69,7 +68,6 @@ class testPageItems extends CLegacyWebTest {
'History',
'Trends',
'Type',
- 'Applications',
'Status',
'Info'
]
diff --git a/ui/tests/selenium/testPageLatestData.php b/ui/tests/selenium/testPageLatestData.php
index c14377c9c82..ef3937a931d 100644
--- a/ui/tests/selenium/testPageLatestData.php
+++ b/ui/tests/selenium/testPageLatestData.php
@@ -25,7 +25,7 @@ class testPageLatestData extends CLegacyWebTest {
$this->zbxTestLogin('zabbix.php?action=latest.view');
$this->zbxTestCheckTitle('Latest data');
$this->zbxTestCheckHeader('Latest data');
- $this->zbxTestTextPresent(['Host groups', 'Hosts', 'Application', 'Name', 'Show items without data', 'Show details']);
+ $this->zbxTestTextPresent(['Host groups', 'Hosts', 'Name', 'Show items without data', 'Show details']);
$this->zbxTestTextPresent('Filter');
$this->zbxTestTextPresent(['Host', 'Name', 'Last check', 'Last value', 'Change']);
}
@@ -134,7 +134,7 @@ class testPageLatestData extends CLegacyWebTest {
*/
public function testPageLatestData_checkItemDescription($data) {
// Open Latest data for host 'testPageHistory_CheckLayout'
- $this->page->login()->open('zabbix.php?action=latest.view&filter_hostids%5B%5D='.$data['host group'].'&filter_application=&filter_select=&filter_show_without_data=1&filter_set=1');
+ $this->page->login()->open('zabbix.php?action=latest.view&filter_hostids%5B%5D='.$data['host group'].'&filter_select=&filter_show_without_data=1&filter_set=1');
$table = $this->query('class:list-table')->asTable()->one();
// Find rows from the data provider and click on the description icon if such should persist.
diff --git a/ui/tests/selenium/testPageMonitoringHosts.php b/ui/tests/selenium/testPageMonitoringHosts.php
index 941b6d7866b..6e6c07cbe9c 100644
--- a/ui/tests/selenium/testPageMonitoringHosts.php
+++ b/ui/tests/selenium/testPageMonitoringHosts.php
@@ -351,8 +351,10 @@ class testPageMonitoringHosts extends CWebTest {
$this->page->login()->open('zabbix.php?action=host.view&filter_rst=1');
$form = $this->query('name:zbx_filter')->waitUntilPresent()->asForm()->one();
$form->fill($data['filter']);
- $this->query('button:Apply')->one()->waitUntilClickable()->click();
+ $result_form = $this->query('xpath://form[@name="host_view"]')->one();
+ $this->query('button:Apply')->waitUntilClickable()->one()->click();
$this->page->waitUntilReady();
+ $result_form->waitUntilReloaded();
$this->assertTableDataColumn($data['expected']);
}
diff --git a/ui/tests/selenium/testPageOverview.php b/ui/tests/selenium/testPageOverview.php
index 8d884616085..b3f379b6c51 100644
--- a/ui/tests/selenium/testPageOverview.php
+++ b/ui/tests/selenium/testPageOverview.php
@@ -19,6 +19,7 @@
**/
require_once dirname(__FILE__).'/../include/CLegacyWebTest.php';
+require_once dirname(__FILE__).'/traits/FilterTrait.php';
use Facebook\WebDriver\WebDriverBy;
@@ -26,6 +27,9 @@ use Facebook\WebDriver\WebDriverBy;
* @backup problem
*/
class testPageOverview extends CLegacyWebTest {
+
+ use FilterTrait;
+
// Check that no real host or template names displayed
public function testPageOverview_NoHostNames() {
$this->zbxTestLogin('overview.php');
@@ -163,38 +167,6 @@ class testPageOverview extends CLegacyWebTest {
]
]
],
- // Application option in filter.
- [
- [
- 'general_filter' => 'Trigger overview',
- 'filter' => [
- 'Host groups' => 'Group to check Overview',
- 'Application' => '1 application'
- ],
- 'result_hosts' => [
- '1_Host_to_check_Monitoring_Overview'
- ],
- 'result_triggers' => [
- '1_trigger_Not_classified', '1_trigger_Warning', '1_trigger_Average', '1_trigger_High',
- '1_trigger_Disaster'
- ]
- ]
- ],
- [
- [
- 'general_filter' => 'Trigger overview',
- 'filter' => [
- 'Host groups' => 'Group to check Overview',
- 'Application' => '2 application'
- ],
- 'result_hosts' => [
- '1_Host_to_check_Monitoring_Overview'
- ],
- 'result_triggers' => [
- '2_trigger_Information'
- ]
- ]
- ],
// Name option in filter.
[
[
@@ -289,9 +261,11 @@ class testPageOverview extends CLegacyWebTest {
'Host groups' => 'Group to check Overview',
'Minimum severity' => 'Average',
'Show' => 'Any',
- 'Application' => '3 application',
'Name' => '3_'
],
+ 'tags' => [
+ ['name' => 'DataBase', 'value' => 'Oracle', 'operator' => 'Equals']
+ ],
'age' => '365',
'inventories' => [
'inventory_field' => 'Notes',
@@ -411,8 +385,10 @@ class testPageOverview extends CLegacyWebTest {
[
'general_filter' => 'Data overview',
'filter' => [
- 'Host groups' => 'Group to check Overview',
- 'Application' => '1 application'
+ 'Host groups' => 'Group to check Overview'
+ ],
+ 'tags' => [
+ ['name' => 'DataBase', 'value' => 'mysql', 'operator' => 'Contains']
],
'result_hosts' => [
'1_Host_to_check_Monitoring_Overview'
@@ -425,8 +401,8 @@ class testPageOverview extends CLegacyWebTest {
[
[
'general_filter' => 'Data overview',
- 'filter' => [
- 'Application' => '3 application'
+ 'tags' => [
+ ['name' => 'DataBase', 'value' => 'Oracle', 'operator' => 'Equals']
],
'result_hosts' => [
'3_Host_to_check_Monitoring_Overview'
@@ -515,7 +491,8 @@ class testPageOverview extends CLegacyWebTest {
}
$filter = $this->query('name:zbx_filter')->asForm()->one();
$filter->query('button:Reset')->one()->click();
- $filter->fill($data['filter']);
+ $filter->fill(CTestArrayHelper::get($data, 'filter', []));
+ $this->setTags(CTestArrayHelper::get($data, 'tags', []));
if (array_key_exists('age', $data)) {
$this->zbxTestCheckboxSelect('status_change');
@@ -567,7 +544,7 @@ class testPageOverview extends CLegacyWebTest {
$this->checkResultsInTable($view_style, $data['result_triggers'], $data['result_hosts']);
}
}
- elseif ($data['general_filter'] === 'Data') {
+ elseif ($data['general_filter'] === 'Data overview') {
if ($view_style === 'Top') {
$this->zbxTestAssertElementPresentXpath('//th[text()="Items"]');
$this->checkResultsInTable($view_style, $data['result_hosts'], $data['result_items']);
@@ -578,7 +555,7 @@ class testPageOverview extends CLegacyWebTest {
}
// Suppressed trigger contains background color.
- if (array_key_exists('Show suppressed problems', $data['filter'])) {
+ if (CTestArrayHelper::get($data, 'filter.Show suppressed problems')) {
$this->zbxTestAssertElementPresentXpath('//table[@class="list-table"]//td[contains(@class, "-bg")]');
}
}
diff --git a/ui/tests/selenium/testPageProblems.php b/ui/tests/selenium/testPageProblems.php
index ea6f58d6493..45398857812 100644
--- a/ui/tests/selenium/testPageProblems.php
+++ b/ui/tests/selenium/testPageProblems.php
@@ -38,7 +38,7 @@ class testPageProblems extends CLegacyWebTest {
$this->zbxTestCheckHeader('Problems');
$this->assertTrue($this->zbxTestCheckboxSelected('show_10'));
- $this->zbxTestTextPresent(['Show', 'Host groups', 'Host', 'Application', 'Triggers', 'Problem', 'Not classified',
+ $this->zbxTestTextPresent(['Show', 'Host groups', 'Host', 'Triggers', 'Problem', 'Not classified',
'Information', 'Warning', 'Average', 'High', 'Disaster', 'Age less than', 'Host inventory', 'Tags',
'Show suppressed problems', 'Show unacknowledged only', 'Severity', 'Time', 'Recovery time', 'Status', 'Host',
'Problem', 'Duration', 'Ack', 'Actions', 'Tags']);
@@ -54,7 +54,7 @@ class testPageProblems extends CLegacyWebTest {
$this->query('name:filter_apply')->one()->click();
$this->assertTrue($this->zbxTestCheckboxSelected('show_20'));
$this->zbxTestAssertNotVisibleId('age_state_0');
- $this->zbxTestTextPresent(['Show', 'Host groups', 'Host', 'Application', 'Triggers', 'Problem', 'Not classified',
+ $this->zbxTestTextPresent(['Show', 'Host groups', 'Host', 'Triggers', 'Problem', 'Not classified',
'Information', 'Warning', 'Average', 'High', 'Disaster', 'Host inventory', 'Tags', 'Show suppressed problems',
'Show unacknowledged only', 'Severity', 'Time', 'Recovery time','Status', 'Host', 'Problem', 'Duration',
'Ack', 'Actions', 'Tags']);
@@ -74,12 +74,14 @@ class testPageProblems extends CLegacyWebTest {
$this->assertTrue($this->zbxTestCheckboxSelected('evaltype_00'));
$form = $this->query('id:tabfilter_0')->asForm()->one();
$this->zbxTestDropdownAssertSelected('tags_00_operator', 'Contains');
+ $result_form = $this->query('xpath://form[@name="problem"]')->one();
// Select "AND" option and two tag names with partial "Contains" value match
$form->query('name:tags[0][tag]')->one()->clear()->sendKeys('Service');
$this->query('name:tags_add')->one()->click();
$form->query('name:tags[1][tag]')->one()->clear()->sendKeys('Database');
$this->query('name:filter_apply')->one()->click();
+ $result_form->waitUntilReloaded();
$this->zbxTestAssertElementText('//tbody/tr/td[10]/a', 'Test trigger to check tag filter on problem page');
$this->zbxTestAssertElementText('//div[@class="table-stats"]', 'Displaying 1 of 1 found');
$this->zbxTestTextNotPresent('Test trigger with tag');
@@ -100,11 +102,13 @@ class testPageProblems extends CLegacyWebTest {
$this->zbxTestCheckHeader('Problems');
$this->zbxTestClickButtonText('Reset');
$form = $this->query('id:tabfilter_0')->asForm()->one();
+ $result_form = $this->query('xpath://form[@name="problem"]')->one();
// Search by partial "Contains" tag value match
$form->query('name:tags[0][tag]')->one()->clear()->sendKeys('service');
$form->query('name:tags[0][value]')->one()->clear()->sendKeys('abc');
$this->query('name:filter_apply')->one()->click();
+ $result_form->waitUntilReloaded();
$this->zbxTestAssertElementText('//tbody/tr/td[10]/a', 'Test trigger to check tag filter on problem page');
$this->zbxTestAssertElementText('//div[@class="table-stats"]', 'Displaying 1 of 1 found');
$this->zbxTestTextNotPresent('Test trigger with tag');
@@ -413,9 +417,6 @@ class testPageProblems extends CLegacyWebTest {
$this->zbxTestLaunchOverlayDialog('Hosts');
$this->zbxTestClickWait('spanid10084');
- // Type application
- $this->zbxTestInputType('application_0', 'General');
-
// Select trigger
$this->zbxTestClickButtonMultiselect('triggerids_0');
$this->zbxTestLaunchOverlayDialog('Triggers');
@@ -449,12 +450,14 @@ class testPageProblems extends CLegacyWebTest {
$this->zbxTestLogin('zabbix.php?action=problem.view');
$this->zbxTestCheckHeader('Problems');
$this->zbxTestClickButtonText('Reset');
- $form = $this->query('id:tabfilter_0')->asForm()->one();
+ $form = $this->query('id:tabfilter_0')->asForm()->one()->waitUntilVisible();
+ $result_form = $this->query('xpath://form[@name="problem"]')->one();
// Check Show tags NONE
$form->query('name:tags[0][tag]')->one()->clear()->sendKeys('service');
$this->zbxTestClickXpath('//label[@for="show_tags_00"]');
$this->query('name:filter_apply')->one()->click();
+ $result_form->waitUntilReloaded();
// Check result
$this->zbxTestAssertElementText('//tbody/tr/td[10]/a', 'Test trigger to check tag filter on problem page');
$this->zbxTestAssertElementText('//div[@class="table-stats"]', 'Displaying 1 of 1 found');
@@ -647,13 +650,17 @@ class testPageProblems extends CLegacyWebTest {
$this->zbxTestLogin('zabbix.php?action=problem.view');
$this->zbxTestCheckHeader('Problems');
$this->zbxTestClickButtonText('Reset');
+ $this->page->waitUntilReady();
+ $result_form = $this->query('xpath://form[@name="problem"]')->one();
$this->zbxTestClickButtonMultiselect('hostids_0');
$this->zbxTestLaunchOverlayDialog('Hosts');
- COverlayDialogElement::find()->one()->setDataContext('Host group for suppression');
+ COverlayDialogElement::find()->one()->waitUntilReady()->setDataContext('Host group for suppression');
$this->zbxTestClickLinkTextWait('Host for suppression');
- $this->query('name:filter_apply')->one()->click();
+ COverlayDialogElement::ensureNotPresent();
+ $this->query('name:filter_apply')->one()->waitUntilClickable()->click();
+ $result_form->waitUntilReloaded();
$this->zbxTestTextNotPresent('Trigger_for_suppression');
$this->zbxTestAssertElementText('//div[@class="table-stats"]', 'Displaying 0 of 0 found');
diff --git a/ui/tests/selenium/testPageReportsAudit.php b/ui/tests/selenium/testPageReportsAudit.php
index a56e24d21bf..6a12bdf5fb5 100644
--- a/ui/tests/selenium/testPageReportsAudit.php
+++ b/ui/tests/selenium/testPageReportsAudit.php
@@ -40,7 +40,6 @@ class testPageReportsAudit extends CLegacyWebTest {
private $resourcetypes = [
-1 => 'All',
AUDIT_RESOURCE_ACTION => 'Action',
- AUDIT_RESOURCE_APPLICATION => 'Application',
AUDIT_RESOURCE_AUTOREGISTRATION => 'Autoregistration',
AUDIT_RESOURCE_ZABBIX_CONFIG => 'Configuration of Zabbix',
AUDIT_RESOURCE_DASHBOARD => 'Dashboard',
@@ -119,9 +118,6 @@ class testPageReportsAudit extends CLegacyWebTest {
['action' => AUDIT_ACTION_ADD, 'resourcetype' => AUDIT_RESOURCE_ACTION],
['action' => AUDIT_ACTION_UPDATE, 'resourcetype' => AUDIT_RESOURCE_ACTION],
['action' => AUDIT_ACTION_DELETE, 'resourcetype' => AUDIT_RESOURCE_ACTION],
- ['action' => AUDIT_ACTION_ADD, 'resourcetype' => AUDIT_RESOURCE_APPLICATION],
- ['action' => AUDIT_ACTION_UPDATE, 'resourcetype' => AUDIT_RESOURCE_APPLICATION],
- ['action' => AUDIT_ACTION_DELETE, 'resourcetype' => AUDIT_RESOURCE_APPLICATION],
['action' => AUDIT_ACTION_ADD, 'resourcetype' => AUDIT_RESOURCE_DISCOVERY_RULE],
['action' => AUDIT_ACTION_UPDATE, 'resourcetype' => AUDIT_RESOURCE_DISCOVERY_RULE],
['action' => AUDIT_ACTION_DELETE, 'resourcetype' => AUDIT_RESOURCE_DISCOVERY_RULE],
diff --git a/ui/tests/selenium/testPageSearch.php b/ui/tests/selenium/testPageSearch.php
index 3efd62ddfdd..cb9ee8586ae 100644
--- a/ui/tests/selenium/testPageSearch.php
+++ b/ui/tests/selenium/testPageSearch.php
@@ -33,7 +33,7 @@ class testPageSearch extends CLegacyWebTest {
$this->zbxTestTextPresent('ЗАББИКС Сервер');
$this->zbxTestTextNotPresent('Zabbix server');
$this->zbxTestTextPresent('127.0.0.1');
- $this->zbxTestTextPresent(['Latest data', 'Triggers', 'Applications', 'Items', 'Triggers', 'Graphs', 'Problems']);
+ $this->zbxTestTextPresent(['Latest data', 'Triggers', 'Items', 'Triggers', 'Graphs', 'Problems']);
}
public function testPageSearch_FindNotExistingHost() {
diff --git a/ui/tests/selenium/testPageTemplates.php b/ui/tests/selenium/testPageTemplates.php
index 9e70e98b704..3ea15fbdc57 100644
--- a/ui/tests/selenium/testPageTemplates.php
+++ b/ui/tests/selenium/testPageTemplates.php
@@ -43,8 +43,9 @@ class testPageTemplates extends CLegacyWebTest {
$this->zbxTestTextPresent($this->templateName);
$table = $this->query('class:list-table')->asTable()->one();
- $headers = ['', 'Name', 'Hosts', 'Applications', 'Items', 'Triggers', 'Graphs',
- 'Dashboards', 'Discovery', 'Web', 'Linked templates', 'Linked to templates', 'Tags'];
+ $headers = ['', 'Name', 'Hosts', 'Items', 'Triggers', 'Graphs', 'Dashboards', 'Discovery', 'Web',
+ 'Linked templates', 'Linked to templates', 'Tags'
+ ];
$this->assertSame($headers, $table->getHeadersText());
foreach (['Export', 'Mass update', 'Delete', 'Delete and clear'] as $button) {
diff --git a/ui/tests/selenium/testUrlUserPermissions.php b/ui/tests/selenium/testUrlUserPermissions.php
index 60a3c933314..72a9083260a 100644
--- a/ui/tests/selenium/testUrlUserPermissions.php
+++ b/ui/tests/selenium/testUrlUserPermissions.php
@@ -328,16 +328,6 @@ class testUrlUserPermissions extends CLegacyWebTest {
]
]],
[[
- 'url' => 'zabbix.php?action=application.list',
- 'title' => 'Configuration of applications',
- 'header' => 'Applications',
- 'users' => [
- 'guest' => false,
- 'user-zabbix' => false,
- 'admin-zabbix' => true
- ]
- ]],
- [[
'url' => 'items.php?context=host',
'title' => 'Configuration of items',
'header' => 'Items',
diff --git a/ui/tests/selenium/testZBX6663.php b/ui/tests/selenium/testZBX6663.php
index 336979ea3e9..f3c05a871dd 100644
--- a/ui/tests/selenium/testZBX6663.php
+++ b/ui/tests/selenium/testZBX6663.php
@@ -46,13 +46,6 @@ class testZBX6663 extends CLegacyWebTest {
[
[
'host' => 'Host ZBX6663',
- 'link' => 'Applications',
- 'checkbox' => 'applications'
- ]
- ],
- [
- [
- 'host' => 'Host ZBX6663',
'link' => 'Items',
'checkbox' => 'items'
]
@@ -109,13 +102,6 @@ class testZBX6663 extends CLegacyWebTest {
[
[
'template' => 'Template ZBX6663 First',
- 'link' => 'Applications',
- 'checkbox' => 'applications'
- ]
- ],
- [
- [
- 'template' => 'Template ZBX6663 First',
'link' => 'Items',
'checkbox' => 'items'
]
diff --git a/ui/tests/unit/include/classes/import/CImportDataAdapterTest.php b/ui/tests/unit/include/classes/import/CImportDataAdapterTest.php
index 3eedb3c2523..4b53db99336 100644
--- a/ui/tests/unit/include/classes/import/CImportDataAdapterTest.php
+++ b/ui/tests/unit/include/classes/import/CImportDataAdapterTest.php
@@ -36,7 +36,6 @@ class CImportDataAdapterTest extends TestCase {
$this->assertEquals($adapter->getGroups(), []);
$this->assertEquals($adapter->getHosts(), []);
$this->assertEquals($adapter->getTemplates(), []);
- $this->assertEquals($adapter->getApplications(), []);
$this->assertEquals($adapter->getItems(), []);
$this->assertEquals($adapter->getTriggers(), []);
$this->assertEquals($adapter->getGraphs(), []);
@@ -324,23 +323,6 @@ class CImportDataAdapterTest extends TestCase {
]);
}
- public function testGetApplications() {
- $adapter = $this->getAdapter($this->getHostAndTemplateXml());
-
- $this->assertEquals($adapter->getApplications(), [
- 'export-host' => [
- 'app' => [
- 'name' => 'app'
- ]
- ],
- 'export-template' => [
- 'app' => [
- 'name' => 'app'
- ]
- ]
- ]);
- }
-
public function testGetItems() {
$adapter = $this->getAdapter($this->getHostAndTemplateXml());
@@ -365,7 +347,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'interface_ref' => 'if1',
@@ -414,7 +396,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'interface_ref' => 'if3',
@@ -463,9 +445,10 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [
+ 'tags' => [
[
- 'name' => 'app'
+ 'tag' => 'Application',
+ 'value' => 'app'
]
],
'valuemap' => [],
@@ -518,7 +501,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'jmx_endpoint' => '',
@@ -566,7 +549,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'jmx_endpoint' => 'service:jmx:rmi:///jndi/rmi://{HOST.CONN}:{HOST.PORT}/jmxrmi',
@@ -614,9 +597,10 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [
+ 'tags' => [
[
- 'name' => 'app'
+ 'tag' => 'Application',
+ 'value' => 'app'
]
],
'valuemap' => [],
@@ -975,7 +959,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'interface_ref' => 'if1',
@@ -1002,7 +986,6 @@ class CImportDataAdapterTest extends TestCase {
'headers' => [],
'key_' => 'lld-item',
'trapper_hosts' => '',
- 'application_prototypes' => [],
'preprocessing' => []
],
[
@@ -1025,7 +1008,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'interface_ref' => 'if3',
@@ -1052,7 +1035,6 @@ class CImportDataAdapterTest extends TestCase {
'headers' => [],
'key_' => 'lld-item-jmx',
'trapper_hosts' => '',
- 'application_prototypes' => [],
'preprocessing' => []
],
[
@@ -1075,10 +1057,10 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'application_prototypes' => [],
- 'applications' => [
+ 'tags' => [
[
- 'name' => 'app'
+ 'tag' => 'Application',
+ 'value' => 'app'
]
],
'valuemap' => [],
@@ -1374,8 +1356,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'application_prototypes' => [],
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'jmx_endpoint' => '',
@@ -1423,8 +1404,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'application_prototypes' => [],
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'jmx_endpoint' => 'service:jmx:rmi:///jndi/rmi://{HOST.CONN}:{HOST.PORT}/jmxrmi',
@@ -1472,10 +1452,10 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'application_prototypes' => [],
- 'applications' => [
+ 'tags' => [
[
- 'name' => 'app'
+ 'tag' => 'Application',
+ 'value' => 'app'
]
],
'valuemap' => [],
@@ -1754,7 +1734,8 @@ class CImportDataAdapterTest extends TestCase {
'icon_maintenance' => [
'name' => ''
],
- 'application' => '',
+ 'evaltype' => TAG_EVAL_TYPE_AND_OR,
+ 'tags' => [],
'urls' => [
[
'name' => 'url',
@@ -1794,7 +1775,8 @@ class CImportDataAdapterTest extends TestCase {
'icon_maintenance' => [
'name' => ''
],
- 'application' => '',
+ 'evaltype' => TAG_EVAL_TYPE_AND_OR,
+ 'tags' => [],
'urls' => [],
'elements' => [
[
@@ -1827,7 +1809,8 @@ class CImportDataAdapterTest extends TestCase {
'icon_maintenance' => [
'name' => ''
],
- 'application' => '',
+ 'evaltype' => TAG_EVAL_TYPE_AND_OR,
+ 'tags' => [],
'urls' => [],
'elements' => [
[
@@ -2058,12 +2041,14 @@ class CImportDataAdapterTest extends TestCase {
'params' => '',
'trapper_hosts' => '',
'snmp_oid' => '',
- 'applications' => [
+ 'tags' => [
[
- 'name' => 'Filesystem'
+ 'tag' => 'Application',
+ 'value' => 'Filesystem'
],
[
- 'name' => 'Availability'
+ 'tag' => 'Application',
+ 'value' => 'Availability'
]
],
'name' => 'Free disk space on / in %',
@@ -2117,9 +2102,10 @@ class CImportDataAdapterTest extends TestCase {
'params' => '',
'trapper_hosts' => '',
'snmp_oid' => '',
- 'applications' => [
+ 'tags' => [
[
- 'name' => 'Simple checks'
+ 'tag' => 'Application',
+ 'value' => 'Simple checks'
]
],
'name' => 'FTP check',
@@ -2171,9 +2157,10 @@ class CImportDataAdapterTest extends TestCase {
'params' => '',
'trapper_hosts' => '',
'snmp_oid' => '',
- 'applications' => [
+ 'tags' => [
[
- 'name' => 'Simple checks'
+ 'tag' => 'Application',
+ 'value' => 'Simple checks'
]
],
'name' => 'FTP check with macro',
@@ -2211,23 +2198,6 @@ class CImportDataAdapterTest extends TestCase {
]
);
- $this->assertEquals($adapter->getApplications(), [
- 'Template_Linux' => [
- 'Filesystem' => [
- 'name' => 'Filesystem'
- ],
- 'Availability' => [
- 'name' => 'Availability'
- ]
- ],
- 'Template_Simple' => [
- 'Simple checks' => [
- 'name' => 'Simple checks'
- ]
- ]
- ]
- );
-
$this->assertEquals($adapter->getTriggers(), [
[
'type' => '0',
@@ -2509,9 +2479,10 @@ class CImportDataAdapterTest extends TestCase {
'trends' => '365d',
'status' => '0',
'authtype' => '0',
- 'applications' => [
+ 'tags' => [
[
- 'name' => 'Simple checks'
+ 'tag' => 'Application',
+ 'value' => 'Simple checks'
]
],
'name' => 'FTP check',
@@ -2563,9 +2534,10 @@ class CImportDataAdapterTest extends TestCase {
'trends' => '365d',
'status' => '0',
'authtype' => '0',
- 'applications' => [
+ 'tags' => [
[
- 'name' => 'Simple checks'
+ 'tag' => 'Application',
+ 'value' => 'Simple checks'
]
],
'name' => 'FTP check with macro',
@@ -2852,7 +2824,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -2900,7 +2872,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -2948,7 +2920,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -2996,7 +2968,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -3044,7 +3016,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -3092,7 +3064,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -3151,8 +3123,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
- 'application_prototypes' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -3251,8 +3222,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
- 'application_prototypes' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -3351,8 +3321,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
- 'application_prototypes' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -3639,7 +3608,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -3688,7 +3657,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -3737,7 +3706,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -3786,7 +3755,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -3835,7 +3804,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -3884,7 +3853,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -3945,8 +3914,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
- 'application_prototypes' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -4047,8 +4015,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
- 'application_prototypes' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
@@ -4149,8 +4116,7 @@ class CImportDataAdapterTest extends TestCase {
'privatekey' => '',
'description' => '',
'inventory_link' => '0',
- 'applications' => [],
- 'application_prototypes' => [],
+ 'tags' => [],
'valuemap' => [],
'logtimefmt' => '',
'preprocessing' => [],
diff --git a/ui/tests/unit/include/classes/validators/CActionCondValidatorTest.php b/ui/tests/unit/include/classes/validators/CActionCondValidatorTest.php
index 8d11a79aab4..bd4d7e2a151 100644
--- a/ui/tests/unit/include/classes/validators/CActionCondValidatorTest.php
+++ b/ui/tests/unit/include/classes/validators/CActionCondValidatorTest.php
@@ -146,10 +146,6 @@ class CActionCondValidatorTest extends CValidatorTest {
'value' => 'abc'
]],
[[], [
- 'conditiontype' => CONDITION_TYPE_APPLICATION,
- 'value' => 'abc'
- ]],
- [[], [
'conditiontype' => CONDITION_TYPE_HOST_NAME,
'value' => 'abc'
]],
@@ -397,13 +393,6 @@ class CActionCondValidatorTest extends CValidatorTest {
],
[[],
[
- 'conditiontype' => CONDITION_TYPE_APPLICATION,
- 'value' => ''
- ],
- 'Incorrect value for field "value": cannot be empty.'
- ],
- [[],
- [
'conditiontype' => CONDITION_TYPE_HOST_NAME,
'value' => ''
],