Source
$this->assertEquals($placeholder, $tags_tab->query('id:tags_0_'.$placeholder)->one()->getAttribute('placeholder'));
<?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';
/**
* @dataSource EntitiesTags
* @dataSource Services
*
* @backup services
*
* @onBefore prepareServicesData
*/
class testFormServicesServices extends CWebTest {
/**
* Attach MessageBehavior and TableBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [
CMessageBehavior::class,
CTableBehavior::class
];
}
const UPDATE = true;
const EDIT_BUTTON_PATH = 'xpath:.//button[@title="Edit"]';
private static $service_sql = 'SELECT * FROM services ORDER BY serviceid';
private static $update_service = 'Update service';
private static $delete_service = 'Service for delete';
private static $serviceids;
public static function prepareServicesData() {
self::$serviceids = CDataHelper::get('Services.serviceids');
}
/**
* Check Service create form layout.
*/
public function testFormServicesServices_Layout() {
$this->page->login()->open('zabbix.php?action=service.list');
$this->query('id:list_mode')->one()->asSegmentedRadio()->waitUntilVisible()->select('Edit');
$this->query('button:Create service')->waitUntilClickable()->one()->click();
$dialog = COverlayDialogElement::find()->one()->waitUntilReady();
$form = $dialog->query('id:service-form')->asForm()->one();
// Check tabs available in the form.
$this->assertEquals(json_encode(['Service', 'Tags', 'Child services']), json_encode($form->getTabs()));
$service_labels = [
'Name' => true,
'Parent services' => true,
'Problem tags' => true,
'Sort order (0->999)' => true,
'Status calculation rule' => true,
'Description' => true,
'Advanced configuration' => true,
'Additional rules' => false,
'Status propagation rule' => false,
'Weight' => false
];
// Check layout at Service tab.
$hidden_fields = [];
foreach ($service_labels as $label => $visible) {
$this->assertEquals($visible, $form->getField($label)->isDisplayed());
if (!$visible) {
$hidden_fields[] = $label;
}
}