From 026334a71a724b7e77ee9eb607a90899082db17b Mon Sep 17 00:00:00 2001 From: Yogesh Mahajan Date: Mon, 13 Feb 2023 11:58:54 +0530 Subject: [PATCH] Removed logging added for feature test failure. Added more assets to avoid false failures. --- .../feature_tests/browser_tool_bar_test.py | 20 +++++++++++-------- .../feature_tests/query_tool_journey_test.py | 14 ++++++++----- .../feature_utils/base_feature_test.py | 1 - .../python_test_utils/test_utils.py | 1 - web/regression/runtests.py | 7 ------- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/web/regression/feature_tests/browser_tool_bar_test.py b/web/regression/feature_tests/browser_tool_bar_test.py index dfa7af1ab..ba945f5d1 100644 --- a/web/regression/feature_tests/browser_tool_bar_test.py +++ b/web/regression/feature_tests/browser_tool_bar_test.py @@ -31,12 +31,10 @@ class BrowserToolBarFeatureTest(BaseFeatureTest): def before(self): self.page.wait_for_spinner_to_disappear() self.page.add_server(self.server) - print("Added server", file=sys.stderr) self.test_table_name = "test_table" + str( secrets.choice(range(1000, 3000))) test_utils.create_table(self.server, self.test_db, self.test_table_name) - print("before completed", file=sys.stderr) def runTest(self): # Check for query tool button @@ -63,9 +61,12 @@ class BrowserToolBarFeatureTest(BaseFeatureTest): self.test_table_name) def test_query_tool_button(self): - self.page.expand_database_node("Servers", self.server['name'], - self.server['db_password'], - self.test_db) + self.assertTrue(self.page.expand_database_node("Servers", + self.server['name'], + self.server[ + 'db_password'], + self.test_db), + 'Tree is not expanded to database node') self.assertTrue(self.page.retry_click( (By.CSS_SELECTOR, BrowserToolBarLocators.open_query_tool_button_css), @@ -74,9 +75,12 @@ class BrowserToolBarFeatureTest(BaseFeatureTest): self.page.close_query_tool(prompt=False) def test_view_data_tool_button(self): - self.page.expand_tables_node("Servers", self.server['name'], - self.server['db_password'], self.test_db, - "public") + self.assertTrue( + self.page.expand_tables_node("Servers", self.server['name'], + self.server['db_password'], + self.test_db, + "public"), + 'Tree is not expanded to table node') table_node = self.page.check_if_element_exists_with_scroll( TreeAreaLocators.table_node(self.test_table_name)) diff --git a/web/regression/feature_tests/query_tool_journey_test.py b/web/regression/feature_tests/query_tool_journey_test.py index fe3cf0d49..1f5a9d9c3 100644 --- a/web/regression/feature_tests/query_tool_journey_test.py +++ b/web/regression/feature_tests/query_tool_journey_test.py @@ -40,6 +40,7 @@ class QueryToolJourneyTest(BaseFeatureTest): query_history_tab_id = "id-history" query_editor_tab_name = "Query Editor" query_editor_tab_id = "id-query" + query_tool_opened = False def before(self): self.test_table_name = "test_table" + str( @@ -421,10 +422,12 @@ class QueryToolJourneyTest(BaseFeatureTest): self.page.click_modal('Yes') def _navigate_to_query_tool(self): - self.page.expand_database_node("Server", self.server['name'], - self.server['db_password'], - self.test_db) - self.page.open_query_tool() + self.assertTrue( + self.page.expand_database_node("Server", self.server['name'], + self.server['db_password'], + self.test_db), + 'Tree is not expanded to database node') + self.query_tool_opened = self.page.open_query_tool() self.page.wait_for_spinner_to_disappear() def _explain_query(self, query): @@ -498,7 +501,8 @@ class QueryToolJourneyTest(BaseFeatureTest): QueryToolLocators.new_row_xpath) def after(self): - self.page.close_query_tool() + if self.query_tool_opened: + self.page.close_query_tool() test_utils.delete_table( self.server, self.test_db, self.test_table_name) test_utils.delete_table( diff --git a/web/regression/feature_utils/base_feature_test.py b/web/regression/feature_utils/base_feature_test.py index 21e73eba0..21c981ceb 100644 --- a/web/regression/feature_utils/base_feature_test.py +++ b/web/regression/feature_utils/base_feature_test.py @@ -38,7 +38,6 @@ class BaseFeatureTest(BaseTestGenerator): try: if self.parallel_ui_tests: self.page.login_to_app(self.server['login_details']) - print("Login successful", file=sys.stderr) test_utils.reset_layout_db() self.page.driver.switch_to.default_content() self.page.wait_for_app() diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py index 6ece3586e..5b6a28370 100644 --- a/web/regression/python_test_utils/test_utils.py +++ b/web/regression/python_test_utils/test_utils.py @@ -1371,7 +1371,6 @@ def launch_url_in_browser(driver_instance, url, title='pgAdmin 4', timeout=50): driver_instance.get(url) wait = WebDriverWait(driver_instance, 10) wait.until(ec.title_is(title)) - print("pgAdmin launched in browser", file=sys.stderr) break except WebDriverException as e: time.sleep(6) diff --git a/web/regression/runtests.py b/web/regression/runtests.py index 72e7b7fa8..e1c0b26af 100644 --- a/web/regression/runtests.py +++ b/web/regression/runtests.py @@ -599,11 +599,9 @@ def run_parallel_tests(url_client, servers_details, parallel_tests_lists, threads_list = [] # Create thread for each server for ser in servers_details: - print("Running for ser", ser['name'], file=sys.stderr) while True: # If active thread count <= max_thread_count, add new thread if threading.active_count() <= max_thread_count: - print("Created a thread", file=sys.stderr) # Get remote web-driver instance at server level driver_object = \ test_utils.get_remote_webdriver(hub_url, @@ -865,17 +863,12 @@ if __name__ == '__main__': file=sys.stderr) time.sleep(int(pgAdmin_wait_time)) - print('pgAdmin sleep for debug over', - file=sys.stderr) # Running Parallel tests if len(parallel_tests) > 0: parallel_sessions = \ int(selenoid_config[ 'max_parallel_sessions']) - print("Running parallel test", file=sys.stderr) - print("parallel_sessions = ", - parallel_sessions, file=sys.stderr) run_parallel_tests( client_url, servers_info, parallel_tests,