Source
foreach (['xpath://div['.CXPathHelper::fromClass('filter-space').']', 'class:host-dashboard-navigation', 'class:dashboard'] as $selector) {
<?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';
define('CURRENT_YEAR', date("Y"));
/**
* @onBefore prepareHostDashboardsData
*
* @backup hosts
*/
class testDashboardsHostDashboardPage extends CWebTest {
const HOST_NAME = 'Host for Host Dashboards';
const TEMPLATE_NAME = 'Template for '.self::HOST_NAME;
const COUNT_MANY = 20;
public function prepareHostDashboardsData() {
$data = [
'host_name' => self::HOST_NAME,
'dashboards' => [
[
'name' => 'Dashboard 1',
'pages' => [
[
'name' => 'Page 1',
'widgets' => [
[
'type' => 'svggraph',
'name' => 'Graph widget',
'width' => 6,
'height' => 4,
'fields' => [
[
'type' => ZBX_WIDGET_FIELD_TYPE_INT32,
'name' => '*',
'value' => 0
]
]
]
]
],
[
'name' => 'Page 2'
]
]
]
]
];
$this->createHostWithDashboards($data);
// Create a Host with many Dashboards and another Host with many Pages.
$dashboard_array = [];
$page_array = [];
for ($i = 1; $i <= self::COUNT_MANY; $i++) {
$dashboard_array[] = ['name' => 'Dashboard '.$i];
$page_array[] = ['name' => 'Page '.$i];
}
$data_dashboards = [
'host_name' => 'Many Dashboards',
'dashboards' => $dashboard_array
];
$this->createHostWithDashboards($data_dashboards);
$data_pages = [
'host_name' => 'Many Pages',
'dashboards' => [
[
'name' => 'Dashboard 1',
'pages' => $page_array
]
]
];
$this->createHostWithDashboards($data_pages);
}