def confirm_reason_popup_displayed(context, modal_title): """ Checks that the title (text) of the expected popup matches that of the one displayed :param context: behave context :param modal_title: String. The title expected in the popup :return: boolean """ modals_page = ModalPage(context.driver) modals = modals_page.get_open_modals() submit_modal = modals[0] assert modal_title in modals_page.get_modal_title(submit_modal), \ "Expected title '{}' not presented".format(modal_title)
def confirm_observation_submission(context, obs_name): """ Verifies the correct message and observation name is displayed upon confirming the submission of an observation form :param context: behave context :param obs_name: name of the observation expected :return: boolean """ form_page = DataEntryPage(context.driver) form_page.confirm_submit_scored_ob() modal_page = ModalPage(context.driver) modals = modal_page.get_open_modals() submit_modal = modals[0] expected_modal_title = 'Successfully Submitted {} Observation'.format( obs_name) actual_modal_title = modal_page.get_modal_title(submit_modal) assert expected_modal_title == actual_modal_title, \ "The expected modal title is '{}' but the actual modal title is {}"\ .format(expected_modal_title, actual_modal_title)