Source
$text = $this->query('xpath://div[@id="maintenance_periods"]//tbody/tr[2]/td[2]')->waitUntilVisible()->one()->getText();
<?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;
/**
* Tests for "Configuration -> Maintenance".
*
* Forms:
* - Create maintenance.
* - Clone maintenance.
* - Delete maintenance.
*
* @backup maintenances
*/
class testFormMaintenance extends CLegacyWebTest {
public $name = 'Test maintenance';
/**
* Create maintenance with periods and host group.
*/
public function testFormMaintenance_Create() {
$this->zbxTestLogin('maintenance.php');
$this->zbxTestCheckTitle('Configuration of maintenance periods');
$this->zbxTestCheckHeader('Maintenance periods');
$this->zbxTestContentControlButtonClickTextWait('Create maintenance period');
// Type maintenance name.
$this->zbxTestInputTypeWait('mname', $this->name);
// "Periods" tab.
$this->zbxTestTabSwitchById('tab_periodsTab', 'Periods');
// Add "One time only" maintenance period.
$this->zbxTestClickXpathWait('//button[@class="btn-link" and text()="Add"]');
$this->zbxTestClickXpathWait('//div[contains(@class, "overlay-dialogue modal")]//button[text()="Add"]');
$this->zbxTestWaitUntilElementNotVisible(WebDriverBy::xpath('//div[contains(@class, "overlay-dialogue modal")]'));
$this->zbxTestAssertElementText('//ul[@id="maintenancePeriodFormList"]//tbody/tr/td','One time only');
// Add "Daily" maintenance period.
$this->zbxTestClickXpathWait('//button[@class="btn-link" and text()="Add"]');
COverlayDialogElement::find()->one()->waitUntilReady();
$this->zbxTestDropdownSelectWait('timeperiod_type', 'Daily');
$this->zbxTestClickXpathWait('//div[contains(@class, "overlay-dialogue modal")]//button[text()="Add"]');