require_once dirname(__FILE__).'/../../include/CWebTest.php';
class testMultiselects extends CWebTest {
public function testMultiselects_SuggestExisting() {
$this->checkSuggest('zabbix.php?action=problem.view&filter_reset=1', 'zbx_filter',
'Host groups', 'z', 'multiselect-suggest'
public function testMultiselects_SuggestNoMatches() {
$this->checkSuggest('zabbix.php?action=problem.view&filter_reset=1', 'zbx_filter',
'Host groups', 'QQQ', 'multiselect-matches'
public function testMultiselects_SuggestCreateNew() {
$this->checkSuggest('zabbix.php?action=host.list', 'host-form', 'Host groups', 'QQQwww',
public function checkSuggest($link, $query, $name, $string, $class) {
if ($link == 'zabbix.php?action=host.list') {
$this->page->login()->open($link)->waitUntilReady();
$this->query('button:Create host')->one()->waitUntilClickable()->click();
$this->page->login()->open($link)->waitUntilReady();
$this->page->updateViewport();
$field = $this->query('name:'.$query)->asForm()->one()->getField($name);
$element = $field->query('tag:input')->one();
$this->query('class', $class)->waitUntilVisible();
$covered_region = ($query === 'host-form')
? [$element, ['x' => 193, 'y' => 317, 'width' => 452, 'height' => 22]]
$this->assertScreenshotExcept($element->parents('class', (($query === 'host-form') ? 'form-grid' : 'table-forms'))
->one(), $covered_region, $string