def added_objs(self): """Returns objects added to the task group.""" objs = [] for obj_row in self._root.element(class_name="tree-structure").lis(): obj_id = int(obj_row.data_object_id) obj_name = obj_row.data_object_type obj_title = obj_row.text factory = entity_factory_common.get_factory_by_obj_name(obj_name)() objs.append(factory.create_empty(obj_id=obj_id, title=obj_title)) return objs
def mapped_objs(self): """Returns objects mapped to the cycle task.""" # HACK: it's not possible to determine by looking at DOM whether # the list of mapped objects was fully loaded or not. time.sleep(1) objs = [] row_els = self._browser.element(text="Mapped objects").next_sibling().lis() for obj_row in row_els: obj_id = int(obj_row.data_id) entity_obj_name = obj_row.data_object_type obj_title = obj_row.text factory = entity_factory_common.get_factory_by_obj_name( entity_obj_name)() objs.append(factory.create_empty(obj_id=obj_id, title=obj_title)) return objs
def mapped_objs(self): """Returns objects mapped to the cycle task.""" # HACK: it's not possible to determine by looking at DOM whether # the list of mapped objects was fully loaded or not. time.sleep(1) objs = [] row_els = self._browser.element(text="Mapped objects").next_sibling().lis() for obj_row in row_els: # link to the obj is for example 'http://localhost:8080/controls/1' # last number is obj id obj_id = int(obj_row.link().href.split("/")[-1]) entity_obj_name = objects.get_singular( obj_row.link().href.split("/")[-2]) obj_title = obj_row.text factory = entity_factory_common.get_factory_by_obj_name( entity_obj_name)() objs.append(factory.create_empty(obj_id=obj_id, title=obj_title)) return objs
def mapped_objs(self): """Returns objects mapped to the cycle task.""" # HACK: it's not possible to determine by looking at DOM whether # the list of mapped objects was fully loaded or not. time.sleep(1) objs = [] row_els = self._browser.element(text="Mapped objects").next_sibling().lis() for obj_row in row_els: # link to the obj is for example 'http://localhost:8080/controls/1' # last number is obj id obj_id = int(obj_row.link().href.split("/")[-1]) entity_obj_name = objects.get_singular( obj_row.link().href.split("/")[-2]) obj_title = obj_row.text factory = entity_factory_common.get_factory_by_obj_name( entity_obj_name)() objs.append(factory.create_empty(obj_id=obj_id, title=obj_title)) return objs
def added_objs(self): """Returns objects added to the task group.""" prefix = "fa-" objs = [] selenium_utils.wait_for_js_to_load(self._driver) obj_rows = (self._root.element(class_name="tree-structure").lis( class_name="task-group-objects__list-item")) for obj_row in obj_rows: # define object type by icon class icon = obj_row.element(tag_name="i").wait_until(lambda e: e.present) obj_name = [ item.replace(prefix, "") for item in icon.classes if item.startswith(prefix) and item != prefix + "fw"][0] obj_title = obj_row.text factory = entity_factory_common.get_factory_by_obj_name(obj_name)() objs.append(factory.create_empty(title=obj_title)) return objs
def added_objs(self): """Returns objects added to the task group.""" prefix = "fa-" objs = [] selenium_utils.wait_for_js_to_load(self._driver) obj_rows = (self._root.element(class_name="tree-structure").lis( class_name="task-group-objects__list-item")) for obj_row in obj_rows: # define object type by icon class icon = obj_row.element( tag_name="i").wait_until(lambda e: e.present) obj_name = [ item.replace(prefix, "") for item in icon.classes if item.startswith(prefix) and item != prefix + "fw" ][0] obj_title = obj_row.text factory = entity_factory_common.get_factory_by_obj_name(obj_name)() objs.append(factory.create_empty(title=obj_title)) return objs