Source
$this->page->login()->open('zabbix.php?action=dashboard.view&dashboardid='.self::$dashboardids[self::DASHBOARD_ZOOM])->waitUntilReady();
<?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__).'/../behaviors/CMessageBehavior.php';
require_once dirname(__FILE__).'/../behaviors/CTableBehavior.php';
require_once dirname(__FILE__).'/../common/testWidgets.php';
/**
* Test for checking Item Value Widget.
*
* @backup dashboard, globalmacro
*
* @dataSource WebScenarios, AllItemValueTypes, ItemValueWidget
*
* @onBefore prepareData
*/
class testDashboardItemValueWidget extends testWidgets {
/**
* Attach MessageBehavior and TableBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [
CMessageBehavior::class,
CTableBehavior::class
];
}
protected static $itemids;
protected static $dashboardids;
protected static $old_name = 'New widget';
protected static $threshold_widget = 'Widget with thresholds';
const DASHBOARD = 'Dashboard for Single Item value Widget test';
const DASHBOARD_ZOOM = 'Dashboard for zoom filter check';
const DASHBOARD_THRESHOLD = 'Dashboard for threshold(s) check';
const DASHBOARD_AGGREGATION = 'Dashboard for aggregation function data check';
const DATA_WIDGET = 'Widget for aggregation function data check';
const MACRO_FUNCTION_WIDGET = 'Widget for macro function check';
/**
* Get threshold table element with mapping set.
*
* @return CMultifieldTable
*/
protected function getThresholdTable() {
return $this->query('id:thresholds-table')->asMultifieldTable([
'mapping' => [
'' => [
'name' => 'color',
'selector' => 'class:color-picker',
'class' => 'CColorPickerElement'
],
'Threshold' => [
'name' => 'threshold',
'selector' => 'xpath:./input',
'class' => 'CElement'
]
]
])->waitUntilVisible()->one();
}
public static function prepareData() {
self::$dashboardids = CDataHelper::get('ItemValueWidget.dashboardids');
self::$itemids = CDataHelper::get('ItemValueWidget.itemids');
CDataHelper::call('usermacro.createglobal', [
[
'macro' => self::USER_MACRO,
'value' => self::USER_MACRO_VALUE
],
[
'macro' => self::USER_SECRET_MACRO,
'type' => 1,
'value' => self::USER_MACRO_VALUE
],