public inbox for [email protected]help / color / mirror / Atom feed
Fixes for pgAdmin feature tests 12+ messages / 2 participants [nested] [flat]
* Fixes for pgAdmin feature tests @ 2019-11-11 04:44 Shubham Agarwal <[email protected]> 0 siblings, 1 reply; 12+ messages in thread From: Shubham Agarwal @ 2019-11-11 04:44 UTC (permalink / raw) To: pgadmin-hackers Hi Team, Attached is the patch containing fixes for the failed feature test cases. This patch contains- 1. Newly created function for traversing the browser tree. 2. Some synchronization issue fixes. 3. Modified locators. 4. Test cases fix for the recent commits. -- Thanks & Regards, Shubham Agarwal EnterpriseDB Corporation The Postgres Database Company Attachments: [application/octet-stream] feature_test_fix.patch (52.6K, 3-feature_test_fix.patch) download | inline diff: diff --git a/web/pgadmin/feature_tests/browser_tool_bar_test.py b/web/pgadmin/feature_tests/browser_tool_bar_test.py index 9e1ff74cb..28fcb4068 100644 --- a/web/pgadmin/feature_tests/browser_tool_bar_test.py +++ b/web/pgadmin/feature_tests/browser_tool_bar_test.py @@ -47,7 +47,7 @@ class BrowserToolBarFeatureTest(BaseFeatureTest): file=sys.stderr, end="") self.test_view_data_tool_button() print("OK.", file=sys.stderr) - + # # Check for filtered rows button print("\nFiltered Rows ToolBar Button ", file=sys.stderr, end="") @@ -60,9 +60,9 @@ class BrowserToolBarFeatureTest(BaseFeatureTest): self.test_table_name) def test_query_tool_button(self): - self.page.toggle_open_tree_item(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item(self.test_db) + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.test_db) self.page.retry_click( (By.CSS_SELECTOR, BrowserToolBarLocators.open_query_tool_button_css), @@ -70,9 +70,12 @@ class BrowserToolBarFeatureTest(BaseFeatureTest): def test_view_data_tool_button(self): self.page.select_tree_item(self.test_db) - self.page.toggle_open_tree_item('Schemas') - self.page.toggle_open_tree_item('public') - self.page.toggle_open_tables_node() + self.page.toggle_open_schema_node( + self.server['name'], self.server['db_password'], + self.test_db, 'public') + self.page.toggle_open_tables_node( + self.server['name'], self.server['db_password'], + self.test_db, 'public') self.page.select_tree_item(self.test_table_name) self.page.retry_click( diff --git a/web/pgadmin/feature_tests/copy_selected_query_results_feature_test.py b/web/pgadmin/feature_tests/copy_selected_query_results_feature_test.py index 9bb458710..9ac8be6f4 100644 --- a/web/pgadmin/feature_tests/copy_selected_query_results_feature_test.py +++ b/web/pgadmin/feature_tests/copy_selected_query_results_feature_test.py @@ -39,9 +39,9 @@ class CopySelectedQueryResultsFeatureTest(BaseFeatureTest): self.server, self.test_db, self.test_table_name) def runTest(self): - self.page.toggle_open_tree_item(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item(self.test_db) + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.test_db) self.page.open_query_tool() self.page.fill_codemirror_area_with( @@ -70,7 +70,7 @@ class CopySelectedQueryResultsFeatureTest(BaseFeatureTest): QueryToolLocators.copy_button_css) copy_button.click() - self.assertEqual('"Some-Name"\t"6"\t"some info"', + self.assertEqual('"Some-Name"\t6\t"some info"', pyperclip.paste()) def _copies_rows_with_header(self): @@ -87,9 +87,9 @@ class CopySelectedQueryResultsFeatureTest(BaseFeatureTest): copy_button.click() self.assertEqual("""\"some_column"\t"value"\t"details" -\"Some-Name"\t"6"\t"some info" -\"Some-Other-Name"\t"22"\t"some other info" -\"Yet-Another-Name"\t"14"\t"cool info\"""", pyperclip.paste()) +\"Some-Name"\t6\t"some info" +\"Some-Other-Name"\t22\t"some other info" +\"Yet-Another-Name"\t14\t"cool info\"""", pyperclip.paste()) def _copies_columns(self): pyperclip.copy("old clipboard contents") @@ -116,7 +116,7 @@ class CopySelectedQueryResultsFeatureTest(BaseFeatureTest): ActionChains(self.page.driver).key_down( Keys.CONTROL).send_keys('c').key_up(Keys.CONTROL).perform() - self.assertEqual('"Some-Name"\t"6"\t"some info"', + self.assertEqual('"Some-Name"\t6\t"some info"', pyperclip.paste()) def _copies_column_using_keyboard_shortcut(self): @@ -154,8 +154,8 @@ class CopySelectedQueryResultsFeatureTest(BaseFeatureTest): self.page.driver ).key_down(Keys.CONTROL).send_keys('c').key_up(Keys.CONTROL).perform() - self.assertEqual("""\"Some-Other-Name"\t"22" -"Yet-Another-Name"\t"14\"""", pyperclip.paste()) + self.assertEqual( + '"Some-Other-Name"\t22\n"Yet-Another-Name"\t14', pyperclip.paste()) def _shift_resizes_rectangular_selection(self): pyperclip.copy("old clipboard contents") @@ -180,8 +180,8 @@ class CopySelectedQueryResultsFeatureTest(BaseFeatureTest): Keys.CONTROL ).send_keys('c').key_up(Keys.CONTROL).perform() - self.assertEqual("""\"Some-Other-Name"\t"22"\t"some other info" -"Yet-Another-Name"\t"14"\t"cool info\"""", pyperclip.paste()) + self.assertEqual("""\"Some-Other-Name"\t22\t"some other info" +"Yet-Another-Name"\t14\t"cool info\"""", pyperclip.paste()) def _shift_resizes_column_selection(self): pyperclip.copy("old clipboard contents") @@ -198,9 +198,7 @@ class CopySelectedQueryResultsFeatureTest(BaseFeatureTest): Keys.CONTROL).send_keys('c').key_up(Keys.CONTROL).perform() self.assertEqual( - """\"Some-Name"\t"6" -"Some-Other-Name"\t"22" -"Yet-Another-Name"\t"14\"""", + '"Some-Name"\t6\n"Some-Other-Name"\t22\n"Yet-Another-Name"\t14', pyperclip.paste()) def _mouseup_outside_grid_still_makes_a_selection(self): diff --git a/web/pgadmin/feature_tests/file_manager_test.py b/web/pgadmin/feature_tests/file_manager_test.py index dd2a7855f..c76f20386 100644 --- a/web/pgadmin/feature_tests/file_manager_test.py +++ b/web/pgadmin/feature_tests/file_manager_test.py @@ -60,9 +60,9 @@ class CheckFileManagerFeatureTest(BaseFeatureTest): print("OK.", file=sys.stderr) def _navigate_to_query_tool(self): - self.page.toggle_open_tree_item(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item(self.test_db) + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.test_db) self.page.open_query_tool() def _create_new_file(self): diff --git a/web/pgadmin/feature_tests/pg_datatype_validation_test.py b/web/pgadmin/feature_tests/pg_datatype_validation_test.py index 2de897cc5..eb93be7cf 100644 --- a/web/pgadmin/feature_tests/pg_datatype_validation_test.py +++ b/web/pgadmin/feature_tests/pg_datatype_validation_test.py @@ -149,9 +149,9 @@ class PGDataypeFeatureTest(BaseFeatureTest): self.page.remove_server(self.server) def _schema_node_expandable(self): - self.page.toggle_open_tree_item(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item(self.test_db) + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.test_db) def _check_datatype(self): # Slick grid does not render all the column if viewport is not enough diff --git a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py index 6b99fdb7d..8659dd0e0 100644 --- a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py +++ b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py @@ -64,9 +64,9 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest): test_gui_helper.close_bgprocess_popup(self) def runTest(self): - self.page.toggle_open_server(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item(self.database_name) + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.database_name) # Backup self.page.retry_click( @@ -115,11 +115,11 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest): self.assertEquals(status, "Successfully completed.") - self.page.find_by_css_selector( - NavMenuLocators.status_alertifier_more_btn_css).click() - - self.wait.until(EC.visibility_of_element_located( - (By.XPATH, NavMenuLocators.process_watcher_alertfier))) + self.page.retry_click( + (By.CSS_SELECTOR, + NavMenuLocators.status_alertifier_more_btn_css), + (By.XPATH, + NavMenuLocators.process_watcher_alertfier)) backup_file = None # Check for XSS in Backup details @@ -143,9 +143,7 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest): backup_file = command[int(command.find('--file')) + 8:int(command.find('--host')) - 2] - close_btn = self.page.find_by_xpath( - NavMenuLocators.process_watcher_close_button_xpath) - close_btn.click() + test_gui_helper.close_process_watcher(self) # Restore tools_menu = self.driver.find_element_by_link_text( @@ -186,11 +184,11 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest): self.assertEquals(status, "Successfully completed.") - self.page.find_by_css_selector( - NavMenuLocators.status_alertifier_more_btn_css).click() - - self.wait.until(EC.visibility_of_element_located( - (By.XPATH, NavMenuLocators.process_watcher_alertfier))) + self.page.retry_click( + (By.CSS_SELECTOR, + NavMenuLocators.status_alertifier_more_btn_css), + (By.XPATH, + NavMenuLocators.process_watcher_alertfier)) # Check for XSS in Restore details if self.is_xss_check: @@ -206,9 +204,7 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest): self.assertIn("pg_restore", str(command)) - close_watcher = self.page.find_by_xpath( - NavMenuLocators.process_watcher_close_button_xpath) - close_watcher.click() + test_gui_helper.close_process_watcher(self) if backup_file is not None: if os.path.isfile(backup_file): diff --git a/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py b/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py index 5eb521be7..b50c2b6fa 100644 --- a/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py +++ b/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py @@ -90,20 +90,22 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest): self.verify_command() def _open_maintenance_dialogue(self): - self.page.toggle_open_server(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item(self.database_name) + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.database_name) if self.test_level == 'table': - self.page.toggle_open_tree_item('Schemas') - self.page.toggle_open_tree_item('public') - self.page.toggle_open_tables_node() + self.page.toggle_open_schema_node(self.server['name'], + self.server['db_password'], + self.database_name, 'public') + self.page.toggle_open_tables_node(self.server['name'], + self.server['db_password'], + self.database_name, 'public') self.page.select_tree_item(self.table_name) self.page.retry_click( (By.LINK_TEXT, NavMenuLocators.tools_menu_link_text), (By.CSS_SELECTOR, NavMenuLocators.maintenance_obj_css)) - maintenance_obj = self.wait.until(EC.visibility_of_element_located( (By.CSS_SELECTOR, NavMenuLocators.maintenance_obj_css))) maintenance_obj.click() @@ -118,11 +120,12 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest): test_gui_helper.close_bgprocess_popup(self) self.assertEquals(status, "Successfully completed.") - self.page.find_by_css_selector( - NavMenuLocators.status_alertifier_more_btn_css).click() - self.wait.until(EC.visibility_of_element_located( - (By.XPATH, NavMenuLocators.process_watcher_alertfier))) + self.page.retry_click( + (By.CSS_SELECTOR, + NavMenuLocators.status_alertifier_more_btn_css), + (By.XPATH, + NavMenuLocators.process_watcher_alertfier)) command = self.page.find_by_css_selector( NavMenuLocators. @@ -148,13 +151,12 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest): "\nVACUUM VERBOSE" " public." + self.table_name + ";") - self.page.find_by_xpath( - NavMenuLocators.process_watcher_close_button_xpath).click() + test_gui_helper.close_process_watcher(self) def after(self): test_gui_helper.close_bgprocess_popup(self) self.page.remove_server(self.server) - test_utils.delete_table(self.server, self.test_db, + test_utils.delete_table(self.server, self.database_name, self.table_name) connection = test_utils.get_db_connection( self.server['db'], diff --git a/web/pgadmin/feature_tests/query_tool_auto_complete_tests.py b/web/pgadmin/feature_tests/query_tool_auto_complete_tests.py index 1f6e248ce..fe6d68e4d 100644 --- a/web/pgadmin/feature_tests/query_tool_auto_complete_tests.py +++ b/web/pgadmin/feature_tests/query_tool_auto_complete_tests.py @@ -56,9 +56,9 @@ class QueryToolAutoCompleteFeatureTest(BaseFeatureTest): test_utils.create_table(self.server, self.test_db, self.second_table_name) - self.page.toggle_open_tree_item(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item(self.test_db) + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.test_db) self.page.open_query_tool() self.page.wait_for_spinner_to_disappear() diff --git a/web/pgadmin/feature_tests/query_tool_journey_test.py b/web/pgadmin/feature_tests/query_tool_journey_test.py index 937cd97a8..88d30a1c1 100644 --- a/web/pgadmin/feature_tests/query_tool_journey_test.py +++ b/web/pgadmin/feature_tests/query_tool_journey_test.py @@ -103,7 +103,7 @@ class QueryToolJourneyTest(BaseFeatureTest): QueryToolLocators.copy_button_css) copy_row.click() - self.assertEqual('"Some-Name"\t"6"\t"some info"', + self.assertEqual('"Some-Name"\t6\t"some info"', pyperclip.paste()) def _test_copies_columns(self): @@ -380,9 +380,9 @@ class QueryToolJourneyTest(BaseFeatureTest): self.page.click_modal('Yes') def _navigate_to_query_tool(self): - self.page.toggle_open_tree_item(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item(self.test_db) + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.test_db) self.page.open_query_tool() self.page.wait_for_spinner_to_disappear() diff --git a/web/pgadmin/feature_tests/query_tool_tests.py b/web/pgadmin/feature_tests/query_tool_tests.py index ca9ee5091..413811dc2 100644 --- a/web/pgadmin/feature_tests/query_tool_tests.py +++ b/web/pgadmin/feature_tests/query_tool_tests.py @@ -35,9 +35,9 @@ class QueryToolFeatureTest(BaseFeatureTest): def before(self): self.page.wait_for_spinner_to_disappear() self.page.add_server(self.server) - self.page.toggle_open_tree_item(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item(self.test_db) + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.test_db) self.page.open_query_tool() self.page.wait_for_spinner_to_disappear() self._reset_options() @@ -254,7 +254,7 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format( ) # Table height takes some time to update, for which their is no # particular way - time.sleep(1) + time.sleep(2) if canvas_ele.size['height'] == scrolling_height: break else: diff --git a/web/pgadmin/feature_tests/table_ddl_feature_test.py b/web/pgadmin/feature_tests/table_ddl_feature_test.py index 12a293728..26f231ef9 100644 --- a/web/pgadmin/feature_tests/table_ddl_feature_test.py +++ b/web/pgadmin/feature_tests/table_ddl_feature_test.py @@ -32,12 +32,12 @@ class TableDdlFeatureTest(BaseFeatureTest): test_utils.create_table(self.server, self.test_db, self.test_table_name) - self.page.toggle_open_server(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item(self.test_db) - self.page.toggle_open_tree_item('Schemas') - self.page.toggle_open_tree_item('public') - self.page.toggle_open_tree_item('Tables') + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.test_db) + self.page.toggle_open_tables_node( + self.server['name'], self.server['db_password'], + self.test_db, 'public') self.page.select_tree_item(self.test_table_name) self.page.click_tab("SQL") diff --git a/web/pgadmin/feature_tests/view_data_dml_queries.py b/web/pgadmin/feature_tests/view_data_dml_queries.py index 09dd6d046..6ea8d506c 100644 --- a/web/pgadmin/feature_tests/view_data_dml_queries.py +++ b/web/pgadmin/feature_tests/view_data_dml_queries.py @@ -122,12 +122,12 @@ CREATE TABLE public.nonintpkey self.page.wait_for_spinner_to_disappear() self.page.add_server(self.server) - self.page.toggle_open_tree_item(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item(self.test_db) - self.page.toggle_open_tree_item('Schemas') - self.page.toggle_open_tree_item('public') - self.page.toggle_open_tree_item('Tables') + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.test_db) + self.page.toggle_open_tables_node(self.server['name'], + self.server['db_password'], + self.test_db, 'public') self._load_config_data('table_insert_update_cases') # iterate on both tables @@ -349,13 +349,13 @@ CREATE TABLE public.nonintpkey element = result_row.find_element_by_class_name("r" + str(idx)) self.page.driver.execute_script( "arguments[0].scrollIntoView(false)", element) - - self.assertEquals(element.text, config_check_data[str(idx)][1]) + time.sleep(0.4) self.assertEquals(element.text, config_check_data[str(idx)][1]) # scroll browser back to the left # to reset position so other assertions can succeed for idx in reversed(list(config_check_data.keys())): + time.sleep(0.4) element = result_row.find_element_by_class_name("r" + str(idx)) self.page.driver.execute_script( "arguments[0].scrollIntoView(false)", element) diff --git a/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py b/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py index 335d2c8db..aed1f36f1 100644 --- a/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py +++ b/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py @@ -94,12 +94,12 @@ class CheckForXssFeatureTest(BaseFeatureTest): self.server, self.test_db, self.test_table_name) def _tables_node_expandable(self): - self.page.toggle_open_server(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item(self.test_db) - self.page.toggle_open_tree_item('Schemas') - self.page.toggle_open_tree_item('public') - self.page.toggle_open_tree_item('Tables') + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.test_db) + self.page.toggle_open_tables_node(self.server['name'], + self.server['db_password'], + self.test_db, 'public') self.page.select_tree_item(self.test_table_name) def _check_xss_in_browser_tree(self): diff --git a/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py b/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py index 70ae11d13..b42d3f12d 100644 --- a/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py +++ b/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py @@ -39,10 +39,10 @@ class CheckDebuggerForXssFeatureTest(BaseFeatureTest): self.function_name = "a_test_function" + \ str(random.randint(10000, 65535)) test_utils.create_debug_function( - self.server, "postgres", self.function_name + self.server, self.test_db, self.function_name ) - if test_utils.does_function_exist(self.server, 'postgres', + if test_utils.does_function_exist(self.server, self.test_db, self.function_name) != 'True': raise Exception("The required function is not found") @@ -54,15 +54,16 @@ class CheckDebuggerForXssFeatureTest(BaseFeatureTest): def after(self): self.page.remove_server(self.server) - test_utils.drop_debug_function(self.server, "postgres", + test_utils.drop_debug_function(self.server, self.test_db, self.function_name) def _function_node_expandable(self): - self.page.toggle_open_server(self.server['name']) - self.page.toggle_open_tree_item('Databases') - self.page.toggle_open_tree_item('postgres') - self.page.toggle_open_tree_item('Schemas') - self.page.toggle_open_tree_item('public') + self.page.expand_database_node( + self.server['name'], + self.server['db_password'], self.test_db) + self.page.toggle_open_schema_node(self.server['name'], + self.server['db_password'], + self.test_db, 'public') self.page.toggle_open_function_node() self.page.select_tree_item(self.function_name + "()") 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 bf0013597..ab4c4241e 100644 --- a/web/pgadmin/feature_tests/xss_checks_roles_control_test.py +++ b/web/pgadmin/feature_tests/xss_checks_roles_control_test.py @@ -58,7 +58,8 @@ class CheckRoleMembershipControlFeatureTest(BaseFeatureTest): "<h1>test</h1>") def _role_node_expandable(self, role): - self.page.toggle_open_server(self.server['name']) + 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) @@ -93,6 +94,6 @@ class CheckRoleMembershipControlFeatureTest(BaseFeatureTest): """This will click and open membership tab of role""" self.page.retry_click( - (By.XPATH, - "//a[normalize-space(text())='Membership']"), + (By.LINK_TEXT, + "Membership"), (By.XPATH, "//input[@placeholder='Select members']")) diff --git a/web/regression/feature_utils/locators.py b/web/regression/feature_utils/locators.py index f37afddd5..847e457d3 100644 --- a/web/regression/feature_utils/locators.py +++ b/web/regression/feature_utils/locators.py @@ -87,7 +87,7 @@ class NavMenuLocators: ".bg-process-details .bg-detailed-desc" process_watcher_close_button_xpath = \ - "//div[contains(@class,'wcFloatingFocus')]//" \ + "//div[contains(@class,'wcFloating')]//" \ "div[contains(@class,'fa-close')]" restore_file_name_xpath = "//div[contains(text(),'Restore')]" \ @@ -227,3 +227,20 @@ class QueryToolLocators: read_only_column_icon_xpath = "//div[contains(@class," \ " 'editable-column-header-icon')]" \ "/i[contains(@class, 'fa-lock')]" + + +class ConnectToServerDiv: + # This will contain xpaths for element relating to Connect to server div + + password_field = "//input[@id='password']" + + ok_button = \ + "//div [@class='alertify ajs-modeless ajs-movable ajs-zoom']" \ + "//button[text()='OK']" + + error_message = \ + "//form[@id='frmPassword']/div/div//div[@class='alert-text']" + + cancel_button = \ + "//div [@class='alertify ajs-modeless ajs-movable ajs-zoom']" \ + "//button[text()='Cancel']" diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py index 24d3bc9b5..05bc7408a 100644 --- a/web/regression/feature_utils/pgadmin_page.py +++ b/web/regression/feature_utils/pgadmin_page.py @@ -21,7 +21,7 @@ from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from regression.feature_utils.locators import QueryToolLocators, \ - NavMenuLocators + NavMenuLocators, ConnectToServerDiv from regression.feature_utils.tree_area_locators import TreeAreaLocators @@ -245,14 +245,6 @@ class PgadminPage: if attempts == 0: raise Exception(e) - def get_expansion_status_of_node(self, xpath_node): - """get the expansion status for a node through xpath""" - node_is_expanded = False - element = self.find_by_xpath(xpath_node) - if element.get_attribute("aria-expanded") == 'true': - node_is_expanded = True - return node_is_expanded - def toggle_open_servers_group(self): """This will open Servers group to display underlying nodes""" is_expanded = False @@ -280,50 +272,238 @@ class PgadminPage: file=sys.stderr) return is_expanded - def toggle_open_tree_item(self, tree_item_text): - # 'sleep' here helps in cases where underlying nodes are auto opened. - # Otherwise, encountered situations where False value is returned - # even if the underlying node to be clicked was Opened. - time.sleep(.6) - item_with_text = self.find_by_xpath( - TreeAreaLocators.specified_tree_node.format(tree_item_text)) - - self.driver.execute_script("arguments[0].scrollIntoView()", - item_with_text) - - if item_with_text.find_element_by_xpath( - ".//ancestor::*[@class='aciTreeLine']").get_attribute( - "aria-expanded") == 'false': - item = item_with_text.find_element_by_xpath( - ".//parent::*[@class='aciTreeItem']") - ActionChains(self.driver).double_click(item).perform() - retry = 3 - while retry > 0: - try: - WebDriverWait(self.driver, 5).until((lambda item_with_text: ( - item_with_text.find_element_by_xpath( - ".//ancestor::*[@class='aciTreeLine']"). - get_attribute("aria-expanded") == 'true'))) - break - except TimeoutException: - retry -= 1 - pass - - def toggle_open_tables_node(self): - """The function will be used for opening Tables node only""" - - # get the element which contains 'aria-expanded' info - tables_expansion_ele = self.find_by_xpath("//div[div[div[div[div[div" - "[div[div[span[span[" - "(@class='aciTreeText') and " - "text()='Tables']]]]]]]]]]") - - if tables_expansion_ele.get_attribute('aria-expanded') == 'false': - # button element of the Tables node to open it - item_button = self.find_by_xpath( - "//div[span[span[(@class='aciTreeText') and text()" - "='Tables']]]/span[@class='aciTreeButton']") - ActionChains(self.driver).click(item_button).perform() + def expand_server_node(self, server_name, server_password): + """will expand a particular server node""" + server_node_expansion_status = False + if self.toggle_open_servers_group(): + if self.wait_for_elements_to_appear( + self.driver, + TreeAreaLocators.server_group_sub_nodes): + subnodes_of_servers = self.find_by_xpath_list( + TreeAreaLocators.server_group_sub_nodes) + subnodes_of_servers_expansion_status = \ + self.find_by_xpath_list( + TreeAreaLocators. + server_group_sub_nodes_exp_status) + index_of_server_node = self.get_index_of_element( + subnodes_of_servers, server_name) + + if not self.check_server_is_connected( + index_of_server_node): + if self.click_and_connect_server( + subnodes_of_servers[index_of_server_node], + server_password): + server_node_expansion_status = True + else: + print( + "(expand_server_node)The server node is " + "not expanded", + file=sys.stderr) + else: + if not self.get_expansion_status_of_node_element( + subnodes_of_servers_expansion_status[ + index_of_server_node]): + webdriver.ActionChains(self.driver).double_click( + subnodes_of_servers[ + index_of_server_node]).perform() + if self.wait_for_elements_to_appear( + self.driver, TreeAreaLocators. + sub_nodes_of_a_server_node(server_name), + 30): + server_node_expansion_status = True + else: + server_node_expansion_status = True + else: + print( + "(expand_server_node) The Servers node is" + " not expanded", + file=sys.stderr) + return server_node_expansion_status + + def expand_databases_node(self, server_name, server_password): + """will expand databases node under server node""" + databases_node_expanded = False + if self.expand_server_node(server_name, server_password): + if self.wait_for_elements_to_appear( + self.driver, + TreeAreaLocators.sub_nodes_of_a_server_node(server_name)): + subnodes_of_server_node = self.find_by_xpath_list( + TreeAreaLocators.sub_nodes_of_a_server_node(server_name)) + subnode_of_server_node_exp_status = self.find_by_xpath_list( + TreeAreaLocators.sub_nodes_of_a_server_node_exp_status( + server_name)) + index_of_databases_node = self.get_index_of_element( + subnodes_of_server_node, + "Databases") + time.sleep(2) + expansion_status = self.get_expansion_status_of_node_element( + subnode_of_server_node_exp_status[index_of_databases_node]) + if not expansion_status: + retry = 5 + while retry > 0: + webdriver.ActionChains(self.driver).double_click( + subnodes_of_server_node[ + index_of_databases_node].find_element_by_xpath( + ".//*[@class='aciTreeItem']") + ).perform() + if self.wait_for_elements_to_appear( + self.driver, TreeAreaLocators. + sub_nodes_of_databases_node(server_name), 3): + databases_node_expanded = True + break + else: + retry -= 1 + else: + databases_node_expanded = True + else: + print("The server/previous nodes not expanded", + file=sys.stderr) + return databases_node_expanded + + def expand_database_node(self, server_name, server_password, + name_of_database): + """will expand database node under databases node""" + db_node_expanded_status = False + if self.expand_databases_node(server_name, server_password): + sub_nodes_of_databases_node = self.find_by_xpath_list( + TreeAreaLocators.sub_nodes_of_databases_node(server_name)) + index_of_required_db_node = self.get_index_of_element( + sub_nodes_of_databases_node, + name_of_database) + expansion_status = self.get_expansion_status_of_node_element( + self.find_by_xpath_list( + TreeAreaLocators. + sub_nodes_of_databases_node_exp_status( + server_name))[ + index_of_required_db_node]) + if not expansion_status: + self.driver.execute_script("arguments[0].scrollIntoView()", + sub_nodes_of_databases_node[ + index_of_required_db_node]) + webdriver.ActionChains(self.driver).double_click( + sub_nodes_of_databases_node[ + index_of_required_db_node]).perform() + if self.wait_for_elements_to_appear( + self.driver, TreeAreaLocators. + sub_nodes_of_database_node( + name_of_database)): + db_node_expanded_status = True + else: + db_node_expanded_status = True + else: + print("The databases/previous nodes not expanded", + file=sys.stderr) + return db_node_expanded_status + + def toggle_open_schemas_node(self, server_name, server_password, + name_of_database): + """will expand schemas node under a db node""" + expansion_status = False + if self.expand_database_node(server_name, server_password, + name_of_database): + sub_nodes_db_node = self.find_by_xpath_list( + TreeAreaLocators.sub_nodes_of_database_node( + name_of_database)) + index_of_schemas_node = self.get_index_of_element( + sub_nodes_db_node, "Schemas") + expansion_status = self.get_expansion_status_of_node_element( + self.find_by_xpath_list( + TreeAreaLocators.sub_nodes_of_database_node_exp_status( + name_of_database))[ + index_of_schemas_node]) + if not expansion_status: + self.driver.execute_script( + "arguments[0].scrollIntoView()", + sub_nodes_db_node[index_of_schemas_node]) + webdriver.ActionChains(self.driver).double_click( + sub_nodes_db_node[index_of_schemas_node]).perform() + if self.wait_for_elements_to_appear( + self.driver, TreeAreaLocators. + sub_nodes_of_schemas_node(name_of_database)): + expansion_status = True + else: + expansion_status = True + else: + print( + "(expand_schemas_node) database/previous nodes " + "are not expanded", + file=sys.stderr) + return expansion_status + + def toggle_open_schema_node( + self, server_name, server_password, + name_of_database, name_of_schema_node): + """will expand schema node under schemas node""" + expansion_status = False + if self.toggle_open_schemas_node( + server_name, server_password, name_of_database): + sub_nodes_schemas_node = self.find_by_xpath_list( + TreeAreaLocators.sub_nodes_of_schemas_node( + name_of_database)) + index_of_schema_node = self.get_index_of_element( + sub_nodes_schemas_node, + name_of_schema_node) + expansion_status = self.get_expansion_status_of_node_element( + self.find_by_xpath_list( + TreeAreaLocators.sub_nodes_of_schemas_node_exp_status( + name_of_database))[ + index_of_schema_node]) + if not expansion_status: + self.driver.execute_script( + "arguments[0].scrollIntoView()", + sub_nodes_schemas_node[index_of_schema_node]) + webdriver.ActionChains(self.driver).double_click( + sub_nodes_schemas_node[index_of_schema_node]).perform() + if self.wait_for_elements_to_appear( + self.driver, TreeAreaLocators. + sub_nodes_of_schema_node(name_of_database)): + expansion_status = True + else: + expansion_status = True + else: + print( + "(expand_schema_node) schema/previous nodes are" + " not expanded", + file=sys.stderr) + return expansion_status + + def toggle_open_tables_node( + self, server_name, server_password, + name_of_database, name_of_schema_node): + """will expand tables node under schema node""" + node_expanded_successfully = False + if self.toggle_open_schema_node( + server_name, server_password, name_of_database, + name_of_schema_node): + sub_nodes_of_schema_node = self.find_by_xpath_list( + TreeAreaLocators.sub_nodes_of_schema_node( + name_of_database)) + sub_nodes_of_schema_node_exp_status = self.find_by_xpath_list( + TreeAreaLocators.sub_nodes_of_schema_node_exp_status( + name_of_database)) + index_of_tables_node = self.get_index_of_element( + sub_nodes_of_schema_node, "Tables") + expansion_status = self.get_expansion_status_of_node_element( + sub_nodes_of_schema_node_exp_status[index_of_tables_node]) + if not expansion_status: + self.driver.execute_script("arguments[0].scrollIntoView()", + sub_nodes_of_schema_node[ + index_of_tables_node]) + webdriver.ActionChains(self.driver).double_click( + sub_nodes_of_schema_node[ + index_of_tables_node]).perform() + if self.wait_for_elements_to_appear( + self.driver, TreeAreaLocators. + sub_nodes_of_tables_node): + node_expanded_successfully = True + else: + node_expanded_successfully = True + else: + print( + "(expand_tables_node) schema/previous nodes " + "are not expanded", + file=sys.stderr) + return node_expanded_successfully def toggle_open_function_node(self): """The function will be used for opening Functions node only""" @@ -379,6 +559,124 @@ class PgadminPage: else: node_expanded = True + def check_server_is_connected(self, index_of_server): + """This will check connected status of a server, as connection + status is contained either in span or div element so checking it""" + server_connected = False + try: + connection_status_elements = self.find_by_xpath_list( + TreeAreaLocators.server_group_sub_nodes_connected_status) + span_elements = connection_status_elements[ + index_of_server].find_elements_by_tag_name("span") + div_elements = connection_status_elements[ + index_of_server].find_elements_by_tag_name("div") + + span_value_of_class_att = "" + div_value_of_class_att = "" + + if len(span_elements) > 0: + span_value_of_class_att = \ + span_elements[0].get_attribute('class') + if len(div_elements) > 0: + div_value_of_class_att = \ + div_elements[0].get_attribute('class') + if (("aciTreeIcon icon-pg" in span_value_of_class_att or + "aciTreeIcon icon-pg" in div_value_of_class_att or + "aciTreeIcon icon-ppas" in + span_value_of_class_att or + "aciTreeIcon icon-ppas" in div_value_of_class_att) and + ("aciTreeIcon icon-server-not-connected" not in + span_value_of_class_att or + "aciTreeIcon icon-server-not-connected" not in + div_value_of_class_att)): + server_connected = True + except Exception as e: + print("There is some exception thrown in the function " + "check_server_is_connected and is: " + str(e), + file=sys.stderr) + return server_connected + + def click_and_connect_server(self, server_element, password): + """will connect a server node, will provide the password in the + respective window""" + server_connection_status = False + try: + webdriver.ActionChains(self.driver).double_click( + server_element).perform() + if self.wait_for_element_to_appear(self.driver, + ConnectToServerDiv.ok_button): + self.fill_input_by_xpath( + ConnectToServerDiv.password_field, password) + self.find_by_xpath(ConnectToServerDiv.ok_button).click() + self.wait_until_element_not_visible( + ConnectToServerDiv.ok_button) + if self.wait_for_element_to_be_visible( + self.driver, ConnectToServerDiv.error_message, 2): + print( + "While entering password in click_and_connect_server " + "function, error is occurred : " + str( + self.find_by_xpath( + ConnectToServerDiv.error_message).text), + file=sys.stderr) + else: + server_connection_status = True + except Exception as e: + print( + "There is some exception thrown click_and_connect_server " + "and is: " + str( + e), file=sys.stderr) + return server_connection_status + + def get_expansion_status_of_node(self, xpath_node): + """get the expansion status for a node through xpath""" + node_is_expanded = False + element = self.find_by_xpath(xpath_node) + if element.get_attribute("aria-expanded") == 'true': + node_is_expanded = True + return node_is_expanded + + def get_expansion_status_of_node_element(self, element): + """get the expansion status for an element""" + node_is_expanded = False + try: + if element.get_attribute("aria-expanded") == 'true': + node_is_expanded = True + except Exception as e: + print( + "There is some exception thrown in the function " + "get_expansion_status_of_node_element and is: " + str( + e), file=sys.stderr) + return node_is_expanded + + def toggle_open_tree_item(self, tree_item_text): + # 'sleep' here helps in cases where underlying nodes are auto opened. + # Otherwise, encountered situations where False value is returned + # even if the underlying node to be clicked was Opened. + time.sleep(.6) + item_with_text = self.find_by_xpath( + TreeAreaLocators.specified_tree_node.format(tree_item_text)) + + self.driver.execute_script("arguments[0].scrollIntoView()", + item_with_text) + + if item_with_text.find_element_by_xpath( + ".//ancestor::*[@class='aciTreeLine']").get_attribute( + "aria-expanded") == 'false': + item = item_with_text.find_element_by_xpath( + ".//parent::*[@class='aciTreeItem']") + ActionChains(self.driver).double_click(item).perform() + retry = 3 + while retry > 0: + try: + WebDriverWait(self.driver, 5).until((lambda item_with_text: ( + item_with_text.find_element_by_xpath( + ".//ancestor::*[@class='aciTreeLine']"). + get_attribute("aria-expanded") == 'true'))) + break + except TimeoutException: + retry -= 1 + pass + def toggle_open_server(self, tree_item_text): def check_for_password_dialog_or_tree_open(driver): try: @@ -692,6 +990,19 @@ class PgadminPage: return self._wait_for("element to exist", element_if_it_exists) + def wait_for_elements_to_appear(self, driver, locator, time_value=20): + """This will wait until list of elements or an element is visible, + The time out value is userdefined""" + elements_located_status = False + try: + if WebDriverWait(driver, time_value).until( + EC.visibility_of_any_elements_located(( + By.XPATH, locator))): + elements_located_status = True + except Exception as e: + pass + return elements_located_status + def find_by_xpath_list(self, xpath): """This will find out list of elements through a single xpath""" return self.wait_for_elements( @@ -749,11 +1060,11 @@ class PgadminPage: click_status = False attempt = 0 - while click_status is not True and attempt < 5: + while click_status is not True and attempt < 10: try: element = self.driver.find_element(*click_locator) element.click() - WebDriverWait(self.driver, 5).until( + WebDriverWait(self.driver, 2).until( EC.visibility_of_element_located(verify_locator)) click_status = True except Exception: diff --git a/web/regression/feature_utils/tree_area_locators.py b/web/regression/feature_utils/tree_area_locators.py index 524058f09..0b98e7547 100644 --- a/web/regression/feature_utils/tree_area_locators.py +++ b/web/regression/feature_utils/tree_area_locators.py @@ -26,6 +26,98 @@ class TreeAreaLocators(): "following-sibling::ul/li/div/div/div/span[2]/" \ "span[@class='aciTreeText']" + server_group_sub_nodes_exp_status = \ + "//div[div[span[span[contains(text(),'Servers')]]]]" \ + "/following-sibling::ul/li/div" + + server_group_sub_nodes_connected_status = \ + "//div[div[span[span[contains(text(), 'Servers')]]]]/" \ + "following-sibling::ul/li/div/div/div/span[2]" + specified_tree_node = \ "//div[@id='tree']//span[@class='aciTreeItem']/" \ "span[(@class='aciTreeText') and text()='{}']" + + specified_tree_node_exp_status = \ + "//div[@id='tree']//span[@class='aciTreeItem']/" \ + "span[(@class='aciTreeText') and text()='{}']" \ + "//ancestor::*[@class='aciTreeLine']" + + sub_nodes_of_tables_node = \ + "//div[div[div[div[div[div[div[div[span[span[" \ + "contains(text(),'Tables')]]]]]]]]]]/" \ + "following-sibling::ul/li/div//div/span[2]/span[2]" + + @staticmethod + def sub_nodes_of_a_server_node(server_name): + xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \ + "following-sibling::ul/li/div[@class='aciTreeLine']" % \ + server_name + return xpath + + @staticmethod + def sub_nodes_of_a_server_node_exp_status(server_name): + xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \ + "following-sibling::ul/li/div" % server_name + return xpath + + @staticmethod + def databases_node_of_a_server_node(server_name): + xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \ + "following-sibling::ul/li/div/div/div/div/span[2]/span[2 " \ + "and text()='Databases ']" % server_name + return xpath + + @staticmethod + def sub_nodes_of_databases_node(server_name): + xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \ + "following-sibling::ul/li[1]/div/following-sibling::ul/li/" \ + "div/div/div/div/div/span[2]/span[@class='aciTreeText']" % \ + server_name + return xpath + + @staticmethod + def sub_nodes_of_databases_node_exp_status(server_name): + xpath = "//div[div[div[span[span[contains(text(), '%s')]]]]]/" \ + "following-sibling::ul/li[1]/div/following-sibling::ul/li/" \ + "div" % server_name + return xpath + + @staticmethod + def sub_nodes_of_database_node(database_name): + xpath = "//div[div[div[div[div[span[span[contains(text()," \ + "'%s')]]]]]]]/following-sibling::ul/li/div/div/div/div/div/" \ + "div/span[2]/span[2]" % database_name + return xpath + + @staticmethod + def sub_nodes_of_database_node_exp_status(database_name): + xpath = "//div[div[div[div[div[span[span[contains(text(), " \ + "'%s')]]]]]]]/following-sibling::ul/li/div" % database_name + return xpath + + @staticmethod + def sub_nodes_of_schemas_node(database_name): + xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \ + "following-sibling::ul/li[7]/ul/li/div//div/span/" \ + "span[@class='aciTreeText']" % database_name + return xpath + + @staticmethod + def sub_nodes_of_schemas_node_exp_status(database_name): + xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \ + "following-sibling::ul/li[7]/ul/li/div" % database_name + return xpath + + @staticmethod + def sub_nodes_of_schema_node(database_name): + xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \ + "following-sibling::ul/li[7]/ul/li/ul/li/div//div/" \ + "span[2]/span[2]" % database_name + return xpath + + @staticmethod + def sub_nodes_of_schema_node_exp_status(database_name): + xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \ + "following-sibling::ul/li[7]/ul/li/ul/li/div" % database_name + return xpath diff --git a/web/regression/python_test_utils/test_gui_helper.py b/web/regression/python_test_utils/test_gui_helper.py index c31787cc7..7515ee158 100644 --- a/web/regression/python_test_utils/test_gui_helper.py +++ b/web/regression/python_test_utils/test_gui_helper.py @@ -6,6 +6,7 @@ # This software is released under the PostgreSQL Licence # ########################################################################## +from regression.feature_utils.locators import NavMenuLocators def close_bgprocess_popup(tester): @@ -41,3 +42,16 @@ def close_bgprocess_popup(tester): except Exception: tester.driver.find_element_by_css_selector( ".btn.btn-sm-sq.btn-primary.pg-bg-close > i").click() + + +def close_process_watcher(tester): + attempt = 5 + while attempt > 0: + close_btn = tester.page.find_by_xpath( + NavMenuLocators.process_watcher_close_button_xpath) + close_btn.click() + if not tester.page.check_if_element_exist_by_xpath( + NavMenuLocators.process_watcher_close_button_xpath, 1): + break + else: + attempt -= 1 ^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Fixes for pgAdmin feature tests @ 2019-11-11 05:24 Akshay Joshi <[email protected]> parent: Shubham Agarwal <[email protected]> 0 siblings, 1 reply; 12+ messages in thread From: Akshay Joshi @ 2019-11-11 05:24 UTC (permalink / raw) To: Shubham Agarwal <[email protected]>; +Cc: pgadmin-hackers Thanks, patch applied with a minor change. Menu for 'Delete Drop' server has been changed to 'Remove Server' which causes all the test cases failing on my machine. On Mon, Nov 11, 2019 at 10:18 AM Shubham Agarwal < [email protected]> wrote: > Hi Team, > > Attached is the patch containing fixes for the failed feature test cases. > This patch contains- > 1. Newly created function for traversing the browser tree. > 2. Some synchronization issue fixes. > 3. Modified locators. > 4. Test cases fix for the recent commits. > > -- > Thanks & Regards, > Shubham Agarwal > EnterpriseDB Corporation > > The Postgres Database Company > -- *Thanks & Regards* *Akshay Joshi* *Sr. Software Architect* *EnterpriseDB Software India Private Limited* *Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Fixes for pgAdmin feature tests @ 2019-11-12 12:57 Shubham Agarwal <[email protected]> parent: Akshay Joshi <[email protected]> 0 siblings, 1 reply; 12+ messages in thread From: Shubham Agarwal @ 2019-11-12 12:57 UTC (permalink / raw) To: pgadmin-hackers Hi Team, PFA patch containing some more fixes for random feature test failures. Thanks and regards, Shubham Agarwal On Mon, Nov 11, 2019 at 10:55 AM Akshay Joshi <[email protected]> wrote: > Thanks, patch applied with a minor change. Menu for 'Delete Drop' server > has been changed to 'Remove Server' which causes all the test cases failing > on my machine. > > On Mon, Nov 11, 2019 at 10:18 AM Shubham Agarwal < > [email protected]> wrote: > >> Hi Team, >> >> Attached is the patch containing fixes for the failed feature test cases. >> This patch contains- >> 1. Newly created function for traversing the browser tree. >> 2. Some synchronization issue fixes. >> 3. Modified locators. >> 4. Test cases fix for the recent commits. >> >> -- >> Thanks & Regards, >> Shubham Agarwal >> EnterpriseDB Corporation >> >> The Postgres Database Company >> > > > -- > *Thanks & Regards* > *Akshay Joshi* > > *Sr. Software Architect* > *EnterpriseDB Software India Private Limited* > *Mobile: +91 976-788-8246* > -- Thanks & Regards, Shubham Agarwal EnterpriseDB Corporation The Postgres Database Company Attachments: [application/octet-stream] feature_tests_fix_v2.patch (18.3K, 3-feature_tests_fix_v2.patch) download | inline diff: diff --git a/web/pgadmin/feature_tests/browser_tool_bar_test.py b/web/pgadmin/feature_tests/browser_tool_bar_test.py index 28fcb4068..a05278a1b 100644 --- a/web/pgadmin/feature_tests/browser_tool_bar_test.py +++ b/web/pgadmin/feature_tests/browser_tool_bar_test.py @@ -14,6 +14,7 @@ import random from regression.python_test_utils import test_utils from regression.feature_utils.locators import BrowserToolBarLocators from regression.feature_utils.base_feature_test import BaseFeatureTest +from regression.feature_utils.tree_area_locators import TreeAreaLocators from selenium.webdriver.common.by import By @@ -69,14 +70,18 @@ class BrowserToolBarFeatureTest(BaseFeatureTest): (By.CSS_SELECTOR, BrowserToolBarLocators.query_tool_panel_css)) def test_view_data_tool_button(self): - self.page.select_tree_item(self.test_db) + self.page.click_a_tree_node( + self.test_db, + TreeAreaLocators.sub_nodes_of_databases_node(self.server['name'])) self.page.toggle_open_schema_node( self.server['name'], self.server['db_password'], self.test_db, 'public') self.page.toggle_open_tables_node( self.server['name'], self.server['db_password'], self.test_db, 'public') - self.page.select_tree_item(self.test_table_name) + self.page.click_a_tree_node( + self.test_table_name, + TreeAreaLocators.sub_nodes_of_tables_node) self.page.retry_click( (By.CSS_SELECTOR, diff --git a/web/pgadmin/feature_tests/pg_datatype_validation_test.py b/web/pgadmin/feature_tests/pg_datatype_validation_test.py index eb93be7cf..c4d368df1 100644 --- a/web/pgadmin/feature_tests/pg_datatype_validation_test.py +++ b/web/pgadmin/feature_tests/pg_datatype_validation_test.py @@ -21,6 +21,7 @@ from regression.python_test_utils import test_utils from regression.feature_utils.base_feature_test import BaseFeatureTest from regression.feature_utils.locators import NavMenuLocators, \ QueryToolLocators +from regression.feature_utils.tree_area_locators import TreeAreaLocators CURRENT_PATH = os.path.dirname(os.path.realpath(__file__)) @@ -156,7 +157,9 @@ class PGDataypeFeatureTest(BaseFeatureTest): def _check_datatype(self): # Slick grid does not render all the column if viewport is not enough # wide. So execute test as batch of queries. - self.page.select_tree_item(self.test_db) + self.page.click_a_tree_node( + self.test_db, + TreeAreaLocators.sub_nodes_of_databases_node(self.server['name'])) self.page.open_query_tool() self._create_enum_type() for batch in config_data: diff --git a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py index 8659dd0e0..cc2e89b59 100644 --- a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py +++ b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py @@ -55,14 +55,12 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest): self.server['sslmode'] ) test_utils.drop_database(connection, self.database_name) - test_utils.create_database(self.server, self.database_name) + test_gui_helper.close_bgprocess_popup(self) self.page.add_server(self.server) self.wait = WebDriverWait(self.page.driver, 20) - test_gui_helper.close_bgprocess_popup(self) - def runTest(self): self.page.expand_database_node( self.server['name'], diff --git a/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py b/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py index b50c2b6fa..728323b49 100644 --- a/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py +++ b/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py @@ -18,6 +18,7 @@ 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 from regression.feature_utils.locators import NavMenuLocators +from regression.feature_utils.tree_area_locators import TreeAreaLocators class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest): @@ -71,9 +72,9 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest): test_utils.create_database(self.server, self.database_name) test_utils.create_table(self.server, self.database_name, self.table_name) + test_gui_helper.close_bgprocess_popup(self) self.page.add_server(self.server) self.wait = WebDriverWait(self.page.driver, 20) - test_gui_helper.close_bgprocess_popup(self) def runTest(self): self._open_maintenance_dialogue() @@ -100,7 +101,9 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest): self.page.toggle_open_tables_node(self.server['name'], self.server['db_password'], self.database_name, 'public') - self.page.select_tree_item(self.table_name) + self.page.click_a_tree_node( + self.table_name, + TreeAreaLocators.sub_nodes_of_tables_node) self.page.retry_click( (By.LINK_TEXT, diff --git a/web/pgadmin/feature_tests/query_tool_tests.py b/web/pgadmin/feature_tests/query_tool_tests.py index 413811dc2..3bcc5e8e4 100644 --- a/web/pgadmin/feature_tests/query_tool_tests.py +++ b/web/pgadmin/feature_tests/query_tool_tests.py @@ -207,7 +207,6 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format( ElementClickInterceptedException): count += 1 pass - print(count) self._check_ondemand_result(row_id_to_find) print("OK.", file=sys.stderr) @@ -244,6 +243,7 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format( def _check_ondemand_result(self, row_id_to_find): # scroll to bottom to bring last row of next chunk in viewport. scroll = 10 + status = False while scroll: canvas_ele = self.page.find_by_css_selector('.grid-canvas') scrolling_height = canvas_ele.size['height'] @@ -255,14 +255,18 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format( # Table height takes some time to update, for which their is no # particular way time.sleep(2) - if canvas_ele.size['height'] == scrolling_height: + if canvas_ele.size['height'] == scrolling_height and \ + self.page.check_if_element_exist_by_xpath( + QueryToolLocators.output_column_data_xpath.format( + row_id_to_find)): + status = True break else: scroll -= 1 - self.assertTrue(self.page.check_if_element_exist_by_xpath( - QueryToolLocators.output_column_data_xpath.format(row_id_to_find) - )) + self.assertTrue( + status, "Element is not loaded to the rows id: " + "{}".format(row_id_to_find)) def _query_tool_explain_with_verbose_and_cost(self): query = """-- Explain query with verbose and cost @@ -372,11 +376,7 @@ CREATE TABLE public.{}();""".format(table_name) -- 3. ROLLBACK transaction. -- 4. Check if table is *NOT* created. ROLLBACK;""" - self.page.fill_codemirror_area_with(query) - self.page.find_by_css_selector( - QueryToolLocators.btn_execute_query_css).click() - - self.page.wait_for_query_tool_loading_indicator_to_disappear() + self.page.execute_query(query) self.page.click_tab('Messages') self.assertTrue(self.page.check_if_element_exist_by_xpath( QueryToolLocators.sql_editor_message.format('ROLLBACK')), @@ -389,11 +389,8 @@ ROLLBACK;""" -- 4. Check if table is *NOT* created. SELECT relname FROM pg_class WHERE relkind IN ('r','s','t') and relnamespace = 2200::oid;""" - self.page.fill_codemirror_area_with(query) - self.page.find_by_css_selector( - QueryToolLocators.btn_execute_query_css).click() - self.page.wait_for_query_tool_loading_indicator_to_disappear() + self.page.execute_query(query) self.page.click_tab('Data Output') canvas = self.wait.until(EC.presence_of_element_located( (By.CSS_SELECTOR, QueryToolLocators.query_output_canvas_css))) @@ -411,11 +408,7 @@ SELECT relname FROM pg_class -- 3. ROLLBACK transaction. -- 4. Check if table is *NOT* created. ROLLBACK;""" - self.page.fill_codemirror_area_with(query) - self.page.find_by_css_selector( - QueryToolLocators.btn_execute_query_css).click() - - self.page.wait_for_query_tool_loading_indicator_to_disappear() + self.page.execute_query(query) def _query_tool_auto_commit_enabled(self): query = """-- 1. Enable auto commit. @@ -481,10 +474,8 @@ ROLLBACK;""" -- 5. Check if table is created event after ROLLBACK. SELECT relname FROM pg_class WHERE relkind IN ('r','s','t') and relnamespace = 2200::oid;""" - self.page.fill_codemirror_area_with(query) - self.page.find_by_css_selector( - QueryToolLocators.btn_execute_query_css).click() + self.page.execute_query(query) self.page.click_tab('Data Output') self.page.wait_for_query_tool_loading_indicator_to_disappear() diff --git a/web/pgadmin/feature_tests/table_ddl_feature_test.py b/web/pgadmin/feature_tests/table_ddl_feature_test.py index 26f231ef9..7430ca95c 100644 --- a/web/pgadmin/feature_tests/table_ddl_feature_test.py +++ b/web/pgadmin/feature_tests/table_ddl_feature_test.py @@ -12,6 +12,7 @@ import random from regression.feature_utils.base_feature_test import BaseFeatureTest from regression.python_test_utils import test_utils +from regression.feature_utils.tree_area_locators import TreeAreaLocators class TableDdlFeatureTest(BaseFeatureTest): @@ -38,7 +39,9 @@ class TableDdlFeatureTest(BaseFeatureTest): self.page.toggle_open_tables_node( self.server['name'], self.server['db_password'], self.test_db, 'public') - self.page.select_tree_item(self.test_table_name) + self.page.click_a_tree_node( + self.test_table_name, + TreeAreaLocators.sub_nodes_of_tables_node) self.page.click_tab("SQL") # Wait till data is displayed in SQL Tab diff --git a/web/pgadmin/feature_tests/view_data_dml_queries.py b/web/pgadmin/feature_tests/view_data_dml_queries.py index 6ea8d506c..02a449971 100644 --- a/web/pgadmin/feature_tests/view_data_dml_queries.py +++ b/web/pgadmin/feature_tests/view_data_dml_queries.py @@ -21,6 +21,7 @@ from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from regression.feature_utils.locators import QueryToolLocators, \ NavMenuLocators +from regression.feature_utils.tree_area_locators import TreeAreaLocators CURRENT_PATH = os.path.dirname(os.path.realpath(__file__)) @@ -167,7 +168,9 @@ CREATE TABLE public.nonintpkey config_data = config_data_json[config_key] def _perform_test_for_table(self, table_name): - self.page.select_tree_item(table_name) + self.page.click_a_tree_node( + table_name, + TreeAreaLocators.sub_nodes_of_tables_node) # Open Object -> View/Edit data self._view_data_grid(table_name) @@ -354,7 +357,11 @@ CREATE TABLE public.nonintpkey # scroll browser back to the left # to reset position so other assertions can succeed - for idx in reversed(list(config_check_data.keys())): + list_item = list(config_check_data.keys()) + for item in range(0, len(list_item)): + list_item[item] = int(list_item[item]) + list_item.sort(reverse=True) + for idx in list_item: time.sleep(0.4) element = result_row.find_element_by_class_name("r" + str(idx)) self.page.driver.execute_script( diff --git a/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py b/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py index aed1f36f1..15aad7be9 100644 --- a/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py +++ b/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py @@ -16,6 +16,7 @@ from regression.feature_utils.base_feature_test import BaseFeatureTest from selenium.webdriver import ActionChains from selenium.common.exceptions import StaleElementReferenceException from regression.feature_utils.locators import QueryToolLocators +from regression.feature_utils.tree_area_locators import TreeAreaLocators class CheckForXssFeatureTest(BaseFeatureTest): @@ -100,7 +101,9 @@ class CheckForXssFeatureTest(BaseFeatureTest): self.page.toggle_open_tables_node(self.server['name'], self.server['db_password'], self.test_db, 'public') - self.page.select_tree_item(self.test_table_name) + self.page.click_a_tree_node( + self.test_table_name, + TreeAreaLocators.sub_nodes_of_tables_node) def _check_xss_in_browser_tree(self): print( diff --git a/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py b/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py index b42d3f12d..6af1af82e 100644 --- a/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py +++ b/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py @@ -14,6 +14,7 @@ from selenium.webdriver import ActionChains from selenium.common.exceptions import TimeoutException from regression.python_test_utils import test_utils from regression.feature_utils.base_feature_test import BaseFeatureTest +from regression.feature_utils.tree_area_locators import TreeAreaLocators from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By @@ -65,7 +66,9 @@ class CheckDebuggerForXssFeatureTest(BaseFeatureTest): self.server['db_password'], self.test_db, 'public') self.page.toggle_open_function_node() - self.page.select_tree_item(self.function_name + "()") + self.page.click_a_tree_node( + self.function_name + "()", + TreeAreaLocators.sub_nodes_of_functions_node) def _debug_function(self): self.page.driver.find_element_by_link_text("Object").click() diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py index ac1e25fcd..a1735b152 100644 --- a/web/regression/feature_utils/pgadmin_page.py +++ b/web/regression/feature_utils/pgadmin_page.py @@ -245,6 +245,36 @@ class PgadminPage: if attempts == 0: raise Exception(e) + def click_a_tree_node(self, element_name, list_of_element): + """It will click a tree node eg. server, schema, table name etc + will take server name and list of element where this node lies""" + operation_status = False + elements = list_of_element = self.find_by_xpath_list( + list_of_element) + if len(elements) > 0: + index_of_element = self.get_index_of_element( + elements, element_name) + if index_of_element >= 0: + self.driver.execute_script( + "arguments[0].scrollIntoView()", + list_of_element[index_of_element]) + self.wait_for_elements_to_appear( + self.driver, list_of_element[index_of_element]) + time.sleep(1) + self.driver.execute_script( + "arguments[0].click()", + list_of_element[index_of_element]) + operation_status = True + else: + print("{ERROR} - The required element with name: " + str( + element_name) + + " is not found in function click_a_tree_node, " + "so click operation is not performed") + else: + print("{ERROR} - The element list passed to function " + "click_a_tree_node seems empty") + return operation_status + def toggle_open_servers_group(self): """This will open Servers group to display underlying nodes""" is_expanded = False diff --git a/web/regression/feature_utils/tree_area_locators.py b/web/regression/feature_utils/tree_area_locators.py index 0b98e7547..3c4e8e5d4 100644 --- a/web/regression/feature_utils/tree_area_locators.py +++ b/web/regression/feature_utils/tree_area_locators.py @@ -48,6 +48,11 @@ class TreeAreaLocators(): "contains(text(),'Tables')]]]]]]]]]]/" \ "following-sibling::ul/li/div//div/span[2]/span[2]" + sub_nodes_of_functions_node = \ + "//div[div[div[div[div[div[div[div[span[span[" \ + "contains(text(),'Functions')]]]]]]]]]]/" \ + "following-sibling::ul/li/div//div/span[2]/span[2]" + @staticmethod def sub_nodes_of_a_server_node(server_name): xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \ diff --git a/web/regression/python_test_utils/test_gui_helper.py b/web/regression/python_test_utils/test_gui_helper.py index 7515ee158..aaa9707b7 100644 --- a/web/regression/python_test_utils/test_gui_helper.py +++ b/web/regression/python_test_utils/test_gui_helper.py @@ -45,7 +45,7 @@ def close_bgprocess_popup(tester): def close_process_watcher(tester): - attempt = 5 + attempt = 10 while attempt > 0: close_btn = tester.page.find_by_xpath( NavMenuLocators.process_watcher_close_button_xpath) diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py index 2e8a0eb8c..56d5cb0f9 100644 --- a/web/regression/python_test_utils/test_utils.py +++ b/web/regression/python_test_utils/test_utils.py @@ -820,6 +820,7 @@ def reset_layout_db(user_id=None): '("Browser/Layout", "SQLEditor/Layout", "Debugger/Layout")' ' AND USER_ID=?', user_id ) + cur.execute('DELETE FROM process') conn.commit() conn.close() break ^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Fixes for pgAdmin feature tests @ 2019-11-13 05:49 Akshay Joshi <[email protected]> parent: Shubham Agarwal <[email protected]> 0 siblings, 1 reply; 12+ messages in thread From: Akshay Joshi @ 2019-11-13 05:49 UTC (permalink / raw) To: Shubham Agarwal <[email protected]>; +Cc: pgadmin-hackers Thanks, patch applied. On Tue, Nov 12, 2019 at 6:27 PM Shubham Agarwal < [email protected]> wrote: > Hi Team, > PFA patch containing some more fixes for random feature test failures. > > Thanks and regards, > Shubham Agarwal > > On Mon, Nov 11, 2019 at 10:55 AM Akshay Joshi < > [email protected]> wrote: > >> Thanks, patch applied with a minor change. Menu for 'Delete Drop' server >> has been changed to 'Remove Server' which causes all the test cases failing >> on my machine. >> >> On Mon, Nov 11, 2019 at 10:18 AM Shubham Agarwal < >> [email protected]> wrote: >> >>> Hi Team, >>> >>> Attached is the patch containing fixes for the failed feature test cases. >>> This patch contains- >>> 1. Newly created function for traversing the browser tree. >>> 2. Some synchronization issue fixes. >>> 3. Modified locators. >>> 4. Test cases fix for the recent commits. >>> >>> -- >>> Thanks & Regards, >>> Shubham Agarwal >>> EnterpriseDB Corporation >>> >>> The Postgres Database Company >>> >> >> >> -- >> *Thanks & Regards* >> *Akshay Joshi* >> >> *Sr. Software Architect* >> *EnterpriseDB Software India Private Limited* >> *Mobile: +91 976-788-8246* >> > > > -- > Thanks & Regards, > Shubham Agarwal > EnterpriseDB Corporation > > The Postgres Database Company > -- *Thanks & Regards* *Akshay Joshi* *Sr. Software Architect* *EnterpriseDB Software India Private Limited* *Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Fixes for pgAdmin feature tests @ 2019-11-15 12:29 Shubham Agarwal <[email protected]> parent: Akshay Joshi <[email protected]> 0 siblings, 1 reply; 12+ messages in thread From: Shubham Agarwal @ 2019-11-15 12:29 UTC (permalink / raw) To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers Hi Team, PFA feature test fixture patch containing the following fixes: 1. Process watcher loading logs fix 2. Auto commit/rollback issue in query_tool_tests 3. Fixed the scrolling issue while verifying values in a table. 4. Modified some functions in pgadmin_page.py On Wed, Nov 13, 2019 at 11:19 AM Akshay Joshi <[email protected]> wrote: > Thanks, patch applied. > > On Tue, Nov 12, 2019 at 6:27 PM Shubham Agarwal < > [email protected]> wrote: > >> Hi Team, >> PFA patch containing some more fixes for random feature test failures. >> >> Thanks and regards, >> Shubham Agarwal >> >> On Mon, Nov 11, 2019 at 10:55 AM Akshay Joshi < >> [email protected]> wrote: >> >>> Thanks, patch applied with a minor change. Menu for 'Delete Drop' server >>> has been changed to 'Remove Server' which causes all the test cases failing >>> on my machine. >>> >>> On Mon, Nov 11, 2019 at 10:18 AM Shubham Agarwal < >>> [email protected]> wrote: >>> >>>> Hi Team, >>>> >>>> Attached is the patch containing fixes for the failed feature test >>>> cases. >>>> This patch contains- >>>> 1. Newly created function for traversing the browser tree. >>>> 2. Some synchronization issue fixes. >>>> 3. Modified locators. >>>> 4. Test cases fix for the recent commits. >>>> >>>> -- >>>> Thanks & Regards, >>>> Shubham Agarwal >>>> EnterpriseDB Corporation >>>> >>>> The Postgres Database Company >>>> >>> >>> >>> -- >>> *Thanks & Regards* >>> *Akshay Joshi* >>> >>> *Sr. Software Architect* >>> *EnterpriseDB Software India Private Limited* >>> *Mobile: +91 976-788-8246* >>> >> >> >> -- >> Thanks & Regards, >> Shubham Agarwal >> EnterpriseDB Corporation >> >> The Postgres Database Company >> > > > -- > *Thanks & Regards* > *Akshay Joshi* > > *Sr. Software Architect* > *EnterpriseDB Software India Private Limited* > *Mobile: +91 976-788-8246* > -- Thanks & Regards, Shubham Agarwal EnterpriseDB Corporation The Postgres Database Company Attachments: [application/octet-stream] feature_test_fix_v3.patch (19.3K, 3-feature_test_fix_v3.patch) download | inline diff: diff --git a/web/pgadmin/feature_tests/file_manager_test.py b/web/pgadmin/feature_tests/file_manager_test.py index c76f20386..6e4f52e1d 100644 --- a/web/pgadmin/feature_tests/file_manager_test.py +++ b/web/pgadmin/feature_tests/file_manager_test.py @@ -15,6 +15,7 @@ import time from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By +from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import StaleElementReferenceException, \ TimeoutException from regression.feature_utils.base_feature_test import BaseFeatureTest @@ -83,7 +84,7 @@ class CheckFileManagerFeatureTest(BaseFeatureTest): self.page.find_by_css_selector('.change_file_types') self.page.fill_input_by_css_selector( QueryToolLocators.input_file_path_css, - "/tmp/", key_after_input=Keys.RETURN) + "/tmp", key_after_input=Keys.RETURN) if self.page.driver.capabilities['browserName'] == 'firefox': table = self.page.wait_for_element_to_reload( @@ -91,6 +92,12 @@ class CheckFileManagerFeatureTest(BaseFeatureTest): QueryToolLocators.select_file_content_css) ) else: + self.wait.until(EC.visibility_of_element_located( + (By.CSS_SELECTOR, QueryToolLocators.select_file_content_css))) + self.wait.until(lambda element: + self.page.driver.find_element_by_css_selector( + '[name=home]').is_enabled()) + table = self.page.driver.find_element_by_css_selector( QueryToolLocators.select_file_content_css) retry_count = 0 @@ -113,7 +120,8 @@ class CheckFileManagerFeatureTest(BaseFeatureTest): # For XSS we need to search against element's html code assert source_code.find( string_to_find - ) != -1, "{0} might be vulnerable to XSS ".format(source) + ) != -1, "{0} might be vulnerable to XSS, source code is: {1}".format( + source, source_code) def _check_file_sorting(self): load_file = self.page.find_by_css_selector( diff --git a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py index cc2e89b59..5ae86734c 100644 --- a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py +++ b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py @@ -108,16 +108,17 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest): status = test_utils.get_watcher_dialogue_status(self) - if status != "Successfully completed.": - test_gui_helper.close_bgprocess_popup(self) - - self.assertEquals(status, "Successfully completed.") - self.page.retry_click( (By.CSS_SELECTOR, NavMenuLocators.status_alertifier_more_btn_css), (By.XPATH, NavMenuLocators.process_watcher_alertfier)) + self.page.wait_for_element_to_disappear( + lambda driver: driver.find_element_by_css_selector(".loading-logs") + ) + + if status != "Successfully completed.": + self.assertEquals(status, "Successfully completed.") backup_file = None # Check for XSS in Backup details @@ -177,16 +178,17 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest): status = test_utils.get_watcher_dialogue_status(self) - if status != "Successfully completed.": - test_gui_helper.close_bgprocess_popup(self) - - self.assertEquals(status, "Successfully completed.") - self.page.retry_click( (By.CSS_SELECTOR, NavMenuLocators.status_alertifier_more_btn_css), (By.XPATH, NavMenuLocators.process_watcher_alertfier)) + self.page.wait_for_element_to_disappear( + lambda driver: driver.find_element_by_css_selector(".loading-logs") + ) + + if status != "Successfully completed.": + self.assertEquals(status, "Successfully completed.") # Check for XSS in Restore details if self.is_xss_check: diff --git a/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py b/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py index 728323b49..0e6586d0e 100644 --- a/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py +++ b/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py @@ -26,19 +26,19 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest): scenarios = [ ("Test for PG maintenance: database", dict( - database_name='pg_maintenance', - table_name='pg_maintenance_table', + database_name='pg_maintenance_', + table_name='table_', test_level='database', is_xss_check=False, )), ("Test for PG maintenance: table", dict( - database_name='pg_maintenance', - table_name='pg_maintenance_table', + database_name='pg_maintenance_', + table_name='table_', test_level='table', is_xss_check=False, )), ("Test for XSS in maintenance dialog", dict( - database_name='pg_maintenance', + database_name='pg_maintenance_', table_name='<h1>test_me</h1>', test_level='table', is_xss_check=True, @@ -67,7 +67,9 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest): self.server['sslmode'] ) - self.table_name = self.table_name + str(random.randint(1000, 3000)) + self.table_name = self.table_name + str(random.randint(100, 1000)) + self.database_name = \ + self.database_name + str(random.randint(100, 1000)) test_utils.drop_database(connection, self.database_name) test_utils.create_database(self.server, self.database_name) test_utils.create_table(self.server, self.database_name, @@ -87,7 +89,6 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest): self.wait.until(EC.visibility_of_element_located( (By.CSS_SELECTOR, NavMenuLocators.bcg_process_status_alertifier_css))) - self.verify_command() def _open_maintenance_dialogue(self): @@ -101,9 +102,18 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest): self.page.toggle_open_tables_node(self.server['name'], self.server['db_password'], self.database_name, 'public') - self.page.click_a_tree_node( - self.table_name, - TreeAreaLocators.sub_nodes_of_tables_node) + retry = 5 + status = False + while retry > 0: + status = self.page.click_a_tree_node( + self.table_name, + TreeAreaLocators.sub_nodes_of_tables_node) + if status: + break + else: + retry -= 1 + self.assertTrue(status, "Table name {} is not selected".format( + self.table_name)) self.page.retry_click( (By.LINK_TEXT, @@ -118,17 +128,17 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest): def verify_command(self): status = test_utils.get_watcher_dialogue_status(self) - if status != "Successfully completed.": - - test_gui_helper.close_bgprocess_popup(self) - - self.assertEquals(status, "Successfully completed.") - self.page.retry_click( (By.CSS_SELECTOR, NavMenuLocators.status_alertifier_more_btn_css), (By.XPATH, NavMenuLocators.process_watcher_alertfier)) + self.page.wait_for_element_to_disappear( + lambda driver: driver.find_element_by_css_selector(".loading-logs") + ) + + if status != "Successfully completed.": + self.assertEquals(status, "Successfully completed.") command = self.page.find_by_css_selector( NavMenuLocators. @@ -158,9 +168,9 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest): def after(self): test_gui_helper.close_bgprocess_popup(self) - self.page.remove_server(self.server) 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'], diff --git a/web/pgadmin/feature_tests/query_tool_tests.py b/web/pgadmin/feature_tests/query_tool_tests.py index 3bcc5e8e4..a0f350320 100644 --- a/web/pgadmin/feature_tests/query_tool_tests.py +++ b/web/pgadmin/feature_tests/query_tool_tests.py @@ -135,18 +135,10 @@ class QueryToolFeatureTest(BaseFeatureTest): query_op.click() # disable auto rollback only if they are enabled - btn = self.page.find_by_css_selector( - QueryToolLocators.btn_auto_rollback) - check = btn.find_element_by_tag_name('i') - if 'visibility-hidden' not in check.get_attribute('class'): - btn.click() + self.uncheck_execute_option('auto_rollback') # enable autocommit only if it's disabled - btn = self.page.find_by_css_selector( - QueryToolLocators.btn_auto_commit) - check = btn.find_element_by_tag_name('i') - if 'visibility-hidden' in check.get_attribute('class'): - btn.click() + self.check_execute_option('auto_commit') # close menu query_op.click() @@ -181,8 +173,7 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format( print("On demand result set on grid select all... ", file=sys.stderr, end="") - self.page.find_by_css_selector( - QueryToolLocators.btn_execute_query_css).click() + self.page.click_execute_query_button() # wait for header of the table to be visible canvas = self.page.find_by_css_selector( @@ -213,8 +204,7 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format( print("On demand result set on column select all... ", file=sys.stderr, end="") - self.page.find_by_css_selector( - QueryToolLocators.btn_execute_query_css).click() + self.page.click_execute_query_button() self.page.wait_for_query_tool_loading_indicator_to_disappear() @@ -349,18 +339,16 @@ CREATE TABLE public.{}();""".format(table_name) self.page.fill_codemirror_area_with(query) - # open auto commit option and disable it + # disable auto commit option query_op = self.page.find_by_css_selector( QueryToolLocators.btn_query_dropdown) query_op.click() - self.page.find_by_css_selector( - QueryToolLocators.btn_auto_commit).click() + self.uncheck_execute_option('auto_commit') # close option query_op.click() # execute query - self.page.find_by_css_selector( - QueryToolLocators.btn_execute_query_css).click() + self.page.click_execute_query_button() self.page.wait_for_query_tool_loading_indicator_to_disappear() self.page.click_tab('Messages') @@ -424,13 +412,12 @@ END;""" QueryToolLocators.btn_query_dropdown) query_op.click() - self.page.find_by_css_selector( - QueryToolLocators.btn_auto_commit).click() + # Enable auto_commit if it is disabled + self.check_execute_option('auto_commit') query_op.click() - self.page.find_by_css_selector( - QueryToolLocators.btn_execute_query_css).click() + self.page.click_execute_query_button() self.page.wait_for_query_tool_loading_indicator_to_disappear() @@ -504,14 +491,13 @@ END;""" QueryToolLocators.btn_query_dropdown) query_op.click() - # uncheckt auto commit and check auto-rollback + # uncheck auto commit and check auto-rollback self.uncheck_execute_option('auto_commit') self.check_execute_option('auto_rollback') query_op.click() - self.page.find_by_css_selector( - QueryToolLocators.btn_execute_query_css).click() + self.page.click_execute_query_button() self.page.wait_for_query_tool_loading_indicator_to_disappear() self.page.clear_query_tool() @@ -606,11 +592,20 @@ SELECT 1, pg_sleep(300)""" self.uncheck_execute_option('auto_rollback') # close drop down query_op.click() + # Execute query + retry = 5 + execute_button = self.page.find_by_css_selector( + QueryToolLocators.btn_execute_query_css) + while retry > 0: + execute_button.click() + if self.page.wait_for_query_tool_loading_indicator_to_appear(): + break + else: + retry -= 1 + # Providing a second of sleep since clicks on the execute and stop + # query button is too quick that the query is not able run properly + time.sleep(1) - self.page.find_by_css_selector( - QueryToolLocators.btn_execute_query_css).click() - - self.page.find_by_xpath("//*[@id='fetching_data']") self.page.find_by_css_selector( QueryToolLocators.btn_cancel_query).click() self.page.wait_for_query_tool_loading_indicator_to_disappear() diff --git a/web/pgadmin/feature_tests/view_data_dml_queries.py b/web/pgadmin/feature_tests/view_data_dml_queries.py index 02a449971..14591cdae 100644 --- a/web/pgadmin/feature_tests/view_data_dml_queries.py +++ b/web/pgadmin/feature_tests/view_data_dml_queries.py @@ -308,7 +308,11 @@ CREATE TABLE public.nonintpkey self._verify_row_data(False, updated_row_data) def _add_update_save_row(self, data, row=1): - for idx in data.keys(): + items = list(data.keys()) + for item in range(0, len(items)): + items[item] = int(items[item]) + items.sort(reverse=False) + for idx in items: cell_xpath = CheckForViewDataTest._get_cell_xpath( 'r' + str(idx), row ) @@ -347,9 +351,21 @@ CREATE TABLE public.nonintpkey result_row = self.page.find_by_xpath(xpath) - # List of row values in an array - for idx in config_check_data.keys(): - element = result_row.find_element_by_class_name("r" + str(idx)) + # 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)): + actual_list[value] = int(actual_list[value]) + actual_list.sort(reverse=False) + retry = 5 + for idx in actual_list: + while retry > 0: + try: + element = \ + result_row.find_element_by_class_name("r" + str(idx)) + 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) diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py index a1735b152..61aa4cf5a 100644 --- a/web/regression/feature_utils/pgadmin_page.py +++ b/web/regression/feature_utils/pgadmin_page.py @@ -176,6 +176,18 @@ class PgadminPage: execute_button.click() self.wait_for_query_tool_loading_indicator_to_disappear() + def click_execute_query_button(self): + retry = 5 + execute_button = self.find_by_css_selector( + QueryToolLocators.btn_execute_query_css) + while retry > 0: + execute_button.click() + if self.wait_for_query_tool_loading_indicator_to_appear(): + break + else: + retry -= 1 + self.wait_for_query_tool_loading_indicator_to_disappear() + 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""" @@ -394,6 +406,7 @@ class PgadminPage: name_of_database): """will expand database node under databases node""" db_node_expanded_status = False + retry = 5 if self.expand_databases_node(server_name, server_password): sub_nodes_of_databases_node = self.find_by_xpath_list( TreeAreaLocators.sub_nodes_of_databases_node(server_name)) @@ -410,9 +423,17 @@ class PgadminPage: self.driver.execute_script("arguments[0].scrollIntoView()", sub_nodes_of_databases_node[ index_of_required_db_node]) - webdriver.ActionChains(self.driver).double_click( - sub_nodes_of_databases_node[ - index_of_required_db_node]).perform() + while retry > 0: + webdriver.ActionChains(self.driver).double_click( + sub_nodes_of_databases_node[ + index_of_required_db_node]).perform() + if self.check_if_element_exist_by_xpath( + "//div[@class='ajs-header'and text()='INTERNAL SERVER " + "ERROR']", 1): + self.click_modal('OK') + retry -= 1 + else: + break if self.wait_for_elements_to_appear( self.driver, TreeAreaLocators. sub_nodes_of_database_node( @@ -935,7 +956,7 @@ class PgadminPage: return False return True - except NoSuchElementException: + except (NoSuchElementException, StaleElementReferenceException): return True return self._wait_for("element to disappear", element_if_it_disappears) @@ -976,9 +997,10 @@ class PgadminPage: self._wait_for("spinner to disappear", spinner_has_disappeared, 20) def wait_for_query_tool_loading_indicator_to_appear(self): - self.check_if_element_exist_by_xpath( + status = self.check_if_element_exist_by_xpath( "//div[@id='editor-panel']//" - "div[@class='pg-sp-container sql-editor-busy-fetching']") + "div[@class='pg-sp-container sql-editor-busy-fetching']", 1) + return status def wait_for_app(self): def page_shows_app(driver): diff --git a/web/regression/runtests.py b/web/regression/runtests.py index 540eae65e..8c52753f3 100644 --- a/web/regression/runtests.py +++ b/web/regression/runtests.py @@ -234,6 +234,8 @@ def get_test_modules(arguments): if 'headless_chrome' in test_setup.config_data: if test_setup.config_data['headless_chrome']: options.add_argument("--headless") + options.add_argument("--no-sandbox") + options.add_argument("--disable-setuid-sandbox") options.add_argument("--window-size=1280,1024") options.add_argument("--disable-infobars") options.add_experimental_option('w3c', False) ^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Fixes for pgAdmin feature tests @ 2019-11-15 12:33 Akshay Joshi <[email protected]> parent: Shubham Agarwal <[email protected]> 0 siblings, 1 reply; 12+ messages in thread From: Akshay Joshi @ 2019-11-15 12:33 UTC (permalink / raw) To: Shubham Agarwal <[email protected]>; +Cc: pgadmin-hackers Thanks, patch applied On Fri, Nov 15, 2019 at 5:59 PM Shubham Agarwal < [email protected]> wrote: > Hi Team, > > PFA feature test fixture patch containing the following fixes: > 1. Process watcher loading logs fix > 2. Auto commit/rollback issue in query_tool_tests > 3. Fixed the scrolling issue while verifying values in a table. > 4. Modified some functions in pgadmin_page.py > > On Wed, Nov 13, 2019 at 11:19 AM Akshay Joshi < > [email protected]> wrote: > >> Thanks, patch applied. >> >> On Tue, Nov 12, 2019 at 6:27 PM Shubham Agarwal < >> [email protected]> wrote: >> >>> Hi Team, >>> PFA patch containing some more fixes for random feature test failures. >>> >>> Thanks and regards, >>> Shubham Agarwal >>> >>> On Mon, Nov 11, 2019 at 10:55 AM Akshay Joshi < >>> [email protected]> wrote: >>> >>>> Thanks, patch applied with a minor change. Menu for 'Delete Drop' >>>> server has been changed to 'Remove Server' which causes all the test cases >>>> failing on my machine. >>>> >>>> On Mon, Nov 11, 2019 at 10:18 AM Shubham Agarwal < >>>> [email protected]> wrote: >>>> >>>>> Hi Team, >>>>> >>>>> Attached is the patch containing fixes for the failed feature test >>>>> cases. >>>>> This patch contains- >>>>> 1. Newly created function for traversing the browser tree. >>>>> 2. Some synchronization issue fixes. >>>>> 3. Modified locators. >>>>> 4. Test cases fix for the recent commits. >>>>> >>>>> -- >>>>> Thanks & Regards, >>>>> Shubham Agarwal >>>>> EnterpriseDB Corporation >>>>> >>>>> The Postgres Database Company >>>>> >>>> >>>> >>>> -- >>>> *Thanks & Regards* >>>> *Akshay Joshi* >>>> >>>> *Sr. Software Architect* >>>> *EnterpriseDB Software India Private Limited* >>>> *Mobile: +91 976-788-8246* >>>> >>> >>> >>> -- >>> Thanks & Regards, >>> Shubham Agarwal >>> EnterpriseDB Corporation >>> >>> The Postgres Database Company >>> >> >> >> -- >> *Thanks & Regards* >> *Akshay Joshi* >> >> *Sr. Software Architect* >> *EnterpriseDB Software India Private Limited* >> *Mobile: +91 976-788-8246* >> > > > -- > Thanks & Regards, > Shubham Agarwal > EnterpriseDB Corporation > > The Postgres Database Company > -- *Thanks & Regards* *Akshay Joshi* *Sr. Software Architect* *EnterpriseDB Software India Private Limited* *Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Fixes for pgAdmin feature tests @ 2019-11-20 07:03 Shubham Agarwal <[email protected]> parent: Akshay Joshi <[email protected]> 0 siblings, 1 reply; 12+ messages in thread From: Shubham Agarwal @ 2019-11-20 07:03 UTC (permalink / raw) To: pgadmin-hackers Hi Team, PFA feature test fixture patch containing the following things: 1. Added an attribute 'data-click-counter' in query execute button which gets incremented once query button is clicked up to 9 and then reset to 0. This is added just to support automation. 2. Locator for login_group_role is added and used to expand tree. 3. Functions for enabling and disable auto_commit and auto_rollback are made more precise. 4. Some scrolling problem is addressed in view_data_dml_query test. 5. Handled the stale element reference exception in query_tool_journey_test Regards, Shubham Agarwal On Fri, Nov 15, 2019 at 6:03 PM Akshay Joshi <[email protected]> wrote: > Thanks, patch applied > > On Fri, Nov 15, 2019 at 5:59 PM Shubham Agarwal < > [email protected]> wrote: > >> Hi Team, >> >> PFA feature test fixture patch containing the following fixes: >> 1. Process watcher loading logs fix >> 2. Auto commit/rollback issue in query_tool_tests >> 3. Fixed the scrolling issue while verifying values in a table. >> 4. Modified some functions in pgadmin_page.py >> >> On Wed, Nov 13, 2019 at 11:19 AM Akshay Joshi < >> [email protected]> wrote: >> >>> Thanks, patch applied. >>> >>> On Tue, Nov 12, 2019 at 6:27 PM Shubham Agarwal < >>> [email protected]> wrote: >>> >>>> Hi Team, >>>> PFA patch containing some more fixes for random feature test failures. >>>> >>>> Thanks and regards, >>>> Shubham Agarwal >>>> >>>> On Mon, Nov 11, 2019 at 10:55 AM Akshay Joshi < >>>> [email protected]> wrote: >>>> >>>>> Thanks, patch applied with a minor change. Menu for 'Delete Drop' >>>>> server has been changed to 'Remove Server' which causes all the test cases >>>>> failing on my machine. >>>>> >>>>> On Mon, Nov 11, 2019 at 10:18 AM Shubham Agarwal < >>>>> [email protected]> wrote: >>>>> >>>>>> Hi Team, >>>>>> >>>>>> Attached is the patch containing fixes for the failed feature test >>>>>> cases. >>>>>> This patch contains- >>>>>> 1. Newly created function for traversing the browser tree. >>>>>> 2. Some synchronization issue fixes. >>>>>> 3. Modified locators. >>>>>> 4. Test cases fix for the recent commits. >>>>>> >>>>>> -- >>>>>> Thanks & Regards, >>>>>> Shubham Agarwal >>>>>> EnterpriseDB Corporation >>>>>> >>>>>> The Postgres Database Company >>>>>> >>>>> >>>>> >>>>> -- >>>>> *Thanks & Regards* >>>>> *Akshay Joshi* >>>>> >>>>> *Sr. Software Architect* >>>>> *EnterpriseDB Software India Private Limited* >>>>> *Mobile: +91 976-788-8246* >>>>> >>>> >>>> >>>> -- >>>> Thanks & Regards, >>>> Shubham Agarwal >>>> EnterpriseDB Corporation >>>> >>>> The Postgres Database Company >>>> >>> >>> >>> -- >>> *Thanks & Regards* >>> *Akshay Joshi* >>> >>> *Sr. Software Architect* >>> *EnterpriseDB Software India Private Limited* >>> *Mobile: +91 976-788-8246* >>> >> >> >> -- >> Thanks & Regards, >> Shubham Agarwal >> EnterpriseDB Corporation >> >> The Postgres Database Company >> > > > -- > *Thanks & Regards* > *Akshay Joshi* > > *Sr. Software Architect* > *EnterpriseDB Software India Private Limited* > *Mobile: +91 976-788-8246* > -- Thanks & Regards, Shubham Agarwal EnterpriseDB Corporation The Postgres Database Company Attachments: [application/octet-stream] feature_test_fix_v4.patch (15.9K, 3-feature_test_fix_v4.patch) download | inline diff: 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 @@ </button> <button id="btn-flash" data-test-selector="execute-refresh-button" type="button" class="btn btn-sm btn-secondary" style="width: 32px;" title="" - tabindex="0" disabled> + tabindex="0" data-click-counter="0" disabled> <i class="fa fa-bolt sql-icon-lg" aria-hidden="true"></i> </button> <button id="btn-query-dropdown" type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split" diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index 70d4bd348..9d9ab5c84 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -1653,6 +1653,10 @@ define('tools.querytool', [ // Callback function for the flash button click. on_flash: function() { + let data_click_counter = $('#btn-flash').attr('data-click-counter'); + data_click_counter = (parseInt(data_click_counter) + 1)%10; + $('#btn-flash').attr('data-click-counter', data_click_counter); + this.handler.history_query_source = QuerySources.EXECUTE; queryToolActions.executeQuery(this.handler); diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py index 61aa4cf5a..a754a3e25 100644 --- a/web/regression/feature_utils/pgadmin_page.py +++ b/web/regression/feature_utils/pgadmin_page.py @@ -180,9 +180,15 @@ class PgadminPage: retry = 5 execute_button = self.find_by_css_selector( QueryToolLocators.btn_execute_query_css) + first_click = execute_button.get_attribute('data-click-counter') while retry > 0: execute_button.click() - if self.wait_for_query_tool_loading_indicator_to_appear(): + execute_button = self.find_by_css_selector( + QueryToolLocators.btn_execute_query_css) + second_click = execute_button.get_attribute( + 'data-click-counter') + if first_click != second_click: + self.wait_for_query_tool_loading_indicator_to_appear() break else: retry -= 1 @@ -191,34 +197,65 @@ class PgadminPage: 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""" + retry = 3 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.find_by_css_selector( - QueryToolLocators.btn_auto_commit).click() + while retry > 0: + self.find_by_css_selector( + QueryToolLocators.btn_auto_commit).click() + time.sleep(0.2) + if 'visibility-hidden' not in \ + check_status.get_attribute('class'): + break + else: + retry -= 1 + 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.find_by_css_selector( - QueryToolLocators.btn_auto_rollback).click() + while retry > 0: + self.find_by_css_selector( + QueryToolLocators.btn_auto_rollback).click() + time.sleep(0.2) + if 'visibility-hidden' not in \ + check_status.get_attribute('class'): + break + else: + retry -= 1 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""" + retry = 3 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.find_by_css_selector( - QueryToolLocators.btn_auto_commit).click() + while retry > 0: + self.find_by_css_selector( + QueryToolLocators.btn_auto_commit).click() + time.sleep(0.2) + if 'visibility-hidden' in \ + check_status.get_attribute('class'): + break + else: + retry -= 1 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.find_by_css_selector( - QueryToolLocators.btn_auto_rollback).click() + while retry > 0: + self.find_by_css_selector( + QueryToolLocators.btn_auto_rollback).click() + time.sleep(0.2) + if 'visibility-hidden' in \ + check_status.get_attribute('class'): + break + else: + retry -= 1 def close_data_grid(self): self.driver.switch_to_default_content() @@ -273,9 +310,7 @@ class PgadminPage: self.wait_for_elements_to_appear( self.driver, list_of_element[index_of_element]) time.sleep(1) - self.driver.execute_script( - "arguments[0].click()", - list_of_element[index_of_element]) + list_of_element[index_of_element].click() operation_status = True else: print("{ERROR} - The required element with name: " + str( @@ -430,7 +465,10 @@ class PgadminPage: if self.check_if_element_exist_by_xpath( "//div[@class='ajs-header'and text()='INTERNAL SERVER " "ERROR']", 1): - self.click_modal('OK') + try: + self.click_modal('OK') + except Exception: + pass retry -= 1 else: break diff --git a/web/regression/feature_utils/tree_area_locators.py b/web/regression/feature_utils/tree_area_locators.py index 3c4e8e5d4..e3dbb61ac 100644 --- a/web/regression/feature_utils/tree_area_locators.py +++ b/web/regression/feature_utils/tree_area_locators.py @@ -53,6 +53,10 @@ class TreeAreaLocators(): "contains(text(),'Functions')]]]]]]]]]]/" \ "following-sibling::ul/li/div//div/span[2]/span[2]" + sub_nodes_of_login_group_node = \ + "//div[div[div[span[span[contains(text(),'Login/Group Roles')]]]]]" \ + "/following::ul/li/div[@class='aciTreeLine']" + @staticmethod def sub_nodes_of_a_server_node(server_name): xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \ ^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Fixes for pgAdmin feature tests @ 2019-11-20 07:39 Akshay Joshi <[email protected]> parent: Shubham Agarwal <[email protected]> 0 siblings, 1 reply; 12+ messages in thread From: Akshay Joshi @ 2019-11-20 07:39 UTC (permalink / raw) To: Shubham Agarwal <[email protected]>; +Cc: pgadmin-hackers Thanks, patch applied. On Wed, Nov 20, 2019 at 12:34 PM Shubham Agarwal < [email protected]> wrote: > Hi Team, > PFA feature test fixture patch containing the following things: > > 1. Added an attribute 'data-click-counter' in query execute button which > gets incremented once query button is clicked up to 9 and then reset to 0. > This is added just to support automation. > 2. Locator for login_group_role is added and used to expand tree. > 3. Functions for enabling and disable auto_commit and auto_rollback are > made more precise. > 4. Some scrolling problem is addressed in view_data_dml_query test. > 5. Handled the stale element reference exception in query_tool_journey_test > > Regards, > Shubham Agarwal > > On Fri, Nov 15, 2019 at 6:03 PM Akshay Joshi < > [email protected]> wrote: > >> Thanks, patch applied >> >> On Fri, Nov 15, 2019 at 5:59 PM Shubham Agarwal < >> [email protected]> wrote: >> >>> Hi Team, >>> >>> PFA feature test fixture patch containing the following fixes: >>> 1. Process watcher loading logs fix >>> 2. Auto commit/rollback issue in query_tool_tests >>> 3. Fixed the scrolling issue while verifying values in a table. >>> 4. Modified some functions in pgadmin_page.py >>> >>> On Wed, Nov 13, 2019 at 11:19 AM Akshay Joshi < >>> [email protected]> wrote: >>> >>>> Thanks, patch applied. >>>> >>>> On Tue, Nov 12, 2019 at 6:27 PM Shubham Agarwal < >>>> [email protected]> wrote: >>>> >>>>> Hi Team, >>>>> PFA patch containing some more fixes for random feature test failures. >>>>> >>>>> Thanks and regards, >>>>> Shubham Agarwal >>>>> >>>>> On Mon, Nov 11, 2019 at 10:55 AM Akshay Joshi < >>>>> [email protected]> wrote: >>>>> >>>>>> Thanks, patch applied with a minor change. Menu for 'Delete Drop' >>>>>> server has been changed to 'Remove Server' which causes all the test cases >>>>>> failing on my machine. >>>>>> >>>>>> On Mon, Nov 11, 2019 at 10:18 AM Shubham Agarwal < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Hi Team, >>>>>>> >>>>>>> Attached is the patch containing fixes for the failed feature test >>>>>>> cases. >>>>>>> This patch contains- >>>>>>> 1. Newly created function for traversing the browser tree. >>>>>>> 2. Some synchronization issue fixes. >>>>>>> 3. Modified locators. >>>>>>> 4. Test cases fix for the recent commits. >>>>>>> >>>>>>> -- >>>>>>> Thanks & Regards, >>>>>>> Shubham Agarwal >>>>>>> EnterpriseDB Corporation >>>>>>> >>>>>>> The Postgres Database Company >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> *Thanks & Regards* >>>>>> *Akshay Joshi* >>>>>> >>>>>> *Sr. Software Architect* >>>>>> *EnterpriseDB Software India Private Limited* >>>>>> *Mobile: +91 976-788-8246* >>>>>> >>>>> >>>>> >>>>> -- >>>>> Thanks & Regards, >>>>> Shubham Agarwal >>>>> EnterpriseDB Corporation >>>>> >>>>> The Postgres Database Company >>>>> >>>> >>>> >>>> -- >>>> *Thanks & Regards* >>>> *Akshay Joshi* >>>> >>>> *Sr. Software Architect* >>>> *EnterpriseDB Software India Private Limited* >>>> *Mobile: +91 976-788-8246* >>>> >>> >>> >>> -- >>> Thanks & Regards, >>> Shubham Agarwal >>> EnterpriseDB Corporation >>> >>> The Postgres Database Company >>> >> >> >> -- >> *Thanks & Regards* >> *Akshay Joshi* >> >> *Sr. Software Architect* >> *EnterpriseDB Software India Private Limited* >> *Mobile: +91 976-788-8246* >> > > > -- > Thanks & Regards, > Shubham Agarwal > EnterpriseDB Corporation > > The Postgres Database Company > -- *Thanks & Regards* *Akshay Joshi* *Sr. Software Architect* *EnterpriseDB Software India Private Limited* *Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Fixes for pgAdmin feature tests @ 2019-11-21 10:09 Shubham Agarwal <[email protected]> parent: Akshay Joshi <[email protected]> 0 siblings, 1 reply; 12+ messages in thread From: Shubham Agarwal @ 2019-11-21 10:09 UTC (permalink / raw) To: pgadmin-hackers Hi Team, Attach is the patch for feature test fix containing the following: 1. Handled click event in query tool due to intermediate clicking issue. 2. Observed that the database is not getting created in a test case, so failed the test case there only. On Wed, Nov 20, 2019 at 1:09 PM Akshay Joshi <[email protected]> wrote: > Thanks, patch applied. > > On Wed, Nov 20, 2019 at 12:34 PM Shubham Agarwal < > [email protected]> wrote: > >> Hi Team, >> PFA feature test fixture patch containing the following things: >> >> 1. Added an attribute 'data-click-counter' in query execute button which >> gets incremented once query button is clicked up to 9 and then reset to 0. >> This is added just to support automation. >> 2. Locator for login_group_role is added and used to expand tree. >> 3. Functions for enabling and disable auto_commit and auto_rollback are >> made more precise. >> 4. Some scrolling problem is addressed in view_data_dml_query test. >> 5. Handled the stale element reference exception in >> query_tool_journey_test >> >> Regards, >> Shubham Agarwal >> >> On Fri, Nov 15, 2019 at 6:03 PM Akshay Joshi < >> [email protected]> wrote: >> >>> Thanks, patch applied >>> >>> On Fri, Nov 15, 2019 at 5:59 PM Shubham Agarwal < >>> [email protected]> wrote: >>> >>>> Hi Team, >>>> >>>> PFA feature test fixture patch containing the following fixes: >>>> 1. Process watcher loading logs fix >>>> 2. Auto commit/rollback issue in query_tool_tests >>>> 3. Fixed the scrolling issue while verifying values in a table. >>>> 4. Modified some functions in pgadmin_page.py >>>> >>>> On Wed, Nov 13, 2019 at 11:19 AM Akshay Joshi < >>>> [email protected]> wrote: >>>> >>>>> Thanks, patch applied. >>>>> >>>>> On Tue, Nov 12, 2019 at 6:27 PM Shubham Agarwal < >>>>> [email protected]> wrote: >>>>> >>>>>> Hi Team, >>>>>> PFA patch containing some more fixes for random feature test failures. >>>>>> >>>>>> Thanks and regards, >>>>>> Shubham Agarwal >>>>>> >>>>>> On Mon, Nov 11, 2019 at 10:55 AM Akshay Joshi < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Thanks, patch applied with a minor change. Menu for 'Delete Drop' >>>>>>> server has been changed to 'Remove Server' which causes all the test cases >>>>>>> failing on my machine. >>>>>>> >>>>>>> On Mon, Nov 11, 2019 at 10:18 AM Shubham Agarwal < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> Hi Team, >>>>>>>> >>>>>>>> Attached is the patch containing fixes for the failed feature test >>>>>>>> cases. >>>>>>>> This patch contains- >>>>>>>> 1. Newly created function for traversing the browser tree. >>>>>>>> 2. Some synchronization issue fixes. >>>>>>>> 3. Modified locators. >>>>>>>> 4. Test cases fix for the recent commits. >>>>>>>> >>>>>>>> -- >>>>>>>> Thanks & Regards, >>>>>>>> Shubham Agarwal >>>>>>>> EnterpriseDB Corporation >>>>>>>> >>>>>>>> The Postgres Database Company >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> *Thanks & Regards* >>>>>>> *Akshay Joshi* >>>>>>> >>>>>>> *Sr. Software Architect* >>>>>>> *EnterpriseDB Software India Private Limited* >>>>>>> *Mobile: +91 976-788-8246* >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Thanks & Regards, >>>>>> Shubham Agarwal >>>>>> EnterpriseDB Corporation >>>>>> >>>>>> The Postgres Database Company >>>>>> >>>>> >>>>> >>>>> -- >>>>> *Thanks & Regards* >>>>> *Akshay Joshi* >>>>> >>>>> *Sr. Software Architect* >>>>> *EnterpriseDB Software India Private Limited* >>>>> *Mobile: +91 976-788-8246* >>>>> >>>> >>>> >>>> -- >>>> Thanks & Regards, >>>> Shubham Agarwal >>>> EnterpriseDB Corporation >>>> >>>> The Postgres Database Company >>>> >>> >>> >>> -- >>> *Thanks & Regards* >>> *Akshay Joshi* >>> >>> *Sr. Software Architect* >>> *EnterpriseDB Software India Private Limited* >>> *Mobile: +91 976-788-8246* >>> >> >> >> -- >> Thanks & Regards, >> Shubham Agarwal >> EnterpriseDB Corporation >> >> The Postgres Database Company >> > > > -- > *Thanks & Regards* > *Akshay Joshi* > > *Sr. Software Architect* > *EnterpriseDB Software India Private Limited* > *Mobile: +91 976-788-8246* > -- Thanks & Regards, Shubham Agarwal EnterpriseDB Corporation The Postgres Database Company Attachments: [application/octet-stream] feature_test_fix_v5.patch (2.6K, 3-feature_test_fix_v5.patch) download | inline diff: diff --git a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py index 5ae86734c..22c4a99df 100644 --- a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py +++ b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py @@ -17,6 +17,7 @@ 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 from regression.feature_utils.locators import NavMenuLocators +from regression.feature_utils.tree_area_locators import TreeAreaLocators class PGUtilitiesBackupFeatureTest(BaseFeatureTest): @@ -55,7 +56,10 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest): self.server['sslmode'] ) test_utils.drop_database(connection, self.database_name) - test_utils.create_database(self.server, self.database_name) + db_id = test_utils.create_database(self.server, self.database_name) + if not db_id: + self.assertTrue(False, "Database {} is not " + "created".format(self.database_name)) test_gui_helper.close_bgprocess_popup(self) self.page.add_server(self.server) diff --git a/web/pgadmin/feature_tests/view_data_dml_queries.py b/web/pgadmin/feature_tests/view_data_dml_queries.py index 381be22dc..62aa09858 100644 --- a/web/pgadmin/feature_tests/view_data_dml_queries.py +++ b/web/pgadmin/feature_tests/view_data_dml_queries.py @@ -338,9 +338,7 @@ CREATE TABLE public.nonintpkey self.assertEquals(text, messages_ele.text) def _verify_row_data(self, is_new_row, config_check_data): - self.page.find_by_css_selector( - QueryToolLocators.btn_execute_query_css).click() - + self.page.click_execute_query_button() # First row if row height = 0, second row if its 25 row_height = 0 if is_new_row else 25 diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py index a754a3e25..8bec1a74b 100644 --- a/web/regression/feature_utils/pgadmin_page.py +++ b/web/regression/feature_utils/pgadmin_page.py @@ -171,10 +171,7 @@ class PgadminPage: def execute_query(self, query): self.fill_codemirror_area_with(query) - execute_button = self.find_by_css_selector( - QueryToolLocators.btn_execute_query_css) - execute_button.click() - self.wait_for_query_tool_loading_indicator_to_disappear() + self.click_execute_query_button() def click_execute_query_button(self): retry = 5 ^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Fixes for pgAdmin feature tests @ 2019-11-21 11:52 Akshay Joshi <[email protected]> parent: Shubham Agarwal <[email protected]> 0 siblings, 1 reply; 12+ messages in thread From: Akshay Joshi @ 2019-11-21 11:52 UTC (permalink / raw) To: Shubham Agarwal <[email protected]>; +Cc: pgadmin-hackers Thanks, patch applied. On Thu, Nov 21, 2019 at 3:40 PM Shubham Agarwal < [email protected]> wrote: > Hi Team, > Attach is the patch for feature test fix containing the following: > 1. Handled click event in query tool due to intermediate clicking issue. > 2. Observed that the database is not getting created in a test case, so > failed the test case there only. > > On Wed, Nov 20, 2019 at 1:09 PM Akshay Joshi < > [email protected]> wrote: > >> Thanks, patch applied. >> >> On Wed, Nov 20, 2019 at 12:34 PM Shubham Agarwal < >> [email protected]> wrote: >> >>> Hi Team, >>> PFA feature test fixture patch containing the following things: >>> >>> 1. Added an attribute 'data-click-counter' in query execute button which >>> gets incremented once query button is clicked up to 9 and then reset to 0. >>> This is added just to support automation. >>> 2. Locator for login_group_role is added and used to expand tree. >>> 3. Functions for enabling and disable auto_commit and auto_rollback are >>> made more precise. >>> 4. Some scrolling problem is addressed in view_data_dml_query test. >>> 5. Handled the stale element reference exception in >>> query_tool_journey_test >>> >>> Regards, >>> Shubham Agarwal >>> >>> On Fri, Nov 15, 2019 at 6:03 PM Akshay Joshi < >>> [email protected]> wrote: >>> >>>> Thanks, patch applied >>>> >>>> On Fri, Nov 15, 2019 at 5:59 PM Shubham Agarwal < >>>> [email protected]> wrote: >>>> >>>>> Hi Team, >>>>> >>>>> PFA feature test fixture patch containing the following fixes: >>>>> 1. Process watcher loading logs fix >>>>> 2. Auto commit/rollback issue in query_tool_tests >>>>> 3. Fixed the scrolling issue while verifying values in a table. >>>>> 4. Modified some functions in pgadmin_page.py >>>>> >>>>> On Wed, Nov 13, 2019 at 11:19 AM Akshay Joshi < >>>>> [email protected]> wrote: >>>>> >>>>>> Thanks, patch applied. >>>>>> >>>>>> On Tue, Nov 12, 2019 at 6:27 PM Shubham Agarwal < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Hi Team, >>>>>>> PFA patch containing some more fixes for random feature test >>>>>>> failures. >>>>>>> >>>>>>> Thanks and regards, >>>>>>> Shubham Agarwal >>>>>>> >>>>>>> On Mon, Nov 11, 2019 at 10:55 AM Akshay Joshi < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> Thanks, patch applied with a minor change. Menu for 'Delete Drop' >>>>>>>> server has been changed to 'Remove Server' which causes all the test cases >>>>>>>> failing on my machine. >>>>>>>> >>>>>>>> On Mon, Nov 11, 2019 at 10:18 AM Shubham Agarwal < >>>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>>> Hi Team, >>>>>>>>> >>>>>>>>> Attached is the patch containing fixes for the failed feature test >>>>>>>>> cases. >>>>>>>>> This patch contains- >>>>>>>>> 1. Newly created function for traversing the browser tree. >>>>>>>>> 2. Some synchronization issue fixes. >>>>>>>>> 3. Modified locators. >>>>>>>>> 4. Test cases fix for the recent commits. >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Thanks & Regards, >>>>>>>>> Shubham Agarwal >>>>>>>>> EnterpriseDB Corporation >>>>>>>>> >>>>>>>>> The Postgres Database Company >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> *Thanks & Regards* >>>>>>>> *Akshay Joshi* >>>>>>>> >>>>>>>> *Sr. Software Architect* >>>>>>>> *EnterpriseDB Software India Private Limited* >>>>>>>> *Mobile: +91 976-788-8246* >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Thanks & Regards, >>>>>>> Shubham Agarwal >>>>>>> EnterpriseDB Corporation >>>>>>> >>>>>>> The Postgres Database Company >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> *Thanks & Regards* >>>>>> *Akshay Joshi* >>>>>> >>>>>> *Sr. Software Architect* >>>>>> *EnterpriseDB Software India Private Limited* >>>>>> *Mobile: +91 976-788-8246* >>>>>> >>>>> >>>>> >>>>> -- >>>>> Thanks & Regards, >>>>> Shubham Agarwal >>>>> EnterpriseDB Corporation >>>>> >>>>> The Postgres Database Company >>>>> >>>> >>>> >>>> -- >>>> *Thanks & Regards* >>>> *Akshay Joshi* >>>> >>>> *Sr. Software Architect* >>>> *EnterpriseDB Software India Private Limited* >>>> *Mobile: +91 976-788-8246* >>>> >>> >>> >>> -- >>> Thanks & Regards, >>> Shubham Agarwal >>> EnterpriseDB Corporation >>> >>> The Postgres Database Company >>> >> >> >> -- >> *Thanks & Regards* >> *Akshay Joshi* >> >> *Sr. Software Architect* >> *EnterpriseDB Software India Private Limited* >> *Mobile: +91 976-788-8246* >> > > > -- > Thanks & Regards, > Shubham Agarwal > EnterpriseDB Corporation > > The Postgres Database Company > -- *Thanks & Regards* *Akshay Joshi* *Sr. Software Architect* *EnterpriseDB Software India Private Limited* *Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Fixes for pgAdmin feature tests @ 2019-12-03 12:39 Shubham Agarwal <[email protected]> parent: Akshay Joshi <[email protected]> 0 siblings, 1 reply; 12+ messages in thread From: Shubham Agarwal @ 2019-12-03 12:39 UTC (permalink / raw) To: pgadmin-hackers Hi Team, PFA patch for feature tests containing following fixes- 1. Modified the get_chromedriver utility for supporting python version below 3.5. 2. Handled some exceptions getting intermittently on some databases. 3. Generalized some functions with additional parameters. 4. Disabled the auto-expansion of the children nodes for maintaining the synchronization. On Thu, Nov 21, 2019 at 5:22 PM Akshay Joshi <[email protected]> wrote: > Thanks, patch applied. > > On Thu, Nov 21, 2019 at 3:40 PM Shubham Agarwal < > [email protected]> wrote: > >> Hi Team, >> Attach is the patch for feature test fix containing the following: >> 1. Handled click event in query tool due to intermediate clicking issue. >> 2. Observed that the database is not getting created in a test case, so >> failed the test case there only. >> >> On Wed, Nov 20, 2019 at 1:09 PM Akshay Joshi < >> [email protected]> wrote: >> >>> Thanks, patch applied. >>> >>> On Wed, Nov 20, 2019 at 12:34 PM Shubham Agarwal < >>> [email protected]> wrote: >>> >>>> Hi Team, >>>> PFA feature test fixture patch containing the following things: >>>> >>>> 1. Added an attribute 'data-click-counter' in query execute button >>>> which gets incremented once query button is clicked up to 9 and then reset >>>> to 0. This is added just to support automation. >>>> 2. Locator for login_group_role is added and used to expand tree. >>>> 3. Functions for enabling and disable auto_commit and auto_rollback are >>>> made more precise. >>>> 4. Some scrolling problem is addressed in view_data_dml_query test. >>>> 5. Handled the stale element reference exception in >>>> query_tool_journey_test >>>> >>>> Regards, >>>> Shubham Agarwal >>>> >>>> On Fri, Nov 15, 2019 at 6:03 PM Akshay Joshi < >>>> [email protected]> wrote: >>>> >>>>> Thanks, patch applied >>>>> >>>>> On Fri, Nov 15, 2019 at 5:59 PM Shubham Agarwal < >>>>> [email protected]> wrote: >>>>> >>>>>> Hi Team, >>>>>> >>>>>> PFA feature test fixture patch containing the following fixes: >>>>>> 1. Process watcher loading logs fix >>>>>> 2. Auto commit/rollback issue in query_tool_tests >>>>>> 3. Fixed the scrolling issue while verifying values in a table. >>>>>> 4. Modified some functions in pgadmin_page.py >>>>>> >>>>>> On Wed, Nov 13, 2019 at 11:19 AM Akshay Joshi < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Thanks, patch applied. >>>>>>> >>>>>>> On Tue, Nov 12, 2019 at 6:27 PM Shubham Agarwal < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> Hi Team, >>>>>>>> PFA patch containing some more fixes for random feature test >>>>>>>> failures. >>>>>>>> >>>>>>>> Thanks and regards, >>>>>>>> Shubham Agarwal >>>>>>>> >>>>>>>> On Mon, Nov 11, 2019 at 10:55 AM Akshay Joshi < >>>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>>> Thanks, patch applied with a minor change. Menu for 'Delete Drop' >>>>>>>>> server has been changed to 'Remove Server' which causes all the test cases >>>>>>>>> failing on my machine. >>>>>>>>> >>>>>>>>> On Mon, Nov 11, 2019 at 10:18 AM Shubham Agarwal < >>>>>>>>> [email protected]> wrote: >>>>>>>>> >>>>>>>>>> Hi Team, >>>>>>>>>> >>>>>>>>>> Attached is the patch containing fixes for the failed feature >>>>>>>>>> test cases. >>>>>>>>>> This patch contains- >>>>>>>>>> 1. Newly created function for traversing the browser tree. >>>>>>>>>> 2. Some synchronization issue fixes. >>>>>>>>>> 3. Modified locators. >>>>>>>>>> 4. Test cases fix for the recent commits. >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> Thanks & Regards, >>>>>>>>>> Shubham Agarwal >>>>>>>>>> EnterpriseDB Corporation >>>>>>>>>> >>>>>>>>>> The Postgres Database Company >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> *Thanks & Regards* >>>>>>>>> *Akshay Joshi* >>>>>>>>> >>>>>>>>> *Sr. Software Architect* >>>>>>>>> *EnterpriseDB Software India Private Limited* >>>>>>>>> *Mobile: +91 976-788-8246* >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Thanks & Regards, >>>>>>>> Shubham Agarwal >>>>>>>> EnterpriseDB Corporation >>>>>>>> >>>>>>>> The Postgres Database Company >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> *Thanks & Regards* >>>>>>> *Akshay Joshi* >>>>>>> >>>>>>> *Sr. Software Architect* >>>>>>> *EnterpriseDB Software India Private Limited* >>>>>>> *Mobile: +91 976-788-8246* >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Thanks & Regards, >>>>>> Shubham Agarwal >>>>>> EnterpriseDB Corporation >>>>>> >>>>>> The Postgres Database Company >>>>>> >>>>> >>>>> >>>>> -- >>>>> *Thanks & Regards* >>>>> *Akshay Joshi* >>>>> >>>>> *Sr. Software Architect* >>>>> *EnterpriseDB Software India Private Limited* >>>>> *Mobile: +91 976-788-8246* >>>>> >>>> >>>> >>>> -- >>>> Thanks & Regards, >>>> Shubham Agarwal >>>> EnterpriseDB Corporation >>>> >>>> The Postgres Database Company >>>> >>> >>> >>> -- >>> *Thanks & Regards* >>> *Akshay Joshi* >>> >>> *Sr. Software Architect* >>> *EnterpriseDB Software India Private Limited* >>> *Mobile: +91 976-788-8246* >>> >> >> >> -- >> Thanks & Regards, >> Shubham Agarwal >> EnterpriseDB Corporation >> >> The Postgres Database Company >> > > > -- > *Thanks & Regards* > *Akshay Joshi* > > *Sr. Software Architect* > *EnterpriseDB Software India Private Limited* > *Mobile: +91 976-788-8246* > -- Thanks & Regards, Shubham Agarwal EnterpriseDB Corporation The Postgres Database Company Attachments: [application/octet-stream] feature_test_fix_v6.patch (15.9K, 3-feature_test_fix_v6.patch) download | inline diff: diff --git a/tools/get_chromedriver.py b/tools/get_chromedriver.py index 0a5630609..dfd62afe3 100644 --- a/tools/get_chromedriver.py +++ b/tools/get_chromedriver.py @@ -17,7 +17,12 @@ import os import platform import subprocess import sys -import urllib.request +try: + from urllib.request import urlopen, urlretrieve + from urllib.error import URLError +except Exception: + from urllib import urlopen, urlretrieve + URLError = Exception import zipfile @@ -85,13 +90,13 @@ def get_chrome_version(args): # On Linux/Mac we run the Chrome executable with the --version flag, # then parse the output. try: - result = subprocess.run([args.chrome, '--version'], - stdout=subprocess.PIPE) - except FileNotFoundError as e: + result = subprocess.Popen([args.chrome, '--version'], + stdout=subprocess.PIPE) + except FileNotFoundError: print('The specified Chrome executable could not be found.') sys.exit(1) - version_str = result.stdout.decode("utf-8").strip() + version_str = result.stdout.read().decode("utf-8") # Check for 'Chrom' not 'Chrome' in case the user is using Chromium. if "Chrom" not in version_str: print('The specified Chrome executable output an unexpected ' @@ -120,8 +125,8 @@ def get_chromedriver_version(chrome_version): .format(chrome_version) try: - fp = urllib.request.urlopen(url) - except urllib.error.URLError as e: + fp = urlopen(url) + except URLError as e: print('The chromedriver catalog URL could not be accessed: {}' .format(e)) sys.exit(1) @@ -173,8 +178,8 @@ print('Downloading chromedriver v{} for Chrome v{} on {}...' .format(chromedriver_version, chrome_version, system)) try: - file, headers = urllib.request.urlretrieve(url) -except urllib.error.URLError as e: + file, headers = urlretrieve(url) +except URLError as e: print('The chromedriver download URL could not be accessed: {}' .format(e)) sys.exit(1) diff --git a/web/pgadmin/feature_tests/pg_datatype_validation_test.py b/web/pgadmin/feature_tests/pg_datatype_validation_test.py index c4d368df1..6bac34737 100644 --- a/web/pgadmin/feature_tests/pg_datatype_validation_test.py +++ b/web/pgadmin/feature_tests/pg_datatype_validation_test.py @@ -164,11 +164,7 @@ class PGDataypeFeatureTest(BaseFeatureTest): self._create_enum_type() for batch in config_data: query = self.construct_select_query(batch) - self.page.fill_codemirror_area_with(query) - execute_query = self.page.find_by_css_selector( - QueryToolLocators.btn_execute_query_css) - execute_query.click() - + self.page.execute_query(query) wait = WebDriverWait(self.page.driver, 5) # wait for the visibility of the grid to appear diff --git a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py index 22c4a99df..4c311c08e 100644 --- a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py +++ b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py @@ -118,8 +118,8 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest): (By.XPATH, NavMenuLocators.process_watcher_alertfier)) self.page.wait_for_element_to_disappear( - lambda driver: driver.find_element_by_css_selector(".loading-logs") - ) + lambda driver: driver.find_element_by_css_selector( + ".loading-logs"), 10) if status != "Successfully completed.": self.assertEquals(status, "Successfully completed.") @@ -188,8 +188,8 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest): (By.XPATH, NavMenuLocators.process_watcher_alertfier)) self.page.wait_for_element_to_disappear( - lambda driver: driver.find_element_by_css_selector(".loading-logs") - ) + lambda driver: driver.find_element_by_css_selector( + ".loading-logs"), 10) if status != "Successfully completed.": self.assertEquals(status, "Successfully completed.") @@ -215,6 +215,7 @@ 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( diff --git a/web/pgadmin/feature_tests/query_tool_auto_complete_tests.py b/web/pgadmin/feature_tests/query_tool_auto_complete_tests.py index fe6d68e4d..63246f999 100644 --- a/web/pgadmin/feature_tests/query_tool_auto_complete_tests.py +++ b/web/pgadmin/feature_tests/query_tool_auto_complete_tests.py @@ -37,22 +37,22 @@ class QueryToolAutoCompleteFeatureTest(BaseFeatureTest): self.page.add_server(self.server) self.first_schema_name = "test_schema" + \ - str(random.randint(1000, 3000)) + str(random.randint(1000, 2000)) test_utils.create_schema(self.server, self.test_db, self.first_schema_name) self.second_schema_name = "comp_schema" + \ - str(random.randint(1000, 3000)) + str(random.randint(2000, 3000)) test_utils.create_schema(self.server, self.test_db, self.second_schema_name) self.first_table_name = "auto_comp_" + \ - str(random.randint(1000, 3000)) + str(random.randint(1000, 2000)) test_utils.create_table(self.server, self.test_db, self.first_table_name) self.second_table_name = "auto_comp_" + \ - str(random.randint(1000, 3000)) + str(random.randint(2000, 3000)) test_utils.create_table(self.server, self.test_db, self.second_table_name) diff --git a/web/pgadmin/feature_tests/query_tool_tests.py b/web/pgadmin/feature_tests/query_tool_tests.py index de6c479f5..bcb74ddb4 100644 --- a/web/pgadmin/feature_tests/query_tool_tests.py +++ b/web/pgadmin/feature_tests/query_tool_tests.py @@ -218,12 +218,6 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format( QueryToolLocators.query_output_cells)) ) - # click on first data column to select all column. - column_1 = \ - self.page.find_by_css_selector( - QueryToolLocators.output_column_header_css.format('id1')) - column_1.click() - canvas = self.wait.until(EC.presence_of_element_located( (By.CSS_SELECTOR, QueryToolLocators.query_output_canvas_css))) @@ -235,6 +229,11 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format( scroll = 10 status = False while scroll: + # click on first data column to select all column. + column_1 = \ + self.page.find_by_css_selector( + QueryToolLocators.output_column_header_css.format('id1')) + column_1.click() canvas_ele = self.page.find_by_css_selector('.grid-canvas') scrolling_height = canvas_ele.size['height'] self.driver.execute_script( diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py index 8bec1a74b..09fc30ac8 100644 --- a/web/regression/feature_utils/pgadmin_page.py +++ b/web/regression/feature_utils/pgadmin_page.py @@ -173,7 +173,7 @@ class PgadminPage: self.fill_codemirror_area_with(query) self.click_execute_query_button() - def click_execute_query_button(self): + def click_execute_query_button(self, timeout=20): retry = 5 execute_button = self.find_by_css_selector( QueryToolLocators.btn_execute_query_css) @@ -189,7 +189,7 @@ class PgadminPage: break else: retry -= 1 - self.wait_for_query_tool_loading_indicator_to_disappear() + self.wait_for_query_tool_loading_indicator_to_disappear(timeout) def check_execute_option(self, option): """"This function will check auto commit or auto roll back based on @@ -689,15 +689,17 @@ class PgadminPage: try: webdriver.ActionChains(self.driver).double_click( server_element).perform() - if self.wait_for_element_to_appear(self.driver, - ConnectToServerDiv.ok_button): - self.fill_input_by_xpath( - ConnectToServerDiv.password_field, password) + if self.check_if_element_exist_by_xpath( + ConnectToServerDiv.ok_button): + field = self.find_by_xpath( + ConnectToServerDiv.password_field) + self.fill_input(field, password) self.find_by_xpath(ConnectToServerDiv.ok_button).click() - self.wait_until_element_not_visible( - ConnectToServerDiv.ok_button) - if self.wait_for_element_to_be_visible( - self.driver, ConnectToServerDiv.error_message, 2): + self.wait_for_element_to_disappear( + lambda driver: driver.find_element_by_xpath( + ConnectToServerDiv.ok_button)) + if self.check_if_element_exist_by_xpath( + ConnectToServerDiv.error_message, 2): print( "While entering password in click_and_connect_server " "function, error is occurred : " + str( @@ -983,7 +985,7 @@ class PgadminPage: self._wait_for("element to exist", element_if_it_exists) return find_method_with_args(self.driver) - def wait_for_element_to_disappear(self, find_method_with_args): + def wait_for_element_to_disappear(self, find_method_with_args, timeout=5): def element_if_it_disappears(driver): try: element = find_method_with_args(driver) @@ -994,7 +996,8 @@ class PgadminPage: except (NoSuchElementException, StaleElementReferenceException): return True - return self._wait_for("element to disappear", element_if_it_disappears) + return self._wait_for("element to disappear", + element_if_it_disappears, timeout) def wait_for_reloading_indicator_to_disappear(self): def reloading_indicator_has_disappeared(driver): @@ -1017,7 +1020,7 @@ class PgadminPage: self._wait_for("spinner to disappear", spinner_has_disappeared, 20) - def wait_for_query_tool_loading_indicator_to_disappear(self): + def wait_for_query_tool_loading_indicator_to_disappear(self, timeout=20): def spinner_has_disappeared(driver): try: spinner = driver.find_element_by_css_selector( @@ -1029,7 +1032,8 @@ class PgadminPage: time.sleep(0.5) return True - self._wait_for("spinner to disappear", spinner_has_disappeared, 20) + self._wait_for( + "spinner to disappear", spinner_has_disappeared, timeout) def wait_for_query_tool_loading_indicator_to_appear(self): status = self.check_if_element_exist_by_xpath( @@ -1151,7 +1155,7 @@ class PgadminPage: try: element = self.driver.find_element(*click_locator) element.click() - WebDriverWait(self.driver, 2).until( + WebDriverWait(self.driver, 10).until( EC.visibility_of_element_located(verify_locator)) click_status = True except Exception: diff --git a/web/regression/python_test_utils/test_gui_helper.py b/web/regression/python_test_utils/test_gui_helper.py index aaa9707b7..d2f87a6fb 100644 --- a/web/regression/python_test_utils/test_gui_helper.py +++ b/web/regression/python_test_utils/test_gui_helper.py @@ -47,11 +47,14 @@ def close_bgprocess_popup(tester): def close_process_watcher(tester): attempt = 10 while attempt > 0: - close_btn = tester.page.find_by_xpath( - NavMenuLocators.process_watcher_close_button_xpath) - close_btn.click() - if not tester.page.check_if_element_exist_by_xpath( - NavMenuLocators.process_watcher_close_button_xpath, 1): - break - else: + try: + if not tester.page.check_if_element_exist_by_xpath( + NavMenuLocators.process_watcher_close_button_xpath, 1): + break + else: + close_btn = tester.page.find_by_xpath( + NavMenuLocators.process_watcher_close_button_xpath) + close_btn.click() + attempt -= 1 + except Exception: attempt -= 1 diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py index 56d5cb0f9..5d182ece2 100644 --- a/web/regression/python_test_utils/test_utils.py +++ b/web/regression/python_test_utils/test_utils.py @@ -108,6 +108,7 @@ def clear_node_info_dict(): def create_database(server, db_name, encoding=None): """This function used to create database and returns the database id""" + db_id = '' try: connection = get_db_connection( server['db'], @@ -135,13 +136,13 @@ def create_database(server, db_name, encoding=None): pg_cursor.execute("SELECT db.oid from pg_database db WHERE" " db.datname='%s'" % db_name) oid = pg_cursor.fetchone() - db_id = '' if oid: db_id = oid[0] connection.close() return db_id except Exception: traceback.print_exc(file=sys.stderr) + return db_id def create_table(server, db_name, table_name, extra_columns=[]): @@ -777,6 +778,27 @@ def configure_preferences(default_binary_path=None): ' WHERE PID = ?', (-1, pref_tree_state_save_interval.pid) ) + # Disable auto expand sole children tree state for tests + pref_auto_expand_sol_children = \ + browser_pref.preference('auto_expand_sole_children') + + user_pref = cur.execute( + 'SELECT pid, uid FROM user_preferences ' + 'where pid=?', (pref_auto_expand_sol_children.pid,) + ) + + if len(user_pref.fetchall()) == 0: + cur.execute( + 'INSERT INTO user_preferences(pid, uid, value)' + ' VALUES (?,?,?)', (pref_auto_expand_sol_children.pid, 1, 'False') + ) + else: + cur.execute( + 'UPDATE user_preferences' + ' SET VALUE = ?' + ' WHERE PID = ?', ('False', pref_auto_expand_sol_children.pid) + ) + # Disable reload warning on browser pref_confirm_on_refresh_close = \ browser_pref.preference('confirm_on_refresh_close') @@ -1103,18 +1125,21 @@ def get_watcher_dialogue_status(self): """This will get watcher dialogue status""" import time attempts = 120 - + status = None while attempts > 0: - status = self.page.find_by_css_selector( - ".pg-bg-status-text").text - - if 'Failed' in status: - break - if status == 'Started' or status == 'Running...': + try: + status = self.page.find_by_css_selector( + ".pg-bg-status-text").text + + if 'Failed' in status: + break + if status == 'Started' or status == 'Running...': + attempts -= 1 + time.sleep(.5) + else: + break + except Exception: attempts -= 1 - time.sleep(.5) - else: - break return status ^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Fixes for pgAdmin feature tests @ 2019-12-03 14:08 Akshay Joshi <[email protected]> parent: Shubham Agarwal <[email protected]> 0 siblings, 0 replies; 12+ messages in thread From: Akshay Joshi @ 2019-12-03 14:08 UTC (permalink / raw) To: Shubham Agarwal <[email protected]>; +Cc: pgadmin-hackers Thanks, patch applied. On Tue, Dec 3, 2019 at 6:09 PM Shubham Agarwal < [email protected]> wrote: > Hi Team, > > PFA patch for feature tests containing following fixes- > > 1. Modified the get_chromedriver utility for supporting python version > below 3.5. > 2. Handled some exceptions getting intermittently on some databases. > 3. Generalized some functions with additional parameters. > 4. Disabled the auto-expansion of the children nodes for maintaining the > synchronization. > > On Thu, Nov 21, 2019 at 5:22 PM Akshay Joshi < > [email protected]> wrote: > >> Thanks, patch applied. >> >> On Thu, Nov 21, 2019 at 3:40 PM Shubham Agarwal < >> [email protected]> wrote: >> >>> Hi Team, >>> Attach is the patch for feature test fix containing the following: >>> 1. Handled click event in query tool due to intermediate clicking issue. >>> 2. Observed that the database is not getting created in a test case, so >>> failed the test case there only. >>> >>> On Wed, Nov 20, 2019 at 1:09 PM Akshay Joshi < >>> [email protected]> wrote: >>> >>>> Thanks, patch applied. >>>> >>>> On Wed, Nov 20, 2019 at 12:34 PM Shubham Agarwal < >>>> [email protected]> wrote: >>>> >>>>> Hi Team, >>>>> PFA feature test fixture patch containing the following things: >>>>> >>>>> 1. Added an attribute 'data-click-counter' in query execute button >>>>> which gets incremented once query button is clicked up to 9 and then reset >>>>> to 0. This is added just to support automation. >>>>> 2. Locator for login_group_role is added and used to expand tree. >>>>> 3. Functions for enabling and disable auto_commit and auto_rollback >>>>> are made more precise. >>>>> 4. Some scrolling problem is addressed in view_data_dml_query test. >>>>> 5. Handled the stale element reference exception in >>>>> query_tool_journey_test >>>>> >>>>> Regards, >>>>> Shubham Agarwal >>>>> >>>>> On Fri, Nov 15, 2019 at 6:03 PM Akshay Joshi < >>>>> [email protected]> wrote: >>>>> >>>>>> Thanks, patch applied >>>>>> >>>>>> On Fri, Nov 15, 2019 at 5:59 PM Shubham Agarwal < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Hi Team, >>>>>>> >>>>>>> PFA feature test fixture patch containing the following fixes: >>>>>>> 1. Process watcher loading logs fix >>>>>>> 2. Auto commit/rollback issue in query_tool_tests >>>>>>> 3. Fixed the scrolling issue while verifying values in a table. >>>>>>> 4. Modified some functions in pgadmin_page.py >>>>>>> >>>>>>> On Wed, Nov 13, 2019 at 11:19 AM Akshay Joshi < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> Thanks, patch applied. >>>>>>>> >>>>>>>> On Tue, Nov 12, 2019 at 6:27 PM Shubham Agarwal < >>>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>>> Hi Team, >>>>>>>>> PFA patch containing some more fixes for random feature test >>>>>>>>> failures. >>>>>>>>> >>>>>>>>> Thanks and regards, >>>>>>>>> Shubham Agarwal >>>>>>>>> >>>>>>>>> On Mon, Nov 11, 2019 at 10:55 AM Akshay Joshi < >>>>>>>>> [email protected]> wrote: >>>>>>>>> >>>>>>>>>> Thanks, patch applied with a minor change. Menu for 'Delete Drop' >>>>>>>>>> server has been changed to 'Remove Server' which causes all the test cases >>>>>>>>>> failing on my machine. >>>>>>>>>> >>>>>>>>>> On Mon, Nov 11, 2019 at 10:18 AM Shubham Agarwal < >>>>>>>>>> [email protected]> wrote: >>>>>>>>>> >>>>>>>>>>> Hi Team, >>>>>>>>>>> >>>>>>>>>>> Attached is the patch containing fixes for the failed feature >>>>>>>>>>> test cases. >>>>>>>>>>> This patch contains- >>>>>>>>>>> 1. Newly created function for traversing the browser tree. >>>>>>>>>>> 2. Some synchronization issue fixes. >>>>>>>>>>> 3. Modified locators. >>>>>>>>>>> 4. Test cases fix for the recent commits. >>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> Thanks & Regards, >>>>>>>>>>> Shubham Agarwal >>>>>>>>>>> EnterpriseDB Corporation >>>>>>>>>>> >>>>>>>>>>> The Postgres Database Company >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> *Thanks & Regards* >>>>>>>>>> *Akshay Joshi* >>>>>>>>>> >>>>>>>>>> *Sr. Software Architect* >>>>>>>>>> *EnterpriseDB Software India Private Limited* >>>>>>>>>> *Mobile: +91 976-788-8246* >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Thanks & Regards, >>>>>>>>> Shubham Agarwal >>>>>>>>> EnterpriseDB Corporation >>>>>>>>> >>>>>>>>> The Postgres Database Company >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> *Thanks & Regards* >>>>>>>> *Akshay Joshi* >>>>>>>> >>>>>>>> *Sr. Software Architect* >>>>>>>> *EnterpriseDB Software India Private Limited* >>>>>>>> *Mobile: +91 976-788-8246* >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Thanks & Regards, >>>>>>> Shubham Agarwal >>>>>>> EnterpriseDB Corporation >>>>>>> >>>>>>> The Postgres Database Company >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> *Thanks & Regards* >>>>>> *Akshay Joshi* >>>>>> >>>>>> *Sr. Software Architect* >>>>>> *EnterpriseDB Software India Private Limited* >>>>>> *Mobile: +91 976-788-8246* >>>>>> >>>>> >>>>> >>>>> -- >>>>> Thanks & Regards, >>>>> Shubham Agarwal >>>>> EnterpriseDB Corporation >>>>> >>>>> The Postgres Database Company >>>>> >>>> >>>> >>>> -- >>>> *Thanks & Regards* >>>> *Akshay Joshi* >>>> >>>> *Sr. Software Architect* >>>> *EnterpriseDB Software India Private Limited* >>>> *Mobile: +91 976-788-8246* >>>> >>> >>> >>> -- >>> Thanks & Regards, >>> Shubham Agarwal >>> EnterpriseDB Corporation >>> >>> The Postgres Database Company >>> >> >> >> -- >> *Thanks & Regards* >> *Akshay Joshi* >> >> *Sr. Software Architect* >> *EnterpriseDB Software India Private Limited* >> *Mobile: +91 976-788-8246* >> > > > -- > Thanks & Regards, > Shubham Agarwal > EnterpriseDB Corporation > > The Postgres Database Company > -- *Thanks & Regards* *Akshay Joshi* *Sr. Software Architect* *EnterpriseDB Software India Private Limited* *Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 12+ messages in thread
end of thread, other threads:[~2019-12-03 14:08 UTC | newest] Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-11-11 04:44 Fixes for pgAdmin feature tests Shubham Agarwal <[email protected]> 2019-11-11 05:24 ` Akshay Joshi <[email protected]> 2019-11-12 12:57 ` Shubham Agarwal <[email protected]> 2019-11-13 05:49 ` Akshay Joshi <[email protected]> 2019-11-15 12:29 ` Shubham Agarwal <[email protected]> 2019-11-15 12:33 ` Akshay Joshi <[email protected]> 2019-11-20 07:03 ` Shubham Agarwal <[email protected]> 2019-11-20 07:39 ` Akshay Joshi <[email protected]> 2019-11-21 10:09 ` Shubham Agarwal <[email protected]> 2019-11-21 11:52 ` Akshay Joshi <[email protected]> 2019-12-03 12:39 ` Shubham Agarwal <[email protected]> 2019-12-03 14:08 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox