def __init__(self, driver, obj_name): super(CommonUnifiedMapperModal, self).__init__(driver) # labels self.modal_elem = selenium_utils.get_when_visible( self._driver, self._locators.MODAL_CSS) self.filter_toggle = base.Toggle(self.modal_elem, self._locators.FILTER_TOGGLE_CSS) self.filter_toggle.is_activated = True self.title_modal = base.Label(self.modal_elem, self._locators.MODAL_TITLE) if obj_name != objects.ASSESSMENT_TEMPLATES: self.obj_type = base.Label(self.modal_elem, self._locators.OBJ_TYPE) # user input elements self.tree_view = base.UnifiedMapperTreeView(self._driver, obj_name=obj_name) self._add_attr_btn = None self.search_result_toggle = base.Toggle( self.modal_elem, self._locators.RESULT_TOGGLE_CSS) self.open_in_new_frontend_btn = self._browser.link( class_name=["btn", "btn-small", "btn-white"], text="Open in new frontend") self._create_and_map_obj_btn = self._browser.element( class_name="modal-header").button(text="Create and map new object") self._obj_type_select = self._browser.element(name="type-select")
def __init__(self, driver): super(ProgramsModal, self).__init__(driver) # user input elements self.ui_description = base.Iframe( self._driver, self._locators.UI_DESCRIPTION) self.ui_notes = base.Iframe(self._driver, self._locators.UI_NOTES) self.ui_code = base.TextInputField(self._driver, self._locators.UI_CODE) self.ui_state = base.Dropdown(self._driver, self._locators.UI_STATE) self.ui_show_optional_fields = base.Toggle( self._driver, self._locators.BUTTON_SHOW_ALL_OPTIONAL_FIELDS) self.ui_primary_contact = base.TextFilterDropdown( self._driver, self._locators.UI_PRIMARY_CONTACT, self._locators.DROPDOWN_CONTACT) self.ui_secondary_contact = base.TextFilterDropdown( self._driver, self._locators.UI_SECONDARY_CONTACT, self._locators.DROPDOWN_CONTACT) self.ui_program_url = base.TextInputField( self._driver, self._locators.UI_PROGRAM_URL) self.ui_reference_url = base.TextInputField( self._driver, self._locators.UI_REFERENCE_URL) self.ui_effective_date = base.DatePicker( self._driver, self._locators.EFFECTIVE_DATE_DATEPICKER, self._locators.UI_EFFECTIVE_DATE) self.ui_stop_date = base.DatePicker( self._driver, self._locators.STOP_DATE_DATEPICKER, self._locators.UI_STOP_DATE) # static elements self.title = base.Label(self._driver, self._locators.TITLE) self.description = base.Label(self._driver, self._locators.DESCRIPTION) self.program_url = base.Label(self._driver, self._locators.PROGRAM_URL)
def __init__(self, driver): super(DeleteObjectModal, self).__init__(driver) self.title_modal = base.Label(driver, self._locator.MODAL_TITLE) self.confirmation_text = base.Label(driver, self._locator.CONFIRMATION_TEXT) self.title_object = base.Label(driver, self._locator.OBJECT_TITLE) self.button_delete = base.Button(driver, self._locator.BUTTON_DELETE)
def __init__(self, driver,): super(Controls, self).__init__(driver) self.label_title = base.Label(driver, locator.ObjectWidget.HEADER_TITLE) self.label_owner = base.Label(driver, locator.ObjectWidget.HEADER_OWNER) self.label_state = base.Label(driver, locator.ObjectWidget.HEADER_STATE) self.label_last_asmt_date = base.Label( driver, locator.ObjectWidget.HEADER_LAST_ASSESSMENT_DATE)
def __init__(self): super(CompareUpdateObjectModal, self).__init__() self.title_modal = base.Label(self._driver, self._locators.MODAL_TITLE) self.confirmation_text = base.Label(self._driver, self._locators.CONFIRMATION_TEXT) self.button_update = base.Button(self._driver, self._locators.BUTTON_CONFIRM)
def __init__(self, driver): super(Programs, self).__init__(driver) # todo: redesign 'Programs' cls init and related methods and tests self.show_advanced = base.Toggle(self.tab_container.active_tab_elem, self._locators.TOGGLE_SHOW_ADVANCED) self.show_advanced.toggle() self.object_review = base.Label(self.info_widget_elem, self._locators.TXT_OBJECT_REVIEW) self.submit_for_review = base.Label( self.info_widget_elem, self._locators.LINK_SUBMIT_FOR_REVIEW) self.description = base.Label(self.tab_container.active_tab_elem, self._locators.DESCRIPTION) self.description_entered = base.Label( self.tab_container.active_tab_elem, self._locators.DESCRIPTION_ENTERED) self.notes = (base.Label(self.tab_container.active_tab_elem, self._locators.NOTES)) self.notes_entered = base.Label(self.info_widget_elem, self._locators.NOTES_ENTERED) self.manager, self.manager_entered = ( self.get_header_and_value_txt_from_people_scopes( self._elements.PROGRAM_MANAGERS.upper())) self.ref_url = base.MultiInputField(self.tab_container.active_tab_elem, self._locators.REF_URL_CSS) self.code = base.Label(self.tab_container.active_tab_elem, self._locators.CODE) self.code_entered = base.Label(self.tab_container.active_tab_elem, self._locators.CODE_ENTERED) self.effective_date = base.Label(self.tab_container.active_tab_elem, self._locators.EFFECTIVE_DATE) self.effective_date_entered = base.Label( self.tab_container.active_tab_elem, self._locators.EFFECTIVE_DATE_ENTERED)
def __init__(self, driver): # wait that the elements load before calling super self.button_settings = base.Button( driver, locator.BaseInfoWidget.BUTTON_SETTINGS) self.title = base.Label(driver, self._locator.TITLE) self.title_entered = base.Label(driver, self._locator.TITLE_ENTERED) super(Widget, self).__init__(driver) self.object_id = self.url.split("/")[-1]
def __init__(self, driver): # wait that the elements load before calling super self.button_settings = None self.title = base.Label(driver, self._locator.TITLE) self.title_entered = base.Label(driver, self._locator.TITLE_ENTERED) self.link_get_latest_ver = None super(Widget, self).__init__(driver) self.object_id = self.url.split("/")[-1]
def __init__(self, driver): # wait that the elements load before calling super self.title = base.Label(driver, self._locators.TITLE) self.title_entered = base.Label(driver, self._locators.TITLE_ENTERED) self.state = base.Label(driver, self._locators.STATE) super(CommonInfo, self).__init__(driver) self.locator_3bbs = (self._locators.BUTTON_3BBS_UNDER_AUDIT if self.is_under_audit else self._locators.BUTTON_3BBS)
def __init__(self, driver): super(Dropdown, self).__init__(driver) self.button_add = base.Button(driver, self._locator_button_add) self.attribute_name = base.Label( driver, self._locator_label_attribute_name) self.attribute_type = base.Label( driver, self._locator_label_attribute_type) self.mandatory = base.Label(driver, self._locator_label_mandatory) self.edit = base.Label(driver, self._locator_label_edit)
def __init__( self, driver, ): super(Controls, self).__init__(driver) self.label_title = base.Label( driver, locator.ObjectWidget.CONTROL_COLUMN_TITLE) self.label_owner = base.Label(driver, locator.ObjectWidget.CONTROL_OWNER) self.label_state = base.Label(driver, locator.ObjectWidget.COTNROL_STATE)
def __init__(self, driver, obj_name): super(CommonUnifiedMapperModal, self).__init__(driver) # labels self.filter_toggle = base.Toggle(driver, self._locators.FILTER_TOGGLE_CSS) self.filter_toggle.is_activated = True self.title_modal = base.Label(driver, self._locators.MODAL_TITLE) self.obj_type = base.Label(driver, self._locators.OBJ_TYPE) # user input elements self.tree_view = base.UnifiedMapperTreeView(driver, obj_name=obj_name) self._add_attr_btn = None self.search_result_toggle = base.Toggle( driver, self._locators.RESULT_TOGGLE_CSS)
def __init__(self, driver): super(CommonUnifiedMapperModal, self).__init__(driver) # labels self.title_modal = base.Label(driver, self._locators.MODAL_TITLE) self.obj_type = base.Label(driver, self._locators.OBJ_TYPE) self.filter_by_expression = base.Label( driver, self._locators.FILTER_BY_EXPRESSION) # user input elements self.filter_via_expression_text_box = base.TextInputField( driver, self._locators.FILTER_VIA_EXPRESSION_TEXT_BOX) self.filter_by_state_text_box = base.DropdownStatic( driver, self._locators.FILTER_BY_STATE_DROPDOWN, self._locators.FILTER_BY_STATE_DROPDOWN_OPTIONS)
def __init__(self, driver): super(BaseModal, self).__init__(driver) self.modal_elem = selenium_utils.get_when_visible( self._driver, self._locators.MODAL_CSS) self.ui_title = base.TextInputField(self.modal_elem, self._locator_ui_title) self.modal_type_lbl = base.Label( self.modal_elem, locator.ModalCommonConfirmAction.MODAL_TITLE) self.button_save_and_close = base.Button(self.modal_elem, self._locator_button_save) self.is_create_modal = "New " in self.modal_type_lbl.text self.code = (base.TextInputField(self.modal_elem, self._locator_code) if self.is_create_modal else base.Label( self.modal_elem, self._locator_code))
def __init__(self, driver): super(UserList, self).__init__(driver) self.button_logout = base.Button(self._driver, self.locators.BUTTON_LOGOUT) self.notifications = base.Label(self._driver, self.locators.NOTIFICATIONS) self.checkbox_daily_digest = base.Checkbox( self._driver, self.locators.CHECKBOX_DAILY_DIGEST) self.button_admin_dashboard = base.Button( self._driver, self.locators.BUTTON_ADMIN_DASHBOARD) self.button_help = base.Button(self._driver, self.locators.BUTTON_HELP) self.button_data_export = base.Button(self._driver, self.locators.BUTTON_DATA_EXPORT) self.email = base.Label(self._driver, self.locators.EMAIL)
def __init__( self, driver, ): super(Controls, self).__init__(driver) self.label_title = base.Label(driver, locator.ObjectWidget.HEADER_TITLE) self.label_owner = base.Label(driver, locator.ObjectWidget.HEADER_OWNER) self.label_state = base.Label(driver, locator.ObjectWidget.HEADER_STATE) self.label_last_asmt_date = base.Label( driver, locator.ObjectWidget.HEADER_LAST_ASSESSMENT_DATE) self.tree_view = TreeView(driver, widget_name=self._locator_filter.widget_name)
def __init__(self, driver): super(CustomAttributeModal, self).__init__(driver) self.attribute_title = base.Label( self._driver, self._locator.ATTRIBUTE_TITLE) self.inline_help = base.Label(self._driver, self._locator.INLINE_HELP) self.attribute_type = base.Label( self._driver, self._locator.ATTRIBUTE_TYPE) self.placeholder = base.Label(self._driver, self._locator.PLACEHOLDER) self.mandatory = base.Label(self._driver, self._locator.MANDATORY) self.ui_inline_help = base.TextInputField( self._driver, self._locator.UI_INLINE_HELP) self.ui_placeholder = base.TextInputField( self._driver, self._locator.UI_PLACEHOLDER) self.checkbox_mandatory = base.Checkbox( self._driver, self._locator.CHECKBOX_MANDATORY)
def get_info_widget_obj_scope(self): """Get an Assessment object's text scope (headers' (real and synthetic) and values' txt) from Info Widget navigating through the Assessment's tabs. """ self.workflow_container.switch_to_tab( element.AssessmentTabContainer.OTHER_ATTRS_TAB) cas_text = self.get_headers_and_values_dict_from_cas_scopes() code_section = base.Label(self._driver, self._locators.CODE_CSS) code_text = code_section.element.find_element( *self._locators.CODE_HEADER_CSS).text code_entered_text = code_section.element.find_element( *self._locators.CODE_VALUE_CSS).text # todo: implement separate entities' model for asmts' lcas and gcas cas_text.update(self.lcas_text) self.list_all_headers_text = [ self._elements.CAS.upper(), self._elements.TITLE, self._elements.STATE.upper(), self._elements.VERIFIED.upper(), self.creators_text, self.assignees_text, self.verifiers_text, self._elements.MAPPED_OBJECTS.upper(), code_text, self.comments.header_lbl.text ] self.list_all_values_text = [ cas_text, self.title_entered().text, objects.get_normal_form(self.state().text), self.verified, self.creators_entered_text, self.assignees_entered_text, self.verifiers_entered_text, self.mapped_objects_titles_text, code_entered_text, self.comments_scopes ] return dict(zip(self.list_all_headers_text, self.list_all_values_text))
def __init__(self, driver): super(ExtendedInfo, self).__init__(driver) self.is_mapped = None self.button_map = None self.title = base.Label(driver, self.locator_cls.TITLE) self._set_is_mapped()
def __init__(self, driver): super(CustomAttributeModal, self).__init__(driver) self.attribute_title = base.Label( self._driver, self._locators.ATTRIBUTE_TITLE) self.inline_help = base.Label(self._driver, self._locators.INLINE_HELP) self.attribute_type = base.Label( self._driver, self._locators.ATTRIBUTE_TYPE) self.placeholder = base.Label(self._driver, self._locators.PLACEHOLDER) self.mandatory = base.Label(self._driver, self._locators.MANDATORY) self.ui_inline_help = None self.ui_placeholder = None self.checkbox_mandatory = base.Checkbox( self._driver, self._locators.CHECKBOX_MANDATORY) self.attribute_type_selector = base.DropdownStatic( self._driver, self._locators.ATTRIBUTE_TYPE_SELECTOR) self.ui_possible_values = None
def __init__(self, driver): super(InfoWidget, self).__init__(driver) self.child_cls_name = self.__class__.__name__ self.list_all_headers_txt = [] self.list_all_values_txt = [] self.info_widget_locator = ( self._locators.INFO_PAGE_ELEM if self.is_info_page else self._locators.INFO_PANEL_ELEM) self.info_widget_elem = selenium_utils.get_when_visible( self._driver, self.info_widget_locator) # common for all objects self.title_lbl_txt = self.get_title_lbl_txt() self.title = base.Element( self.info_widget_elem, self._locators.TITLE_ENTERED) self.state_lbl_txt = self._elements.STATE.upper() self.state_txt = self.get_state_txt() self._extend_list_all_scopes( [self.title_lbl_txt, self.state_lbl_txt], [self.title.text, self.state_txt]) self.info_3bbs_btn = selenium_utils.get_when_visible( self.info_widget_elem, self._locators.BUTTON_3BBS) # for Info Page if self.is_info_page: self.info_page_footer = base.Label( self.info_widget_elem, self._locators.TXT_FOOTER_CSS) self.modified_by = selenium_utils.get_when_visible( self.info_widget_elem, self._locators.TXT_MODIFIED_BY_CSS) _created_at_txt, _updated_at_txt = ( self.info_page_footer.text.split( string_utils.Symbols.WHITESPACE * 6)) self.created_at_txt = ( re.sub(element.Common.CREATED_AT, string_utils.Symbols.BLANK, _created_at_txt)) self.updated_at_txt = ( _updated_at_txt.splitlines()[1].replace( "on ", string_utils.Symbols.BLANK)) self._extend_list_all_scopes( [self._elements.CREATED_AT.upper(), self._elements.MODIFIED_BY.upper(), self._elements.UPDATED_AT.upper()], [self.created_at_txt, self.modified_by.text, self.updated_at_txt]) # for Info Panel else: self.panel = ( SnapshotedInfoPanel(self._driver, self.info_widget_elem) if (self.child_cls_name.lower() in objects.ALL_SNAPSHOTABLE_OBJS and self.is_snapshoted_panel) else InfoPanel(self._driver, self.info_widget_elem)) # for tab controller if not self.is_snapshoted_panel: self.tab_container_elem = self.info_widget_elem.find_element( *self._locators.TAB_CONTAINER_CSS) self.tab_container = self._get_tab_container() self.tab_container.tab_controller.active_tab = ( self.tab_container._elements.OBJ_TAB) # for overridable methods self._extend_list_all_scopes_by_code() self._extend_list_all_scopes_by_cas() self._extend_list_all_scopes_by_review_state()
def __init__(self, driver): super(Programs, self).__init__(driver) # todo: redesign 'Programs' cls init and related methods and tests self.show_advanced = base.Toggle(self.tab_container.active_tab_elem, self._locators.TOGGLE_SHOW_ADVANCED) self.show_advanced.toggle() self.manager, self.manager_entered = ( self.get_header_and_value_txt_from_people_scopes( self._elements.PROGRAM_MANAGERS.upper())) self._extend_list_all_scopes(self.manager, self.manager_entered) self.code = base.Label(self.tab_container.active_tab_elem, self._locators.CODE) self.code_entered = base.Label(self.tab_container.active_tab_elem, self._locators.CODE_ENTERED) self.effective_date = base.Label(self.tab_container.active_tab_elem, self._locators.EFFECTIVE_DATE) self.reference_urls = self._related_urls(self._reference_url_label)
def get_mapped_snapshots_titles(self): """Return titles of mapped snapshots on Assessment Modal. Return: list of str """ return [base.Label(self._driver, el.find_element( *self._locators.MAPPED_SNAPSHOT_TITLE_CSS)).text for el in selenium_utils.get_when_all_visible( self._driver, self._locators.MAPPED_SNAPSHOTS_CSS)]
def __init__(self, driver): super(ProgramsModal, self).__init__(driver) # user input elements self.ui_description = base.TextInputField( self.modal_elem, self._locators.UI_DESCRIPTION) self.ui_notes = base.TextInputField(self.modal_elem, self._locators.UI_NOTES) self.ui_state = base.Dropdown(self.modal_elem, self._locators.UI_STATE) self.ui_show_optional_fields = base.Toggle( self.modal_elem, self._locators.BUTTON_SHOW_ALL_OPTIONAL_FIELDS) self.ui_effective_date = base.DatePicker( self.modal_elem, self._locators.EFFECTIVE_DATE_DATEPICKER, self._locators.UI_EFFECTIVE_DATE) # static elements self.title = base.Label(self.modal_elem, self._locators.TITLE) self.description = base.Label(self.modal_elem, self._locators.DESCRIPTION)
def __init__(self, driver, obj_name): super(CommonUnifiedMapperModal, self).__init__(driver) # labels self.modal_elem = selenium_utils.get_when_visible( self._driver, self._locators.MODAL_CSS) self.filter_toggle = base.Toggle( self.modal_elem, self._locators.FILTER_TOGGLE_CSS) self.filter_toggle.is_activated = True self.title_modal = base.Label(self.modal_elem, self._locators.MODAL_TITLE) if obj_name != objects.ASSESSMENT_TEMPLATES: self.obj_type = base.Label(self.modal_elem, self._locators.OBJ_TYPE) # user input elements self.tree_view = base.UnifiedMapperTreeView( self._driver, obj_name=obj_name) self._add_attr_btn = None self.search_result_toggle = base.Toggle( self.modal_elem, self._locators.RESULT_TOGGLE_CSS) self.close_btn = base.Button(self.modal_elem, self._locators.CLOSE_BTN_CSS)
def __init__(self, driver): super(Audits, self).__init__(driver) self.title = base.Label(driver, self._locators.TITLE) self.title_entered = base.Label(driver, self._locators.TITLE_ENTERED) self.state = base.Label(driver, self._locators.STATE) self.audit_lead = base.Label(driver, self._locators.AUDIT_LEAD) self.code = base.Label(driver, self._locators.CODE) # scopes self.audit_lead_entered_text = self.get_value_by_header_text( self.audit_lead.text) self.code_entered_text = self.get_value_by_header_text(self.code.text) # scope self.list_headers_text = [ self.title.text, self._locators.elements.STATUS.upper(), self.audit_lead.text, self.code.text] self.list_values_text = [ self.title_entered.text, objects.get_normal_form(self.state.text), self.audit_lead_entered_text, self.code_entered_text]
def __init__(self, driver): super(UserList, self).__init__(driver) self.button_logout = base.Button( self._driver, self.locators.BUTTON_LOGOUT) self.notifications = base.Label( self._driver, self.locators.NOTIFICATIONS) self.checkbox_daily_digest = base.Checkbox( self._driver, self.locators.CHECKBOX_DAILY_DIGEST) self.button_help = base.Button( self._driver, self.locators.BUTTON_HELP)
def _extend_list_all_scopes_by_review_state(self): """Set attributes related to 'review state' and extend 'list all scopes' accordingly. """ # pylint: disable=invalid-name self.review_state_lbl = base.Label(self.info_widget_elem, self._locators.TXT_OBJECT_REVIEW) self.review_state_txt = self.get_review_state_txt() self._extend_list_all_scopes(self.review_state_lbl.text, self.review_state_txt)
def __init__(self, driver): super(CustomAttributeModal, self).__init__(driver) self.attr_title_lbl = base.Label(self.modal_window, self._locators.ATTR_TITLE_LBL_CSS) self.attr_type_lbl = base.Label(self.modal_window, self._locators.ATTR_TYPE_CSS) self.attr_type_selector_dd = base.DropdownStatic( self.modal_window, self._locators.ATTR_TYPE_SELECTOR_DD_CSS) self.mandatory_lbl = base.Label(self.modal_window, self._locators.MANDATORY_LBL_CSS) self.mandatory_cb = base.Checkbox(self.modal_window, self._locators.MANDATORY_CB_CSS) self.inline_help_lbl = base.Label(self.modal_window, self._locators.INLINE_HELP_LBL_CSS) self.inline_help_ui = None self.placeholder_lbl = base.Label(self.modal_window, self._locators.PLACEHOLDER_LBL_CSS) self.placeholder_ui = None self.possible_values_ui = None
def extend_list_all_scopes_by_code(self): """Set attributes related to 'code' and extend 'list all scopes' accordingly. """ code_elem = base.Label(self.info_widget_elem, self._locators.CODE_CSS) self.code_lbl_txt = code_elem.element.find_element( *self._locators.CODE_HEADER_CSS).text self.code_txt = code_elem.element.find_element( *self._locators.CODE_VALUE_CSS).text self._extend_list_all_scopes(self.code_lbl_txt, self.code_txt)