Source
* Test for clicking on particular item tag in table and checking that items are filtered by this tag using normal and kiosk mode.
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/../../include/CWebTest.php';
require_once dirname(__FILE__).'/../../include/helpers/CDataHelper.php';
require_once dirname(__FILE__).'/../behaviors/CTableBehavior.php';
/**
* @backup history_uint, profiles
*
* @dataSource GlobalMacros
*
* @onBefore prepareTestData
*/
class testPageMonitoringLatestData extends CWebTest {
const FILTER_HOSTNAME = 'Host for items tags filtering';
const MAINTENANCE_HOSTNAME = 'Host in maintenance';
/**
* Attach TableBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [CTableBehavior::class];
}
private function getTableSelector() {
return 'xpath://table['.CXPathHelper::fromClass('list-table fixed').']';
}
private function getTable() {
return $this->query($this->getTableSelector())->asTable()->one();
}
public function prepareTestData() {
// Create hostgroup for host with items and tags.
$hostgroups = CDataHelper::call('hostgroup.create', [['name' => 'Group for Items With tags']]);
$hostgroup = $hostgroups['groupids'][0];
// Prepare items data.
$item_names = ['tag_item_1', 'tag_item_2', 'tag_item_3', 'tag_item_4'];
$items_tags_data = [];
foreach ($item_names as $i => $item) {
$items_tags_data[] = [
'name' => $item,
'key_' => 'trapper'.$i,
'type' => 2,
'value_type' => 0,