Exemple #1
0
 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 expand_database_node(self, server_name, server_password,
                          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))
         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])
             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):
                     try:
                         self.click_modal('OK')
                     except Exception:
                         pass
                     retry -= 1
                 else:
                     break
             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