diff options
author | Natalja Romancaka <natalja.romancaka@zabbix.com> | 2022-06-15 12:34:15 +0300 |
---|---|---|
committer | Natalja Romancaka <natalja.romancaka@zabbix.com> | 2022-06-15 12:34:15 +0300 |
commit | 1a87249790218eae15d1b38e517e4380bffbbb0f (patch) | |
tree | 9edfbc3a6ad2ebb46e599faadf6f56bdaaafd626 | |
parent | 3052bf1afdf7b42c27635a029c1cc780b3adce1f (diff) |
.......... [ZBXNEXT-686] changed Selenium tests, added hasClass function and removed Database port field area for screenshot
-rw-r--r-- | ui/tests/include/web/CElement.php | 18 | ||||
-rw-r--r-- | ui/tests/selenium/testFormSetup.php | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/ui/tests/include/web/CElement.php b/ui/tests/include/web/CElement.php index 1fd95f14912..637263bd8e2 100644 --- a/ui/tests/include/web/CElement.php +++ b/ui/tests/include/web/CElement.php @@ -740,4 +740,22 @@ class CElement extends CBaseElement implements IWaitable { public function scrollToTop() { CElementQuery::getDriver()->executeScript('arguments[0].scrollTo(0, 0)', [$this]); } + + /** + * Check presence of the class(es). + * + * @param string|array $class class or classes to be present. + * + * @return boolean + */ + function hasClass($class) { + $attribute = parent::getAttribute('class'); + $classes = ($attribute !== null) ? explode(' ', $attribute) : []; + + if (!is_array($class)) { + $class = [$class]; + } + + return (count(array_diff($class, $classes)) === 0); + } } diff --git a/ui/tests/selenium/testFormSetup.php b/ui/tests/selenium/testFormSetup.php index e8023496e8d..147f4fe055b 100644 --- a/ui/tests/selenium/testFormSetup.php +++ b/ui/tests/selenium/testFormSetup.php @@ -326,7 +326,7 @@ class testFormSetup extends CWebTest { // Check screenshot of the Pre-installation summary section. $skip_fields = []; - foreach(['Database server', 'Database name'] as $skip_field) { + foreach(['Database server', 'Database port', 'Database name'] as $skip_field) { $xpath = 'xpath://span[text()='.CXPathHelper::escapeQuotes($skip_field).']/../../div[@class="table-forms-td-right"]'; $skip_fields[] = $this->query($xpath)->one(); } |