Source
xxxxxxxxxx
$this->assertTableDataColumn(($sort === 'asc') ? $data['expected'] : array_reverse($data['expected']), 'Service');
<?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__).'/../common/testSlaReport.php';
/**
* @backup profiles
*
* @dataSource Services, Sla
*
* @onBefore getDateTimeData
*/
class testPageServicesSlaReport extends testSlaReport {
public function testPageServicesSlaReport_GeneralLayout() {
$this->page->login()->open('zabbix.php?action=slareport.list');
$this->page->assertHeader('SLA report');
$this->page->assertTitle('SLA report');
// Check status of buttons on the SLA report page.
foreach ($this->query('button', ['Apply', 'Reset'])->all() as $button) {
$this->assertTrue($button->isClickable());
}
// Check displaying and hiding the filter.
$filter = CFilterElement::find()->one();
$filter_form = $filter->getForm();
$this->assertEquals('Filter', $filter->getSelectedTabName());
// Check that filter is expanded by default.
$this->assertTrue($filter->isExpanded());
// Check that filter is collapsing/expanding on click.
foreach ([false, true] as $status) {
$filter->expand($status);
$this->assertTrue($filter->isExpanded($status));
}
// Check the list of available SLAs (disabled SLAs should not be present).
$sla_data = [
'field' => 'SLA',
'headers' => ['Name'],
'column_data' => [
'Name' => [
'SLA Annual',
'SLA Daily',
'SLA Monthly',
'SLA Quarterly',
'SLA Weekly',
'SLA with schedule and downtime',
'SLA для удаления - 頑張って', 'Update SLA'
]
],
'table_selector' => 'xpath://form[@id="sla"]/table',
'buttons' => ['Cancel']
];
$service_data = [
'field' => 'Service',
'headers' => ['Name', 'Tags', 'Problem tags'],
'table_selector' => 'xpath://form[@name="services_form"]/table',
'buttons' => ['Filter', 'Reset', 'Cancel'],
'check_row' => [
'Name' => 'Simple actions service',
'Tags' => 'problem: falsetest: test789',
'Problem tags' => 'problem: true'
]
];
foreach ([$sla_data, $service_data] as $dialog_data) {
$this->checkDialogContents($dialog_data);
}
foreach (['From', 'To'] as $field_label) {
$field = $filter_form->getField($field_label)->query('xpath:./input')->one();
$this->assertEquals(255, $field->getAttribute('maxlength'));
$this->assertEquals('YYYY-MM-DD', $field->getAttribute('placeholder'));
}