zbxTestLogin('zabbix.php?action=image.list'); $this->zbxTestAssertElementPresentXpath('//button[text()="Create icon"]'); $this->zbxTestCheckTitle('Configuration of images'); $this->zbxTestCheckHeader('Images'); $this->zbxTestTextPresent('Type'); $this->zbxTestDropdownHasOptions('imagetype', ['Icon', 'Background']); $db_images = DBfetchArray(DBselect('SELECT name FROM images WHERE imagetype=1 LIMIT 5')); if (!$db_images) { $this->zbxTestTextPresent('No data found.'); } else { foreach ($db_images as $db_image) { $this->zbxTestAssertElementPresentXpath("//div[@id='image']//a[text()='".$db_image['name']."']"); } } } // TODO: need background images public function testPageAdministrationGeneralImages_CheckLayoutBgImages() { $this->zbxTestLogin('zabbix.php?action=image.list'); $this->zbxTestDropdownSelectWait('imagetype', 'Background'); $this->zbxTestAssertElementPresentXpath('//button[text()="Create background"]'); $this->zbxTestCheckTitle('Configuration of images'); $this->zbxTestCheckHeader('Images'); $this->zbxTestDropdownHasOptions('imagetype', ['Icon', 'Background']); $db_images = DBfetchArray(DBselect('SELECT name FROM images WHERE imagetype=2 LIMIT 5')); if (!$db_images) { $this->zbxTestTextPresent('No data found.'); } else { foreach ($db_images as $db_image) { $this->zbxTestAssertElementPresentXpath("//div[@id='image']//a[text()='".$db_image['name']."']"); } } } /** * @dataProvider allImages */ public function testPageAdministrationGeneralImages_IconSimpleUpdate($image) { $sql_image = 'SELECT * FROM images WHERE imageid='.$image['imageid']; $old_image_hash = CDBHelper::getHash($sql_image); $this->zbxTestLogin('zabbix.php?action=image.list'); $this->zbxTestAssertElementPresentXpath('//button[text()="Create icon"]'); $this->zbxTestDropdownSelectWait('imagetype', $image['imagetype'] == IMAGE_TYPE_ICON ? 'Icon' : 'Background'); $this->zbxTestClickLinkTextWait($image['name']); $this->page->waitUntilReady(); $this->zbxTestCheckHeader('Images'); $this->zbxTestTextPresent(['Name', 'Upload', 'Image']); $this->zbxTestAssertElementPresentId('update'); $this->zbxTestAssertElementPresentId('delete'); $this->zbxTestAssertElementPresentId('cancel'); $this->zbxTestClickWait('update'); $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Image updated'); $this->assertEquals($old_image_hash, CDBHelper::getHash($sql_image)); } }