Source
xxxxxxxxxx
$this->page->login()->open('zabbix.php?view_as=showgraph&action=charts.view&filter_search_type=0&filter_set=1')->waitUntilReady();
<?php
/*
** Zabbix
** 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 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';
require_once dirname(__FILE__).'/../behaviors/CTableBehavior.php';
/**
* @backup profiles, hosts
*
* @onBefore prepareGraphsData
*/
class testPageMonitoringHostsGraph extends CWebTest {
/**
* Attach TableBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [CTableBehavior::class];
}
/**
* ID of the item used for graph creation and check.
*
* @var integer
*/
private static $itemids;
/**
* ID of the graph used for result check.
*
* @var integer
*/
private static $graphids;
public static function prepareGraphsData() {
CDataHelper::call('host.create', [
[
'host' => 'Host_for_monitoring_graphs_1',
'groups' => [
'groupid' => 4
],
'interfaces' => [
'type' => 1,
'main' => 1,
'useip' => 1,
'ip' => '127.0.0.1',
'dns' => '',
'port' => '10050'
]
],
[
'host' => 'Host_for_monitoring_graphs_2',
'groups' => [
'groupid' => 4
],
'interfaces' => [
'type' => 1,
'main' => 1,
'useip' => 1,
'ip' => '127.0.0.1',
'dns' => '',
'port' => '10050'
]
]
]);
$hostid = CDataHelper::getIds('host');
CDataHelper::call('item.create', [
[
'name' => 'Item_for_graph_1',
'key_' => 'trap_1',