Source
$widget->query('xpath://button['.CXPathHelper::fromClass('zi-wrench-alt-small').']')->waitUntilClickable()->one()->click();
<?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';
/**
* @backup dashboard
*
* @onBefore prepareData
*/
class testDashboardHostNavigatorWidget extends testWidgets {
/**
* Attach MessageBehavior, TableBehavior and TagBehavior to the test.
*/
public function getBehaviors() {
return [
CMessageBehavior::class,
CTableBehavior::class,
[
'class' => CTagBehavior::class,
'tag_selector' => 'id:tags_table_host_tags'
]
];
}
protected static $dashboardid;
protected static $groupids;
protected static $update_widget = 'Update Host navigator widget';
const MAINTENANCE_HOSTNAME = 'Host in maintenance';
const DEFAULT_WIDGET = 'Default Host navigator widget';
const DELETE_WIDGET = 'Widget for delete';
const DEFAULT_DASHBOARD = 'Dashboard for Host navigator widget test';
const DASHBOARD_FOR_WIDGET_CREATE = 'Dashboard for Host navigator widget create/update test';
/**
* Get 'Group by' table element with mapping set.
*
* @return CMultifieldTable
*/
protected function getGroupByTable() {
return $this->query('id:group_by-table')->asMultifieldTable([
'mapping' => [
'2' => [
'name' => 'attribute',
'selector' => 'xpath:./z-select',
'class' => 'CDropdownElement'
],
'3' => [
'name' => 'tag',
'selector' => 'xpath:./input',
'class' => 'CElement'
]
]
])->waitUntilVisible()->one();
}
public static function prepareData() {
CDataHelper::call('dashboard.create', [
[
'name' => self::DEFAULT_DASHBOARD,
'pages' => [
[
'name' => 'Page with default widgets',
'widgets' => [
[
'type' => 'hostnavigator',
'name' => self::DEFAULT_WIDGET,
'x' => 0,
'y' => 0,
'width' => 36,
'height' => 5
],
[
'type' => 'hostnavigator',
'name' => self::DELETE_WIDGET,
'x' => 36,
'y' => 0,