Fixed feature test cases.

This commit is contained in:
Yogesh Mahajan 2021-11-18 17:13:32 +05:30 committed by Akshay Joshi
parent cc91e5da94
commit 246bb01736
6 changed files with 50 additions and 35 deletions

View File

@ -88,7 +88,7 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
NavMenuLocators.process_watcher_alertfier))
self.page.wait_for_element_to_disappear(
lambda driver: driver.find_element(
By.CSS_SELECTOR, ".loading-logs"), 10)
By.CSS_SELECTOR, ".loading-logs"), 18)
expected_backup_success_msg = "Successfully completed."
self.assertEqual(status, expected_backup_success_msg)
@ -157,18 +157,23 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
os.remove(backup_file)
def after(self):
test_gui_helper.close_process_watcher(self)
test_gui_helper.close_bgprocess_popup(self)
self.page.remove_server(self.server)
connection = test_utils.get_db_connection(
self.server['db'],
self.server['username'],
self.server['db_password'],
self.server['host'],
self.server['port'],
self.server['sslmode']
)
test_utils.drop_database(connection, self.database_name)
try:
test_gui_helper.close_process_watcher(self)
test_gui_helper.close_bgprocess_popup(self)
self.page.remove_server(self.server)
except Exception as e:
print("PGUtilitiesBackupFeatureTest - "
"Exception occurred in after method")
finally:
connection = test_utils.get_db_connection(
self.server['db'],
self.server['username'],
self.server['db_password'],
self.server['host'],
self.server['port'],
self.server['sslmode']
)
test_utils.drop_database(connection, self.database_name)
def _check_detailed_window_for_xss(self, tool_name):
source_code = self.page.find_by_css_selector(

View File

@ -165,19 +165,24 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest):
test_gui_helper.close_process_watcher(self)
def after(self):
test_gui_helper.close_bgprocess_popup(self)
test_utils.delete_table(self.server, self.database_name,
self.table_name)
self.page.remove_server(self.server)
connection = test_utils.get_db_connection(
self.server['db'],
self.server['username'],
self.server['db_password'],
self.server['host'],
self.server['port'],
self.server['sslmode']
)
test_utils.drop_database(connection, self.database_name)
try:
test_gui_helper.close_bgprocess_popup(self)
test_utils.delete_table(self.server, self.database_name,
self.table_name)
self.page.remove_server(self.server)
except Exception as e:
print("PGUtilitiesMaintenanceFeatureTest - "
"Exception occurred in after method")
finally:
connection = test_utils.get_db_connection(
self.server['db'],
self.server['username'],
self.server['db_password'],
self.server['host'],
self.server['port'],
self.server['sslmode']
)
test_utils.drop_database(connection, self.database_name)
def check_escaped_characters(self, source_code, string_to_find, source):
# For XSS we need to search against element's html code

View File

@ -82,7 +82,7 @@ class CheckRoleMembershipControlFeatureTest(BaseFeatureTest):
# Fetch the source code for our custom control
source_code = self.page.find_by_xpath(
"//span[contains(@class,'icon-')]/following-sibling::span"
).text
).get_attribute('innerHTML')
self._check_escaped_characters(
source_code,

View File

@ -431,7 +431,7 @@ class PgadminPage:
:param server_group_name: containing server
:param server_name:
:param server_password:
:return: true if server node is expnaded else false
:return: true if server node is expanded else false
"""
server_expanded = False
server_node_xpath = TreeAreaLocators.server_node(server_name)
@ -444,14 +444,14 @@ class PgadminPage:
self.driver.execute_script(
self.js_executor_scrollintoview_arg, server_node)
if self.check_if_element_exist_by_xpath(
server_node_exp_status_xpath, 1):
server_node_exp_status_xpath, 2):
server_expanded = True
else:
server_expanded = self.click_expand_server_node(
server_name, server_password, server_node)
if not server_expanded:
print("(expand_server_node)The Server node is not "
"expnaded", file=sys.stderr)
"expanded", file=sys.stderr)
else:
print("(expand_server_node)The Server node not found",
file=sys.stderr)
@ -478,7 +478,8 @@ class PgadminPage:
webdriver.ActionChains(self.driver).double_click(
server_node).perform()
if self.check_if_element_exist_by_xpath(
TreeAreaLocators.server_node_exp_status(server_name)):
TreeAreaLocators.server_node_exp_status(server_name),
10):
server_node_expansion_status = True
else:
if self.click_and_connect_server(server_name, server_password):
@ -586,7 +587,7 @@ class PgadminPage:
server_child_expanded = self.click_to_expand_tree_node(
child_node_ele, server_child_node_exp_status_xpath)
if not server_child_expanded:
print("Child not is not expanded after clickng ",
print("Child not is not expanded after clicking ",
file=sys.stderr)
else:
print("The server/previous nodes not expanded", file=sys.stderr)
@ -1293,7 +1294,8 @@ class PgadminPage:
top_el).perform()
r_scroll -= 1
else:
print("check_if_element_exists_with_scroll > Element NOT found")
print("check_if_element_exists_with_scroll > Element NOT found",
xpath, file=sys.stderr)
return False
def find_by_xpath_list(self, xpath):

View File

@ -1439,7 +1439,9 @@ def get_parallel_sequential_module_list(module_list):
"""
# list of files consisting tests that needs to be
# executed sequentially
sequential_tests_file = []
sequential_tests_file = [
'pgadmin.feature_tests.pg_utilities_backup_restore_test',
'pgadmin.feature_tests.pg_utilities_maintenance_test']
# list of tests can be executed in parallel
parallel_tests = list(module_list)

View File

@ -603,7 +603,8 @@ def run_parallel_tests(url_client, servers_details, parallel_tests_lists,
version_of_browser,
ser['name'])
# Launch client url in browser
test_utils.launch_url_in_browser(driver_object, url_client)
test_utils.launch_url_in_browser(
driver_object, url_client, 60)
# Add name for thread
thread_name = "parallel_tests" + ser['name']