diff --git a/web/pgadmin/feature_tests/query_tool_journey_test.py b/web/pgadmin/feature_tests/query_tool_journey_test.py index 88d30a1c1..216de6926 100644 --- a/web/pgadmin/feature_tests/query_tool_journey_test.py +++ b/web/pgadmin/feature_tests/query_tool_journey_test.py @@ -429,7 +429,12 @@ class QueryToolJourneyTest(BaseFeatureTest): ActionChains(self.driver).double_click(cell_el).perform() ActionChains(self.driver).send_keys(new_value). \ send_keys(Keys.ENTER).perform() + # Check if the value was updated + # Finding element again to avoid stale element reference exception + cell_el = self.page.find_by_xpath( + "//div[contains(@style, 'top:0px')]//div[contains(@class, " + "'l{0} r{1}')]".format(cell_index, cell_index)) return int(cell_el.text) == new_value def _check_can_add_row(self): @@ -438,6 +443,8 @@ class QueryToolJourneyTest(BaseFeatureTest): def after(self): self.page.close_query_tool() - self.page.remove_server(self.server) test_utils.delete_table( self.server, self.test_db, self.test_table_name) + test_utils.delete_table( + self.server, self.test_db, self.test_editable_table_name) + self.page.remove_server(self.server) diff --git a/web/pgadmin/feature_tests/query_tool_tests.py b/web/pgadmin/feature_tests/query_tool_tests.py index a0f350320..de6c479f5 100644 --- a/web/pgadmin/feature_tests/query_tool_tests.py +++ b/web/pgadmin/feature_tests/query_tool_tests.py @@ -135,10 +135,10 @@ class QueryToolFeatureTest(BaseFeatureTest): query_op.click() # disable auto rollback only if they are enabled - self.uncheck_execute_option('auto_rollback') + self.page.uncheck_execute_option('auto_rollback') # enable autocommit only if it's disabled - self.check_execute_option('auto_commit') + self.page.check_execute_option('auto_commit') # close menu query_op.click() @@ -343,7 +343,7 @@ CREATE TABLE public.{}();""".format(table_name) query_op = self.page.find_by_css_selector( QueryToolLocators.btn_query_dropdown) query_op.click() - self.uncheck_execute_option('auto_commit') + self.page.uncheck_execute_option('auto_commit') # close option query_op.click() @@ -413,7 +413,7 @@ END;""" query_op.click() # Enable auto_commit if it is disabled - self.check_execute_option('auto_commit') + self.page.check_execute_option('auto_commit') query_op.click() @@ -492,8 +492,8 @@ END;""" query_op.click() # uncheck auto commit and check auto-rollback - self.uncheck_execute_option('auto_commit') - self.check_execute_option('auto_rollback') + self.page.uncheck_execute_option('auto_commit') + self.page.check_execute_option('auto_rollback') query_op.click() @@ -588,8 +588,8 @@ SELECT 1, pg_sleep(300)""" query_op.click() # enable auto-commit and disable auto-rollback - self.check_execute_option('auto_commit') - self.uncheck_execute_option('auto_rollback') + self.page.check_execute_option('auto_commit') + self.page.uncheck_execute_option('auto_rollback') # close drop down query_op.click() # Execute query @@ -729,38 +729,6 @@ SELECT 1, pg_sleep(300)""" self.page.clear_query_tool() - def check_execute_option(self, option): - """"This function will check auto commit or auto roll back based on - user input. If button is already checked, no action will be taken""" - if option == 'auto_commit': - check_status = self.driver.find_element_by_css_selector( - QueryToolLocators.btn_auto_commit_check_status) - if 'visibility-hidden' in check_status.get_attribute('class'): - self.page.find_by_css_selector(QueryToolLocators. - btn_auto_commit).click() - if option == 'auto_rollback': - check_status = self.driver.find_element_by_css_selector( - QueryToolLocators.btn_auto_rollback_check_status) - if 'visibility-hidden' in check_status.get_attribute('class'): - self.page.find_by_css_selector(QueryToolLocators. - btn_auto_rollback).click() - - def uncheck_execute_option(self, option): - """"This function will uncheck auto commit or auto roll back based on - user input. If button is already unchecked, no action will be taken""" - if option == 'auto_commit': - check_status = self.driver.find_element_by_css_selector( - QueryToolLocators.btn_auto_commit_check_status) - if 'visibility-hidden' not in check_status.get_attribute('class'): - self.page.find_by_css_selector(QueryToolLocators. - btn_auto_commit).click() - if option == 'auto_rollback': - check_status = self.driver.find_element_by_css_selector( - QueryToolLocators.btn_auto_rollback_check_status) - if 'visibility-hidden' not in check_status.get_attribute('class'): - self.page.find_by_css_selector(QueryToolLocators. - btn_auto_rollback).click() - class WaitForAnyElementWithText(object): def __init__(self, locator, text): diff --git a/web/pgadmin/feature_tests/view_data_dml_queries.py b/web/pgadmin/feature_tests/view_data_dml_queries.py index 14591cdae..381be22dc 100644 --- a/web/pgadmin/feature_tests/view_data_dml_queries.py +++ b/web/pgadmin/feature_tests/view_data_dml_queries.py @@ -349,8 +349,6 @@ CREATE TABLE public.nonintpkey self.page.wait_for_query_tool_loading_indicator_to_disappear() - result_row = self.page.find_by_xpath(xpath) - # Verify the List of actual values with the expected list actual_list = list(config_check_data.keys()) for value in range(0, len(actual_list)): @@ -360,14 +358,15 @@ CREATE TABLE public.nonintpkey for idx in actual_list: while retry > 0: try: + result_row = self.page.find_by_xpath(xpath) element = \ result_row.find_element_by_class_name("r" + str(idx)) + self.page.driver.execute_script( + "arguments[0].scrollIntoView(false)", element) break except Exception: print("stale reference exception at id:", idx) retry -= 1 - self.page.driver.execute_script( - "arguments[0].scrollIntoView(false)", element) time.sleep(0.4) self.assertEquals(element.text, config_check_data[str(idx)][1]) diff --git a/web/pgadmin/feature_tests/xss_checks_roles_control_test.py b/web/pgadmin/feature_tests/xss_checks_roles_control_test.py index ab4c4241e..3a6e09adb 100644 --- a/web/pgadmin/feature_tests/xss_checks_roles_control_test.py +++ b/web/pgadmin/feature_tests/xss_checks_roles_control_test.py @@ -13,6 +13,7 @@ import random from regression.python_test_utils import test_utils from regression.feature_utils.base_feature_test import BaseFeatureTest from regression.feature_utils.locators import NavMenuLocators +from regression.feature_utils.tree_area_locators import TreeAreaLocators from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait @@ -61,7 +62,8 @@ class CheckRoleMembershipControlFeatureTest(BaseFeatureTest): self.page.expand_server_node( self.server['name'], self.server['db_password']) self.page.toggle_open_tree_item('Login/Group Roles') - self.page.select_tree_item(role) + self.page.click_a_tree_node( + role, TreeAreaLocators.sub_nodes_of_login_group_node) def _check_role_membership_control(self): self.page.driver.find_element_by_link_text( diff --git a/web/pgadmin/tools/datagrid/templates/datagrid/index.html b/web/pgadmin/tools/datagrid/templates/datagrid/index.html index 9c05e641b..aaf5f91b5 100644 --- a/web/pgadmin/tools/datagrid/templates/datagrid/index.html +++ b/web/pgadmin/tools/datagrid/templates/datagrid/index.html @@ -240,7 +240,7 @@