def test_add_global_ca(self, admin_dashboard, ca_type, def_type): """Create different types of Custom Attribute on Admin Dashboard.""" expected_ca = entities_factory.CustomAttributeDefinitionsFactory( ).create(attribute_type=ca_type, definition_type=def_type) ca_tab = admin_dashboard.select_custom_attributes() ca_tab.add_custom_attribute(ca_obj=expected_ca) list_actual_ca = ca_tab.get_custom_attributes_list( ca_group=expected_ca) self.general_contain_assert(expected_ca, list_actual_ca)
def get_custom_attribute(self, obj_type, ca_title): """Collect Custom Attribute data from Edit Modal. Returns: CA entity. """ data = self.ca_widget.open_edit_modal( obj_type, ca_title).get_custom_attribute_dict() return entities_factory.CustomAttributeDefinitionsFactory().create( **data)
def test_add_global_ca(self, admin_dashboard, ca_type): """Create different types of Custom Attribute on Admin Dashboard.""" def_type = objects.get_normal_form(random.choice(objects.ALL_CA_OBJS)) expected_ca = entities_factory.CustomAttributeDefinitionsFactory().create( attribute_type=ca_type, definition_type=def_type) ca_tab = admin_dashboard.select_custom_attributes() ca_tab.add_custom_attribute(ca_obj=expected_ca) actual_cas = ca_tab.get_custom_attributes_list(ca_group=expected_ca) # 'actual_ca': multi_choice_options (None) self.general_contain_assert(expected_ca, actual_cas, "multi_choice_options")
def test_add_global_ca(self, selenium, ca_type): """Create different types of Custom Attribute on Admin Dashboard.""" def_type = objects.get_normal_form(random.choice(objects.EDITABLE_CA_OBJS)) expected_ca = entities_factory.CustomAttributeDefinitionsFactory().create( attribute_type=ca_type, definition_type=def_type) ca_admin_service = admin_webui_service.CustomAttributeWebUiService( selenium) ca_admin_service.create_custom_attribute(new_ca=expected_ca) actual_cas = ca_admin_service.ca_widget.get_custom_attributes_list( obj_type=expected_ca.definition_type) self.general_contain_assert(expected_ca, actual_cas, "multi_choice_options")
def _set_custom_attributes_list(self): """Set custom attributes list with Custom Attribute objects from current opened content item. """ for row in selenium_utils.get_when_all_visible(self._driver, self._locators.ROW_CSS): attrs = [i.text for i in row.find_elements( *self._locators.CELL_IN_ROW_CSS)] # todo: add PO and getting 'multi_choice_options' via 'Edit' btn self.custom_attributes_list.append( entities_factory.CustomAttributeDefinitionsFactory().create( title=attrs[0], attribute_type=attrs[1], mandatory=StringMethods.get_bool_value_from_arg(attrs[2]), definition_type=self._item_name, multi_choice_options=None))
def edit_gca(selenium, old_ca_type, new_ca_type): """Create Global Custom attribute via rest api and edit it via web ui. Returns: dict with actual edited CA and expected CA. """ new_ca = rest_facade.create_gcad(definition_type=objects.get_singular( random.choice(objects.EDITABLE_CA_OBJS)), attribute_type=old_ca_type, mandatory=True) expected_ca = entities_factory.CustomAttributeDefinitionsFactory().create( attribute_type=new_ca_type, definition_type=new_ca.definition_type, helptext=element.Common.TITLE_EDITED_PART, mandatory=False) if new_ca_type in (element.AdminWidgetCustomAttributes.TEXT, element.AdminWidgetCustomAttributes.RICH_TEXT): expected_ca.update_attrs(placeholder=element.Common.TITLE_EDITED_PART) actual_ca = admin_webui_service.CustomAttributeWebUiService( selenium).edit_custom_attribute(new_ca, expected_ca) return {"actual_ca": actual_ca, "expected_ca": expected_ca}