From 6fd63c7f058ffacbd39e0d978e7419f839ed7e96 Mon Sep 17 00:00:00 2001 From: Fattah Date: Thu, 6 Jun 2024 01:07:51 +0200 Subject: [PATCH 1/4] Enable property & query check for 312 --- .../selenium_ui_test/pages/analyzers_page.py | 305 +++++++++--------- 1 file changed, 154 insertions(+), 151 deletions(-) diff --git a/release_tester/selenium_ui_test/pages/analyzers_page.py b/release_tester/selenium_ui_test/pages/analyzers_page.py index 1eccd4f56..4ef58d315 100644 --- a/release_tester/selenium_ui_test/pages/analyzers_page.py +++ b/release_tester/selenium_ui_test/pages/analyzers_page.py @@ -1128,163 +1128,166 @@ def add_new_analyzer(self, name, ui_data_dir=None): self.tprint(f"Creating {name} completed successfully \n") # --------------------here we are checking the properties of the created analyzer---------------------- - if self.version_is_older_than('3.11.99'): - # primariliy enable the test for the version below 3.11.99 - if name == "My_Nearest_Neighbor_Analyzer" or name == "My_Classification_Analyzer": - self.tprint(f"Skipping the properties check for {name} \n") #todo: need to fix this for 3.11.x, location porperties has changed due to the dynamic selenoid depoloyment - else: - try: - self.wait_for_ajax() - self.tprint(f"Checking analyzer properties for {name} \n") - if self.version_is_newer_than('3.10.99'): - # Finding the analyzer to check its properties - if self.version_is_newer_than('3.11.99'): - analyzer_xpath = f"//*[text()='_system::{name}']" - analyzer_sitem = self.locator_finder_by_xpath(analyzer_xpath) - else: - time.sleep(3) - # add search capability for the analyzer to narrow down the search - search_analyzer = "(//input[@id='filterInput'])[1]" - search_analyzer_sitem = self.locator_finder_by_xpath(search_analyzer) - search_analyzer_sitem.click() - search_analyzer_sitem.clear() - search_analyzer_sitem.send_keys(name) - time.sleep(2) - - # then click on the analyzer to view its properties - analyzer_xpath = f"//td[text()='_system::{name}']/following-sibling::td/button[@class='pure-button'][1]" - analyzer_sitem = self.locator_finder_by_xpath(analyzer_xpath) - - if analyzer_sitem is None: - self.tprint(f'This {analyzer_name} has never been created \n') - else: - analyzer_sitem.click() + if name == "My_Nearest_Neighbor_Analyzer" or name == "My_Classification_Analyzer": + self.tprint(f"Skipping the properties check for {name} \n") #todo: need to fix this for 3.11.x, location porperties has changed due to the dynamic selenoid depoloyment + else: + try: + self.wait_for_ajax() + self.tprint(f"Checking analyzer properties for {name} \n") + if self.version_is_newer_than('3.10.99'): + # Finding the analyzer to check its properties + if self.version_is_newer_than('3.11.99'): + analyzer_xpath = f"//*[text()='_system::{name}']" + analyzer_sitem = self.locator_finder_by_xpath(analyzer_xpath) + else: + time.sleep(3) + # add search capability for the analyzer to narrow down the search + search_analyzer = "(//input[@id='filterInput'])[1]" + search_analyzer_sitem = self.locator_finder_by_xpath(search_analyzer) + search_analyzer_sitem.click() + search_analyzer_sitem.clear() + search_analyzer_sitem.send_keys(name) + time.sleep(2) + + # then click on the analyzer to view its properties + analyzer_xpath = f"//td[text()='_system::{name}']/following-sibling::td/button[@class='pure-button'][1]" + analyzer_sitem = self.locator_finder_by_xpath(analyzer_xpath) + + if analyzer_sitem is None: + self.tprint(f'This {analyzer_name} has never been created \n') + else: + analyzer_sitem.click() + time.sleep(3) + + if self.version_is_older_than('3.11.99'): + self.tprint(f"Switching to code view for {name} \n") + switch_to_code = "(//button[normalize-space()='Switch to code view'])[1]" + switch_to_code_sitem = self.locator_finder_by_xpath(switch_to_code) + switch_to_code_sitem.click() + + # Find all elements matching the XPath from the ace editor + if self.version_is_newer_than('3.11.99'): + ace_text_area = "//div[contains(@class, 'ace_text-layer')]//div[contains(@class, 'ace_line_group')]" + ace_line_groups = self.webdriver.find_elements(By.XPATH, ace_text_area) + # Initialize an empty list to store text + text_list = [] + # Iterate over each element and extract its text + for element in ace_line_groups: + text_list.append(element.text.strip()) # Append text from each line group time.sleep(3) - if self.version_is_older_than('3.11.99'): - self.tprint(f"Switching to code view for {name} \n") - switch_to_code = "(//button[normalize-space()='Switch to code view'])[1]" - switch_to_code_sitem = self.locator_finder_by_xpath(switch_to_code) - switch_to_code_sitem.click() - - # Find all elements matching the XPath from the ace editor - if self.version_is_newer_than('3.11.99'): - ace_text_area = "//div[contains(@class, 'ace_text-layer')]//div[contains(@class, 'ace_line_group')]" - ace_line_groups = self.webdriver.find_elements(By.XPATH, ace_text_area) - # Initialize an empty list to store text - text_list = [] - # Iterate over each element and extract its text - for element in ace_line_groups: - text_list.append(element.text.strip()) # Append text from each line group - time.sleep(3) - - # Join the text from all elements into a single string - final_text = ''.join(text_list) # Join the text without splitting - actual_properties = ''.join(str(final_text).split()) - else: - # Find the textarea element using XPath based on its class - # Define the class name of the textarea element - class_name = "sc-EHOje" # Replace with the actual class name - - # Execute JavaScript code to retrieve the text content of the textarea - analyzer_properties = self.webdriver.execute_script(f''' - var className = "{class_name}"; - var textareaElement = document.querySelector("textarea." + className); - return textareaElement.value; - ''') - actual_properties = ''.join(str(analyzer_properties).split()) - - # Get expected properties based on analyzer name - if self.version_is_newer_than("3.11.99"): - expected_properties = ''.join(str(self.generate_expected_properties_312(name, ui_data_dir)).split()) - else: - expected_properties = ''.join(str(self.generate_expected_properties_311(name, ui_data_dir)).split()) - # Assert that the copied text matches the expected text - try: - assert actual_properties == expected_properties, "Text does not match the expected text \n" - self.tprint(f"Actual porperties: {actual_properties} \nexpected properties: {expected_properties} \nfound for {name} \n") - except AssertionError as ex: - self.tprint(f"actual_properties: {actual_properties} \n") - self.tprint(f"expected_properties: {expected_properties} \n") - raise AssertionError( - f"Actual properties didn't matches the expected properties for {name}") from ex - else: - self.tprint(f"Actual properties matches the expected properties for {name}. \n") + # Join the text from all elements into a single string + final_text = ''.join(text_list) # Join the text without splitting + actual_properties = ''.join(str(final_text).split()) + else: + # Find the textarea element using XPath based on its class + # Define the class name of the textarea element + class_name = "sc-EHOje" # Replace with the actual class name + + # Execute JavaScript code to retrieve the text content of the textarea + analyzer_properties = self.webdriver.execute_script(f''' + var className = "{class_name}"; + var textareaElement = document.querySelector("textarea." + className); + return textareaElement.value; + ''') + actual_properties = ''.join(str(analyzer_properties).split()) + + # Get expected properties based on analyzer name + if self.version_is_newer_than("3.11.99"): + expected_properties = ''.join(str(self.generate_expected_properties_312(name, ui_data_dir)).split()) + else: + expected_properties = ''.join(str(self.generate_expected_properties_311(name, ui_data_dir)).split()) + # Assert that the copied text matches the expected text + try: + assert actual_properties == expected_properties, "Text does not match the expected text \n" + self.tprint(f"Actual porperties: {actual_properties} \nexpected properties: {expected_properties} \nfound for {name} \n") + except AssertionError as ex: + self.tprint(f"actual_properties: {actual_properties} \n") + self.tprint(f"expected_properties: {expected_properties} \n") + raise AssertionError( + f"Actual properties didn't matches the expected properties for {name}") from ex + else: + self.tprint(f"Actual properties matches the expected properties for {name}. \n") + + except TimeoutException as ex: + self.tprint(f'Failed to parse properties from the {name} and the error is: {ex} \n') + + # -------------------- Running a query for each analyzer's after creation---------------------- + try: + self.tprint(f"Checking analyzer query for {name} \n") + self.tprint(f'Running query for {name} started \n') + # Goto query tab + self.tprint("Selecting query tab \n") + if self.version_is_newer_than('3.11.99'): + self.locator_finder_by_id('queries').click() + else: + self.webdriver.refresh() + self.locator_finder_by_id('queries').click() + time.sleep(3) + self.tprint('Selecting query execution area \n') + self.select_query_execution_area() + + self.tprint(f'Running query for {name} analyzer started\n') + # Get query and expected output based on analyzer name + if self.version_is_newer_than('3.11.99'): + analyzer_query = self.get_analyzer_query_312(name) + else: + analyzer_query = self.get_analyzer_query_311(name) - except TimeoutException as ex: - self.tprint(f'Failed to parse properties from the {name} and the error is: {ex} \n') - - # -------------------- Running a query for each analyzer's after creation---------------------- - try: - self.tprint(f"Checking analyzer query for {name} \n") - if self.version_is_older_than('3.11.99'): - self.tprint(f'Running query for {name} started \n') - # Goto query tab - self.tprint("Selecting query tab \n") - if self.version_is_newer_than('3.11.99'): - self.locator_finder_by_id('queries').click() - else: - self.webdriver.refresh() - self.locator_finder_by_id('queries').click() - time.sleep(3) - self.tprint('Selecting query execution area \n') - self.select_query_execution_area() + if analyzer_query is None: + self.tprint(f"Analyzer '{name}' not found. Skipping test.") + pass # Skip this test and move to the next one + else: + if self.version_is_newer_than('3.11.99'): + self.send_key_action(analyzer_query) + else: + self.clear_textfield() + self.send_key_action(analyzer_query) - self.tprint(f'Running query for {name} analyzer started\n') - # Get query and expected output based on analyzer name - if self.version_is_newer_than('3.11.99'): - analyzer_query = self.get_analyzer_query_312(name) - else: - analyzer_query = self.get_analyzer_query_311(name) + self.query_execution_btn() + self.scroll(1) + + # Initialize query_actual_output with a default value + query_actual_output = None - if analyzer_query is None: - self.tprint(f"Analyzer '{name}' not found. Skipping test.") - pass # Skip this test and move to the next one + # Find all elements matching the XPath from the ace editor + if self.version_is_older_than('3.11.99'): + ace_text_area = '//div[@id="outputEditor0"]//div[contains(@class, "ace_layer ace_text-layer")]' + else: + ace_text_area = '(//div[@class="ace_layer ace_text-layer"])[2]/div[@class="ace_line_group"]/div[@class="ace_line"]' + + ace_line_groups = self.webdriver.find_elements(By.XPATH, ace_text_area) + # Initialize an empty list to store text + text_list = [] + # Iterate over each element and extract its text + for element in ace_line_groups: + text_list.append(element.text.strip()) # Append text from each line group + time.sleep(1) + + # Join the text from all elements into a single string + final_text = ''.join(text_list) # Join the text without splitting + query_actual_output = ''.join(str(final_text).split()) + self.tprint(f"query_actual_output: {query_actual_output} \n") + + if self.version_is_newer_than('3.11.99'): + query_expected_output = self.get_analyzer_expected_output_312(name) + else: + query_expected_output = self.get_analyzer_expected_output_311(name) + + if query_expected_output is None: + self.tprint(f"Analyzer '{name}' not found. Skipping test.") + pass # Skip this test and move to the next one + else: + # Assert that the copied text matches the expected text + if query_actual_output != ''.join(str(query_expected_output).split()): + self.tprint(f"query_actual_output: {query_actual_output} \n") + self.tprint(f"query_expected_output: {query_expected_output} \n") + raise Exception( + f"Actual query output didn't matches the expected query output for {name}\n") else: - if self.version_is_newer_than('3.11.99'): - self.send_key_action(analyzer_query) - else: - self.clear_textfield() - self.send_key_action(analyzer_query) - - self.query_execution_btn() - self.scroll(1) - - # Find all elements matching the XPath from the ace editor - if self.version_is_older_than('3.11.99'): - ace_text_area = '//div[@id="outputEditor0"]//div[contains(@class, "ace_layer ace_text-layer")]' - ace_line_groups = self.webdriver.find_elements(By.XPATH, ace_text_area) - # Initialize an empty list to store text - text_list = [] - # Iterate over each element and extract its text - for element in ace_line_groups: - text_list.append(element.text.strip()) # Append text from each line group - time.sleep(1) - - # Join the text from all elements into a single string - final_text = ''.join(text_list) # Join the text without splitting - query_actual_output = ''.join(str(final_text).split()) - self.tprint(f"query_actual_output: {query_actual_output} \n") - - if self.version_is_newer_than('3.11.99'): - query_expected_output = self.get_analyzer_expected_output_312(name) - else: - query_expected_output = self.get_analyzer_expected_output_311(name) - - if query_expected_output is None: - self.tprint(f"Analyzer '{name}' not found. Skipping test.") - pass # Skip this test and move to the next one - else: - # Assert that the copied text matches the expected text - if query_actual_output != ''.join(str(query_expected_output).split()): - self.tprint(f"query_actual_output: {query_actual_output} \n") - self.tprint(f"query_expected_output: {query_expected_output} \n") - raise Exception( - f"Actual query output didn't matches the expected query output for {name}\n") - else: - self.tprint(f"Actual query output matches the expected query output for {name}\n") - except TimeoutException as ex: - raise Exception(f"TimeoutException occurred during running the query for '{name}' analyzer.\nError: {ex}") + self.tprint(f"Actual query output matches the expected query output for {name}\n") + except TimeoutException as ex: + raise Exception(f"TimeoutException occurred during running the query for '{name}' analyzer.\nError: {ex}") @staticmethod def generate_analyzer_queries_312(analyzer_name): From e896c44bb8c5b3de237428bc17bfe83b5cfe3cc8 Mon Sep 17 00:00:00 2001 From: Fattah Date: Thu, 6 Jun 2024 12:42:30 +0200 Subject: [PATCH 2/4] adding zoom out to the propery check --- .../selenium_ui_test/pages/analyzers_page.py | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/release_tester/selenium_ui_test/pages/analyzers_page.py b/release_tester/selenium_ui_test/pages/analyzers_page.py index 4ef58d315..d2ace91da 100644 --- a/release_tester/selenium_ui_test/pages/analyzers_page.py +++ b/release_tester/selenium_ui_test/pages/analyzers_page.py @@ -1159,6 +1159,11 @@ def add_new_analyzer(self, name, ui_data_dir=None): analyzer_sitem.click() time.sleep(3) + self.tprint("I am here at 1162\n") + self.tprint("zooming out with javascript\n") + self.webdriver.execute_script("document.body.style.zoom='80%'") + time.sleep(3) + self.webdriver.refresh() if self.version_is_older_than('3.11.99'): self.tprint(f"Switching to code view for {name} \n") switch_to_code = "(//button[normalize-space()='Switch to code view'])[1]" @@ -1208,7 +1213,7 @@ def add_new_analyzer(self, name, ui_data_dir=None): f"Actual properties didn't matches the expected properties for {name}") from ex else: self.tprint(f"Actual properties matches the expected properties for {name}. \n") - + self.tprint("Back to normal screen zoom level\n") except TimeoutException as ex: self.tprint(f'Failed to parse properties from the {name} and the error is: {ex} \n') @@ -1219,10 +1224,10 @@ def add_new_analyzer(self, name, ui_data_dir=None): # Goto query tab self.tprint("Selecting query tab \n") if self.version_is_newer_than('3.11.99'): - self.locator_finder_by_id('queries').click() + self.navbar_goto('queries') else: self.webdriver.refresh() - self.locator_finder_by_id('queries').click() + self.navbar_goto('queries') time.sleep(3) self.tprint('Selecting query execution area \n') self.select_query_execution_area() @@ -1286,6 +1291,8 @@ def add_new_analyzer(self, name, ui_data_dir=None): f"Actual query output didn't matches the expected query output for {name}\n") else: self.tprint(f"Actual query output matches the expected query output for {name}\n") + # back to normal zoom level + self.webdriver.execute_script("document.body.style.zoom='100%'") except TimeoutException as ex: raise Exception(f"TimeoutException occurred during running the query for '{name}' analyzer.\nError: {ex}") @@ -2107,25 +2114,25 @@ def generate_expected_properties_312(analyzer_name, ui_data_dir=None): def creating_all_supported_analyzer(self, enterprise, model_location=None): """This method will create all the supported version-specific analyzers""" decode_analyzers = { - "My_Identity_Analyzer": (0, None, False), - "My_Delimiter_Analyzer": (0, None, False), - "My_Stem_Analyzer": (0, None, False), - "My_Norm_Analyzer": (0, None, False), - "My_N-Gram_Analyzer": (0, None, False), + # "My_Identity_Analyzer": (0, None, False), + # "My_Delimiter_Analyzer": (0, None, False), + # "My_Stem_Analyzer": (0, None, False), + # "My_Norm_Analyzer": (0, None, False), + # "My_N-Gram_Analyzer": (0, None, False), "My_Text_Analyzer": (0, None, False), - "My_AQL_Analyzer": (0, None, False), - "My_Stopwords_Analyzer": (0, None, False), - "My_Collation_Analyzer": (0, None, False), - "My_Segmentation_Alpha_Analyzer": (0, None, False), - "My_Pipeline_Analyzer": (0, semver.VersionInfo.parse('3.10.0'), False), - "My_GeoJSON_Analyzer": (0, semver.VersionInfo.parse('3.10.0'), False), - "My_GeoPoint_Analyzer": (0, semver.VersionInfo.parse('3.10.0'), False), - "My_MultiDelimiter_Analyzer": (0, semver.VersionInfo.parse('3.11.99'), False), - "My_WildCard_Analyzer": (0, semver.VersionInfo.parse('3.11.99'), False), - "My_Minhash_Analyzer": (0, semver.VersionInfo.parse('3.11.99'), not (enterprise and self.version_is_newer_than('3.11.99'))), - "My_Nearest_Neighbor_Analyzer": (1 if enterprise else 0, semver.VersionInfo.parse('3.10.0'), not enterprise), - "My_Classification_Analyzer": (1 if enterprise else 0, semver.VersionInfo.parse('3.10.0'), not enterprise), - "My_GeoS2_Analyzer": (0, None, not enterprise) + # "My_AQL_Analyzer": (0, None, False), + # "My_Stopwords_Analyzer": (0, None, False), + # "My_Collation_Analyzer": (0, None, False), + # "My_Segmentation_Alpha_Analyzer": (0, None, False), + # "My_Pipeline_Analyzer": (0, semver.VersionInfo.parse('3.10.0'), False), + # "My_GeoJSON_Analyzer": (0, semver.VersionInfo.parse('3.10.0'), False), + # "My_GeoPoint_Analyzer": (0, semver.VersionInfo.parse('3.10.0'), False), + # "My_MultiDelimiter_Analyzer": (0, semver.VersionInfo.parse('3.11.99'), False), + # "My_WildCard_Analyzer": (0, semver.VersionInfo.parse('3.11.99'), False), + # "My_Minhash_Analyzer": (0, semver.VersionInfo.parse('3.11.99'), not (enterprise and self.version_is_newer_than('3.11.99'))), + # "My_Nearest_Neighbor_Analyzer": (1 if enterprise else 0, semver.VersionInfo.parse('3.10.0'), not enterprise), + # "My_Classification_Analyzer": (1 if enterprise else 0, semver.VersionInfo.parse('3.10.0'), not enterprise), + # "My_GeoS2_Analyzer": (0, None, not enterprise) } # Loop through each analyzer in the dictionary From a88fd2501c252ace438ab243e7eb4ded0c59cefb Mon Sep 17 00:00:00 2001 From: Fattah Date: Thu, 6 Jun 2024 12:43:43 +0200 Subject: [PATCH 3/4] Update analyzers_page.py --- .../selenium_ui_test/pages/analyzers_page.py | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/release_tester/selenium_ui_test/pages/analyzers_page.py b/release_tester/selenium_ui_test/pages/analyzers_page.py index d2ace91da..f16028752 100644 --- a/release_tester/selenium_ui_test/pages/analyzers_page.py +++ b/release_tester/selenium_ui_test/pages/analyzers_page.py @@ -2114,25 +2114,25 @@ def generate_expected_properties_312(analyzer_name, ui_data_dir=None): def creating_all_supported_analyzer(self, enterprise, model_location=None): """This method will create all the supported version-specific analyzers""" decode_analyzers = { - # "My_Identity_Analyzer": (0, None, False), - # "My_Delimiter_Analyzer": (0, None, False), - # "My_Stem_Analyzer": (0, None, False), - # "My_Norm_Analyzer": (0, None, False), - # "My_N-Gram_Analyzer": (0, None, False), + "My_Identity_Analyzer": (0, None, False), + "My_Delimiter_Analyzer": (0, None, False), + "My_Stem_Analyzer": (0, None, False), + "My_Norm_Analyzer": (0, None, False), + "My_N-Gram_Analyzer": (0, None, False), "My_Text_Analyzer": (0, None, False), - # "My_AQL_Analyzer": (0, None, False), - # "My_Stopwords_Analyzer": (0, None, False), - # "My_Collation_Analyzer": (0, None, False), - # "My_Segmentation_Alpha_Analyzer": (0, None, False), - # "My_Pipeline_Analyzer": (0, semver.VersionInfo.parse('3.10.0'), False), - # "My_GeoJSON_Analyzer": (0, semver.VersionInfo.parse('3.10.0'), False), - # "My_GeoPoint_Analyzer": (0, semver.VersionInfo.parse('3.10.0'), False), - # "My_MultiDelimiter_Analyzer": (0, semver.VersionInfo.parse('3.11.99'), False), - # "My_WildCard_Analyzer": (0, semver.VersionInfo.parse('3.11.99'), False), - # "My_Minhash_Analyzer": (0, semver.VersionInfo.parse('3.11.99'), not (enterprise and self.version_is_newer_than('3.11.99'))), - # "My_Nearest_Neighbor_Analyzer": (1 if enterprise else 0, semver.VersionInfo.parse('3.10.0'), not enterprise), - # "My_Classification_Analyzer": (1 if enterprise else 0, semver.VersionInfo.parse('3.10.0'), not enterprise), - # "My_GeoS2_Analyzer": (0, None, not enterprise) + "My_AQL_Analyzer": (0, None, False), + "My_Stopwords_Analyzer": (0, None, False), + "My_Collation_Analyzer": (0, None, False), + "My_Segmentation_Alpha_Analyzer": (0, None, False), + "My_Pipeline_Analyzer": (0, semver.VersionInfo.parse('3.10.0'), False), + "My_GeoJSON_Analyzer": (0, semver.VersionInfo.parse('3.10.0'), False), + "My_GeoPoint_Analyzer": (0, semver.VersionInfo.parse('3.10.0'), False), + "My_MultiDelimiter_Analyzer": (0, semver.VersionInfo.parse('3.11.99'), False), + "My_WildCard_Analyzer": (0, semver.VersionInfo.parse('3.11.99'), False), + "My_Minhash_Analyzer": (0, semver.VersionInfo.parse('3.11.99'), not (enterprise and self.version_is_newer_than('3.11.99'))), + "My_Nearest_Neighbor_Analyzer": (1 if enterprise else 0, semver.VersionInfo.parse('3.10.0'), not enterprise), + "My_Classification_Analyzer": (1 if enterprise else 0, semver.VersionInfo.parse('3.10.0'), not enterprise), + "My_GeoS2_Analyzer": (0, None, not enterprise) } # Loop through each analyzer in the dictionary From 597cf88a7aace80924477962bee934b638a4b727 Mon Sep 17 00:00:00 2001 From: Fattah Date: Thu, 6 Jun 2024 13:45:40 +0200 Subject: [PATCH 4/4] checking analyzer query output --- .../selenium_ui_test/pages/analyzers_page.py | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/release_tester/selenium_ui_test/pages/analyzers_page.py b/release_tester/selenium_ui_test/pages/analyzers_page.py index f16028752..e315c3ff9 100644 --- a/release_tester/selenium_ui_test/pages/analyzers_page.py +++ b/release_tester/selenium_ui_test/pages/analyzers_page.py @@ -1134,7 +1134,8 @@ def add_new_analyzer(self, name, ui_data_dir=None): try: self.wait_for_ajax() self.tprint(f"Checking analyzer properties for {name} \n") - if self.version_is_newer_than('3.10.99'): + # running for 311 only for now + if self.version_is_older_than('3.11.99'): # Finding the analyzer to check its properties if self.version_is_newer_than('3.11.99'): analyzer_xpath = f"//*[text()='_system::{name}']" @@ -1159,11 +1160,6 @@ def add_new_analyzer(self, name, ui_data_dir=None): analyzer_sitem.click() time.sleep(3) - self.tprint("I am here at 1162\n") - self.tprint("zooming out with javascript\n") - self.webdriver.execute_script("document.body.style.zoom='80%'") - time.sleep(3) - self.webdriver.refresh() if self.version_is_older_than('3.11.99'): self.tprint(f"Switching to code view for {name} \n") switch_to_code = "(//button[normalize-space()='Switch to code view'])[1]" @@ -1219,6 +1215,11 @@ def add_new_analyzer(self, name, ui_data_dir=None): # -------------------- Running a query for each analyzer's after creation---------------------- try: + if self.version_is_newer_than('3.11.99'): + query_expected_output = self.get_analyzer_expected_output_312(name) + else: + query_expected_output = self.get_analyzer_expected_output_311(name) + self.tprint(f"Checking analyzer query for {name} \n") self.tprint(f'Running query for {name} started \n') # Goto query tab @@ -1274,11 +1275,6 @@ def add_new_analyzer(self, name, ui_data_dir=None): query_actual_output = ''.join(str(final_text).split()) self.tprint(f"query_actual_output: {query_actual_output} \n") - if self.version_is_newer_than('3.11.99'): - query_expected_output = self.get_analyzer_expected_output_312(name) - else: - query_expected_output = self.get_analyzer_expected_output_311(name) - if query_expected_output is None: self.tprint(f"Analyzer '{name}' not found. Skipping test.") pass # Skip this test and move to the next one @@ -1291,8 +1287,6 @@ def add_new_analyzer(self, name, ui_data_dir=None): f"Actual query output didn't matches the expected query output for {name}\n") else: self.tprint(f"Actual query output matches the expected query output for {name}\n") - # back to normal zoom level - self.webdriver.execute_script("document.body.style.zoom='100%'") except TimeoutException as ex: raise Exception(f"TimeoutException occurred during running the query for '{name}' analyzer.\nError: {ex}")