Source
$remove_item = $widget->query('xpath', $xpath.' and contains(@onclick, "rm4favorites")]')->waituntilClickable()->one();
<?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 __DIR__.'/../../include/CWebTest.php';
/**
* @backup profiles
*
* @onBefore prepareDashboardData
*/
class testDashboardFavoriteMapsWidget extends CWebTest {
const MAP_NAME = 'Test map for favourite widget';
protected static $dashboardid;
protected static $mapid;
public static function prepareDashboardData() {
$dashboards = CDataHelper::call('dashboard.create', [
[
'name' => 'Dashboard with favorite maps widget',
'private' => 1,
'pages' => [
[
'widgets' => [
[
'type' => 'favmaps',
'x' => 0,
'y' => 0,
'width' => 12,
'height' => 4
]
]
]
]
]
]);
self::$dashboardid = $dashboards['dashboardids'][0];
$hosts = CDataHelper::call('host.create', [
[
'host' => 'Map host',
'groups' => ['groupid' => 4] // Zabbix servers.
]
]);
$maps = CDataHelper::call('map.create', [
[
'name' => self::MAP_NAME,
'width' => 500,