Code refactoring:

- Move the duplicate code for closing the background process dialog into 'test_gui_helper.py',
- Simplify the logic by removing the duplicate steps to insert/update binary paths for each server type from 'test_utils.py'.
This commit is contained in:
Murtuza Zabuawala
2018-10-08 11:09:30 +01:00
committed by Dave Page
parent 528ea88dec
commit 0f1651686b
4 changed files with 61 additions and 96 deletions

View File

@@ -13,6 +13,7 @@ from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from regression.feature_utils.base_feature_test import BaseFeatureTest
from regression.python_test_utils import test_utils
from regression.python_test_utils import test_gui_helper
class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
@@ -138,31 +139,7 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
os.remove(backup_file)
def after(self):
self._screenshot()
# In cases where backup div is not closed (sometime due to some error)
try:
if self.driver.find_element_by_css_selector(
".ajs-message.ajs-bg-bgprocess.ajs-visible > div > "
"div > div > i"):
self.driver.find_element_by_css_selector(
".ajs-message.ajs-bg-bgprocess.ajs-visible >div >div "
">div>i").click()
except Exception:
pass
# In cases where restore div is not closed (sometime due to some error)
try:
if self.driver.find_element_by_xpath(
"//div[contains(text(), 'Process Watcher - "
"Restoring backup')]"):
self.driver.find_element_by_xpath(
"//div[div[div[div[contains(text(), 'Process Watcher "
"- Restoring backup')]]]]"
"/following-sibling::div/div/div").click()
except Exception:
pass
test_gui_helper.close_bgprocess_popup(self)
self.page.remove_server(self.server)
connection = test_utils.get_db_connection(
self.server['db'],

View File

@@ -12,6 +12,7 @@ import time
from selenium.webdriver.support.ui import WebDriverWait
from regression.feature_utils.base_feature_test import BaseFeatureTest
from regression.python_test_utils import test_utils
from regression.python_test_utils import test_gui_helper
class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest):
@@ -98,29 +99,7 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest):
"div.wcFloatingFocus div.fa-close").click()
def after(self):
# In cases where backup div is not closed
try:
if self.driver.find_element_by_css_selector(
".ajs-message.ajs-bg-bgprocess.ajs-visible"
" >div >div >div>i"):
self.driver.find_element_by_css_selector(
".ajs-message.ajs-bg-bgprocess.ajs-visible >div >div "
">div>i").click()
except Exception:
pass
# In cases where restore div is not closed (sometime due to some error)
try:
if self.driver.find_element_by_xpath(
"//div[contains(text(), 'Process Watcher - "
"Restoring backup')]"):
self.driver.find_element_by_xpath(
"//div[div[div[div[contains(text(), 'Process Watcher "
"- Restoring backup')]]]]"
"/following-sibling::div/div/div").click()
except Exception:
pass
test_gui_helper.close_bgprocess_popup(self)
self.page.remove_server(self.server)
connection = test_utils.get_db_connection(
self.server['db'],