Source
$this->assertTrue($this->query('xpath://*[not(self::script)][contains(text(),"'.$string.'")]')->count() === 0, '"'.$string.'" must not exist.');
<?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 'vendor/autoload.php';
require_once dirname(__FILE__).'/CWebTest.php';
use Facebook\WebDriver\WebDriverBy;
use Facebook\WebDriver\Exception\StaleElementReferenceException;
/**
* Base class for legacy Selenium tests.
*/
class CLegacyWebTest extends CWebTest {
const WAIT_ITERATION = 50;
// List of strings that SHOULD appear on every page.
public $failIfNotExists = [
'Zabbix Integrations',
'Help',
'Admin',
'Sign out'
];
protected function putBreak() {
fwrite(STDOUT, "\033[s \033[93m[Breakpoint] Press \033[1;93m[RETURN]\033[0;93m to continue...\033[0m");
while (fgets(STDIN, 1024) == '') {}
fwrite(STDOUT, "\033[u");
return;
}
public function authenticate() {
$this->page->login('09e7d4286dfdca4ba7be15e0f3b2b55a', 1);
}
public function authenticateUser($sessionid, $userId) {
$this->page->login($sessionid, $userId);
}
public function zbxTestOpen($url) {
$this->page->open($url);
}
public function zbxTestLogin($url, $server_name = true) {
global $ZBX_SERVER_NAME;
$this->page->login()->open($url);
if ($server_name && $ZBX_SERVER_NAME !== '') {
$this->zbxTestWaitUntilMessageTextPresent('server-name', $ZBX_SERVER_NAME);