Source
$get_user_rows = $this->webDriver->findElements(WebDriverBy::xpath('//table/tbody/tr['.$i.']/td['.$user_column_number[$user['alias']].']'));
<?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/CLegacyWebTest.php';
use Facebook\WebDriver\WebDriverBy;
class testPageReportsNotifications extends CLegacyWebTest {
public function testPageReportsNotifications_CheckLayout() {
$this->zbxTestLogin('report4.php');
$this->zbxTestCheckTitle('Notification report');
$this->zbxTestCheckHeader('Notifications');
// Check dropdown elements
$all_media = [];
foreach (CDBHelper::getAll('SELECT name FROM media_type ORDER BY LOWER(name) ASC') as $name) {
$all_media[] = $name['name'];
}
$this->zbxTestDropdownHasOptions('media_type', $all_media);
$this->zbxTestDropdownHasOptions('period', ['Daily', 'Weekly', 'Monthly', 'Yearly']);
$this->zbxTestDropdownHasOptions('year', ['2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020']);
// Check default selected dropdown values
$this->zbxTestDropdownAssertSelected('media_type', 'all');
$this->zbxTestDropdownAssertSelected('period', 'Weekly');
$this->zbxTestDropdownAssertSelected('year', date('Y'));
// Get users from DB
$user_alias = [];
$get_user_alias = DBselect('SELECT alias FROM users');
while ($row = DBfetch($get_user_alias)) {
$user_alias[] = $row['alias'];
}
sort($user_alias);
$users = [];
$elements = $this->webDriver->findElements(WebDriverBy::xpath('//th[@class="vertical_rotation"]'));
foreach ($elements as $i => $element) {
$users[] = $element->getText();
}
sort($users);
// Check that all users from DB exist in table header on page
foreach ($users as $i => $user) {
$this->assertRegexp('/^'.$user_alias[$i].'( \(.+\))*$/', $users[$i]);
}