def respondent_has_completed_survey(context): # Complete the survey by phone ru_ref = '49900000007' business_party = get_party_by_ru_ref(ru_ref) ce_id = get_collection_exercise('cb8accda-6118-4d3b-85a3-149e28960c54', '201801')['id'] case = get_b_case(ce_id, business_party['id']) post_case_event(case['id'], 'COMPLETED_BY_PHONE', 'Completed by phone') # Ensure respondent is signed in and navigate to history signed_in_respondent(context) go_to_history_tab()
def send_message_from_external_with_body_over_80_characters(context): # Get authentication and navigate to correct page signed_in_respondent(context) go_to_surveys_todo() select_to_create_message() # Create message create_message_external.enter_valid_subject('Long message') create_message_external.enter_valid_body_over_80_character_summary() # Send message create_message_external.send_message()
def create_multiple_messages_external_to_internal(context, number_of_messages, subject='Subject', body='Body'): signed_in_respondent(context) for i in range(number_of_messages): surveys_todo.go_to() surveys_todo.select_to_create_message() create_message_external.enter_valid_subject(f"{subject}_{str(i)}") create_message_external.enter_valid_body(f"{body}_{str(i)}") create_message_external.send_message()
def create_message_external_to_internal(context, subject='Subject', body='Body'): # Send a message from a respondent in the context of a Bricks survey # Note that internal users may have to be signed in again after calling this function # Navigate to send a message signed_in_respondent(context) surveys_todo.go_to() surveys_todo.select_to_create_message() # Create message create_message_external.enter_valid_subject(subject) create_message_external.enter_valid_body(body) # Send message create_message_external.send_message() logger.debug("Message from external to internal created")
def external_user_has_a_conversation(context): create_message_external_to_internal(context, 'Message to ONS', 'Message body to ONS') signed_in_internal(context) reply_to_last_message_internal(context) signed_in_respondent(context) page_helpers.go_to_first_conversation_in_message_box()
def internal_user_replies_to_last_message_and_respondent_signs_in(context): internal_user_replies_to_last_message(context) # sign in again as respondent signed_in_respondent(context)
def external_user_can_see_message(context): signed_in_respondent(context) surveys_todo.go_to() page_helpers.go_to_first_conversation_in_message_box() context.browser_url = browser.url
def respondent_goes_to_history_page(context): signed_in_respondent(context) surveys_history.go_to_history_tab()
def respondent_partially_completes_survey(context): signed_in_respondent(context) browser.click_link_by_id('access_survey_button_1') browser.click_link_by_id('download_survey_button')
def survey_set_to_longer_required(context, status): signed_in_respondent(context) go_to_history_tab() assert browser.find_by_text(status)
def enrolled_respondent_but_not_completed(context): signed_in_respondent(context)
def enrolling_onto_survey(context): signed_in_respondent(context) browser.click_link_by_id('access_survey_button_1') collection_exercise_details.upload_collection_instrument( test_file='resources/collection_instrument_files/064_201803_0001.xlsx') browser.find_by_id('upload_survey_button').click()