def confirm_submit_scored_ob(self):
     """
     Confirm the 'Submit Score of X for Y, Z' modal that pops up after
     first pressing the submit button for scored observations.
     """
     modal_page = ModalPage(self.driver)
     modals = modal_page.get_open_modals()
     scored_modal = modals[0]
     modal_page.click_modal_option(scored_modal, 'Submit')
    def submit_cancellation_reason(self, cancel_reason):
        """
        Select the specified cancellation reason and submit the modal to
        cancel the task

        :param cancel_reason: Name of reason to select
        """
        modal_page = ModalPage(self.driver)
        modals = modal_page.get_open_modals()
        cancel_modal = modals[0]
        modal_page.select_reason_in_modal(cancel_modal, cancel_reason)
        modal_page.click_modal_option(cancel_modal, 'Submit')
def select_partial_reason_in_popup(context, reason):
    """
    Selects specified reason in the drop-down and submits the selection in the
    reason for partial obs popup

    :param context: behave context
    :param reason: reason to be selected in the drop-down
    """
    popup_options = ModalPage(context.driver)
    modals = popup_options.get_open_modals()
    submit_modal = modals[0]
    popup_options.select_reason_in_modal(submit_modal, reason)
    popup_options.click_modal_option(submit_modal, 'Submit')
 def take_escalation_task(self):
     """
     Take the escalation task presented to the user once an observation that
     has escalation tasks is submitted
     """
     modal_page = ModalPage(self.driver)
     modals = modal_page.get_open_modals()
     escalation_modal = modals[0]
     escalation_modal_options = \
         modal_page.get_modal_options(escalation_modal)
     if len(escalation_modal_options) > 1:
         modal_page.click_modal_option(escalation_modal, 'Confirm')
     else:
         modal_page.click_modal_option(escalation_modal, 'Go to My Tasks')