Source
$this->assertTrue($this->query('xpath://li[@data-id='.CXPathHelper::escapeQuotes($selected).']')->one()->isValid());
<?php
/*
** Zabbix
** Copyright (C) 2001-2023 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/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',