Пример #1
0
    def delete_ui_script(self, name, deleted_message):
        # Cannot use confirm_popup_delete as there is no confirm element for ui scripts
        field = self.find_element_by_locator(CustomizationsLocators.element_by_name(name))
        field_row = self.get_grandparent_element(field)
        field_row.find_element_by_xpath("td[4]/a").click()

        dialog = self.find_element_by_locator(GeneralLocators.dialog)
        self.click_nested_element(dialog, GeneralLocators.ok)
        self.validate_element_text(GeneralLocators.message_success, deleted_message)
Пример #2
0
    def check_custom_field(self, label, system_name, description, field_type):
        link = self.find_element_by_locator(CustomizationsLocators.element_by_name(label))
        link.click()
        self.validate_element_text(GeneralLocators.label, label)
        self.validate_element_text(CustomizationsLocators.add_custom_field_description, description)
        self.validate_element_text(GeneralLocators.name, system_name)

        type_box = self.find_element_by_locator(CustomizationsLocators.add_custom_field_type)
        select = Select(type_box)
        selected_field_type = select.first_selected_option.text
        assert selected_field_type == field_type
Пример #3
0
    def check_ui_script(self, name, script, active):
        link = self.find_element_by_locator(CustomizationsLocators.element_by_name(name))
        link.click()

        script_box = self.find_element_by_locator(CustomizationsLocators.add_ui_script_script)
        # We have to normalise whitespace because the browser adds and removes whitespace
        script_from_browser = '\n'.join([line.rstrip() for line in script_box.get_attribute('value').strip().split('\n')])
        assert script_from_browser == script.strip()

        active_button = self.find_element_by_locator(CustomizationsLocators.add_ui_script_active)
        assert active_button.is_selected() == active
Пример #4
0
    def edit_priority(self, name, edit_name, edit_abbreviation, edited_message):
        link = self.find_element_by_locator(CustomizationsLocators.element_by_name(name))
        link.click()

        self.clear_element_data(GeneralLocators.name)
        self.clear_element_data(CustomizationsLocators.add_priority_abbreviation)
        self.send_keys_to_element(GeneralLocators.name, edit_name)
        self.send_keys_to_element(CustomizationsLocators.add_priority_abbreviation, edit_abbreviation)

        self.click_element(GeneralLocators.submit_button)
        self.validate_element_text(GeneralLocators.message_success, edited_message)
Пример #5
0
    def edit_custom_field(self, label, new_label, new_description, edited_msg):
        link = self.find_element_by_locator(CustomizationsLocators.element_by_name(label))
        link.click()
        self.clear_element_data(GeneralLocators.label)

        description_box = self.find_element_by_locator(GeneralLocators.label)
        self.send_keys_to_element(GeneralLocators.label, new_label)
        # CTRL-A plus BACKSPACE are needed for selenium to clear the textarea as .clear() doesn't work.
        self.send_keys_to_element(CustomizationsLocators.add_custom_field_description, Keys.CONTROL + "a")
        self.send_keys_to_element(CustomizationsLocators.add_custom_field_description, Keys.BACKSPACE)
        # Added same field clearing for MacOS, as COMMAND key is needed
        self.send_keys_to_element(CustomizationsLocators.add_custom_field_description, Keys.COMMAND + "a")
        self.send_keys_to_element(CustomizationsLocators.add_custom_field_description, Keys.BACKSPACE)
        self.send_keys_to_element(CustomizationsLocators.add_custom_field_description, new_description)

        select_templates = self.find_element_by_locator(CustomizationsLocators.add_custom_field_include_specific_templates)
        select_templates.click()

        exploratory_session = self.find_element_by_locator(CustomizationsLocators.add_custom_field_exploratory_session)
        exploratory_session.click()

        self.click_element(GeneralLocators.submit_button)
        self.validate_element_text(GeneralLocators.message_success, edited_msg)
Пример #6
0
 def delete_custom_field(self, label, deleted_message):
     field = self.find_element_by_locator(CustomizationsLocators.element_by_name(label))
     field_row = self.get_grandparent_element(field)
     field_row.find_element_by_xpath("td[8]/a").click()
     self.confirm_popup_delete()
     self.validate_element_text(GeneralLocators.message_success, deleted_message)
Пример #7
0
 def delete_case_type(self, name):
     try:
         case = self.find_element_by_locator(CustomizationsLocators.element_by_name(name))
         case_row = self.get_grandparent_element(case)
         case_row.find_element_by_xpath("td[3]/a").click()
         self.confirm_popup_delete()
Пример #8
0
 def edit_case_type(self, name, new_name):
     link = self.find_element_by_locator(CustomizationsLocators.element_by_name(name))
     link.click()
     self.clear_element_data(GeneralLocators.name)
     self.send_keys_to_element(GeneralLocators.name, new_name)
     self.click_element(GeneralLocators.submit_button)
Пример #9
0
 def check_add_case_type_name(self, name):
     link = self.find_element_by_locator(CustomizationsLocators.element_by_name(name))
     link.click()
     self.validate_element_text(GeneralLocators.name, name)
Пример #10
0
    def check_priority(self, name, abbreviation):
        link = self.find_element_by_locator(CustomizationsLocators.element_by_name(name))
        link.click()

        self.validate_element_text(GeneralLocators.name, name)
        self.validate_element_text(CustomizationsLocators.add_priority_abbreviation, abbreviation)
Пример #11
0
        self.send_keys_to_element(GeneralLocators.name, new_name)
        self.click_element(GeneralLocators.submit_button)

    def delete_case_type(self, name):
        try:
            case = self.find_element_by_locator(CustomizationsLocators.element_by_name(name))
            case_row = self.get_grandparent_element(case)
            case_row.find_element_by_xpath("td[3]/a").click()
            self.confirm_popup_delete()
        except TimeoutException:
            pytest.fail("Element not found")
        except NoSuchElementException:
            pytest.fail("Element not found")

    def check_case_type_cannot_be_deleted(self, name):
        case = self.find_element_by_locator(CustomizationsLocators.element_by_name(name))
        case_row = self.get_grandparent_element(case)
        delete_cell = case_row.find_element_by_xpath("td[3]")
        # Assert there is no delete link in this row
        assert len(delete_cell.find_elements_by_tag_name('a')) == 0

    def validate_case_type_deleted(self, message):
        self.validate_element_text(GeneralLocators.message_success, message)

    def validate_custom_field_required_fields(self, message):
        self.click_element(CustomizationsLocators.add_custom_field)
        self.validate_element_text(GeneralLocators.message_error, message)

    def custom_field_add_text_fields(self, label, system_name, description):
        self.send_keys_to_element(GeneralLocators.label, label)
        self.send_keys_to_element(CustomizationsLocators.add_custom_field_description, description)