Source
$this->page->login()->open('zabbix.php?action=template.dashboard.edit&dashboardid='.self::$dashboardid_with_widgets);
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 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__).'/../../include/helpers/CDataHelper.php';
require_once dirname(__FILE__).'/../behaviors/CMessageBehavior.php';
use Facebook\WebDriver\Exception\UnexpectedAlertOpenException;
/**
* @backup dashboard, hosts
*
* @onBefore prepareTemplateDashboardsData
*/
class testFormTemplateDashboards extends CWebTest {
const UPDATE_TEMPLATEID = 50000; // ID of the "Template ZBX6663 First" template used for template dashboards tests.
const HOST_FOR_TEMPLATE = 99015; // ID of the "Empty host" host to which a template with dashboards will be linked.
protected static $dashboardid_with_widgets;
protected static $empty_dashboardid;
protected static $dashboardid_for_update;
private static $previous_widget_name = 'Widget for update';
/**
* Attach MessageBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [
'class' => CMessageBehavior::class
];
}
/**
* Function creates template dashboards and defines the corresponding dashboard IDs.
*/
public static function prepareTemplateDashboardsData() {
$response = CDataHelper::call('templatedashboard.create', [
[
'templateid' => self::UPDATE_TEMPLATEID,
'name' => 'Dashboard with all widgets',
'pages' => [
[
'name' => 'Page with widgets',