Source
$this->assertTrue($this->query('xpath://li[@data-id='.CXPathHelper::escapeQuotes($selected).']')->one()->isValid());
<?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';
use Facebook\WebDriver\WebDriverKeys;
/**
* @backup hosts, dashboard
*
* @onBefore prepareSelectedHostdata
*/
class testDashboardGraphWidgetSelectedHosts extends CWebTest {
/**
* Id of the dashboard with widgets.
*
* @var integer
*/
protected static $dashboardid;
public static function prepareSelectedHostdata() {
$hostgroupid = CDataHelper::call('hostgroup.create', [['name' => 'Suggestion list group']])['groupids'][0];
CDataHelper::createHosts([
[
'host' => 'Host for widget 1',
'groups' => [
'groupid' => $hostgroupid
],
'status' => HOST_STATUS_MONITORED,
'items' => [
[
'name' => 'Item for Graph 1_1',
'key_' => 'trap1',
'type' => ITEM_TYPE_TRAPPER,
'value_type' => ITEM_VALUE_TYPE_FLOAT
],
[
'name' => 'Item for Graph 1_2',
'key_' => 'trap2',
'type' => ITEM_TYPE_TRAPPER,
'value_type' => ITEM_VALUE_TYPE_FLOAT
],
[
'name' => 'Item for Graph 1_3',
'key_' => 'trap3',
'type' => ITEM_TYPE_TRAPPER,
'value_type' => ITEM_VALUE_TYPE_FLOAT
],
[
'name' => 'Item for Graph 1_4',
'key_' => 'trap4',
'type' => ITEM_TYPE_TRAPPER,
'value_type' => ITEM_VALUE_TYPE_FLOAT
],
[
'name' => 'Item for Graph 1_5',
'key_' => 'trap5',
'type' => ITEM_TYPE_TRAPPER,
'value_type' => ITEM_VALUE_TYPE_FLOAT
]
]
],
[
'host' => 'Host for widget 2',
'groups' => [
'groupid' => $hostgroupid
],
'status' => HOST_STATUS_MONITORED,
'items' => [
[
'name' => 'Item for Graph 2_1',
'key_' => 'trap1',
'type' => ITEM_TYPE_TRAPPER,
'value_type' => ITEM_VALUE_TYPE_FLOAT
],
[