def do_user_can_add_reply_to_email_to_service(driver):
    if config["env"] != "preview":
        return True
    email_address = config['service']['email_reply_to']
    email_address2 = config['service']['email_reply_to_2']
    email_address3 = config['service']['email_reply_to_3']
    dashboard_page = DashboardPage(driver)
    dashboard_page.go_to_dashboard_for_service()

    service_id = dashboard_page.get_service_id()

    email_reply_to_page = EmailReplyTo(driver)

    email_reply_to_page.go_to_add_email_reply_to_address(service_id)
    email_reply_to_page.insert_email_reply_to_address(email_address)
    email_reply_to_page.click_add_email_reply_to()

    email_reply_to_page.click_continue_button(time=120)

    body = email_reply_to_page.get_reply_to_email_addresses()

    assert email_address + default in body.text
    assert email_address2 not in body.text
    assert email_address3 not in body.text

    dashboard_page.go_to_dashboard_for_service(service_id)
def do_user_registration(driver, profile, base_url):

    main_page = MainPage(driver)
    main_page.get()
    main_page.click_set_up_account()

    registration_page = RegistrationPage(driver)
    assert registration_page.is_current()

    registration_page.register(profile)

    assert driver.current_url == base_url + "/registration-continue"

    registration_link = get_link(profile, profile.registration_template_id, profile.email)

    driver.get(registration_link)

    do_verify(driver, profile)

    add_service_page = AddServicePage(driver)
    assert add_service_page.is_current()
    add_service_page.add_service(profile.service_name)

    dashboard_page = DashboardPage(driver)
    service_id = dashboard_page.get_service_id()
    dashboard_page.go_to_dashboard_for_service(service_id)

    assert dashboard_page.h2_is_service_name(profile.service_name)
def do_user_registration(driver):
    main_page = MainPage(driver)
    main_page.get()
    main_page.click_set_up_account()

    registration_page = RegistrationPage(driver)
    assert registration_page.is_current()

    registration_page.register()

    assert driver.current_url == config['notify_admin_url'] + '/registration-continue'

    registration_link = get_link(config['notify_templates']['registration_template_id'], config['user']['email'])

    driver.get(registration_link)

    do_verify(driver)

    add_service_page = AddServicePage(driver)
    assert add_service_page.is_current()
    add_service_page.add_service(config['service_name'])

    dashboard_page = DashboardPage(driver)
    service_id = dashboard_page.get_service_id()
    dashboard_page.go_to_dashboard_for_service(service_id)

    assert dashboard_page.get_service_name() == config['service_name']
def get_service_templates_and_api_key_for_tests(driver, test_profile):

    dashboard_page = DashboardPage(driver)
    dashboard_page.click_email_templates()
    service_id = dashboard_page.get_service_id()

    email_template_page = SendEmailTemplatePage(driver)
    email_template_page.click_add_a_new_template()

    new_email_template_page = EditEmailTemplatePage(driver)
    new_email_template_page.create_template()

    email_template_page = SendEmailTemplatePage(driver)
    email_template_page.click_edit_template()

    edit_email_template_page = EditEmailTemplatePage(driver)
    email_template_id = edit_email_template_page.get_id()

    dashboard_page = DashboardPage(driver)
    dashboard_page.go_to_dashboard_for_service()
    dashboard_page.click_sms_templates()

    sms_template_page = SendSmsTemplatePage(driver)
    sms_template_page.click_add_new_template()

    new_sms_template = EditSmsTemplatePage(driver)
    new_sms_template.create_template()

    sms_template_page = SendSmsTemplatePage(driver)
    sms_template_page.click_edit_template()

    edit_sms_template = EditSmsTemplatePage(driver)
    sms_template_id = edit_sms_template.get_id()

    dashboard_page = DashboardPage(driver)
    dashboard_page.go_to_dashboard_for_service()
    dashboard_page.click_api_keys_link()

    api_key_page = ApiKeyPage(driver)
    api_key_page.click_keys_link()
    api_key_page.click_create_key()

    api_key_page.click_key_type_radio(key_type='team')
    api_key_page.enter_key_name(key_type='team')

    api_key_page.click_continue()
    api_key = api_key_page.get_api_key()

    test_profile.service_id = service_id
    test_profile.email_template_id = email_template_id
    test_profile.sms_template_id = sms_template_id
    test_profile.api_key = api_key

    return {'service_id': service_id, 'email_template_id': email_template_id, 'sms_template_id': sms_template_id, 'api_key': api_key}  # noqa
def do_user_can_invite_someone_to_notify(driver, basic_view):

    dashboard_page = DashboardPage(driver)
    dashboard_page.click_team_members_link()

    team_members_page = TeamMembersPage(driver)
    assert team_members_page.h1_is_team_members()
    team_members_page.click_invite_user()

    invite_user_page = InviteUserPage(driver)

    invited_user_randomness = str(uuid.uuid1())
    invited_user_name = 'Invited User ' + invited_user_randomness
    invite_email = generate_unique_email(config['user']['email'],
                                         invited_user_randomness)
    if basic_view:
        invite_user_page.fill_invitation_form(invite_email,
                                              send_messages_only=True)
    else:
        invite_user_page.fill_invitation_form(invite_email,
                                              send_messages_only=False)

    invite_user_page.send_invitation()
    invite_user_page.sign_out()
    invite_user_page.wait_until_url_is(config['notify_admin_url'])

    # next part of interaction is from point of view of invitee
    # i.e. after visting invite_link we'll be registering using invite_email
    # but use same mobile number and password as profile

    invite_link = get_link(
        config['notify_templates']['invitation_template_id'], invite_email)
    driver.get(invite_link)
    register_from_invite_page = RegisterFromInvite(driver)
    register_from_invite_page.fill_registration_form(invited_user_name)
    register_from_invite_page.click_continue()

    do_verify(driver)
    dashboard_page = DashboardPage(driver)
    service_id = dashboard_page.get_service_id()
    dashboard_page.go_to_dashboard_for_service(service_id)

    assert dashboard_page.get_service_name() == config['service_name']
    if basic_view:
        is_basic_view(dashboard_page)
        dashboard_page.sign_out()
        dashboard_page.wait_until_url_is(config['notify_admin_url'])
    else:
        is_view_for_all_permissions(dashboard_page)
Example #6
0
def do_user_can_update_sms_sender_of_service(driver):
    dashboard_page = DashboardPage(driver)
    dashboard_page.go_to_dashboard_for_service()

    service_id = dashboard_page.get_service_id()

    sms_sender_page = SmsSenderPage(driver)

    sms_sender_page.go_to_text_message_senders(service_id)
    sms_sender_page.click_change_link_for_first_sms_sender()
    sms_sender_page.insert_sms_sender('first')
    sms_sender_page.click_save_sms_sender()

    main_content = sms_sender_page.get_sms_senders()

    assert 'first \u2002 (default)' in main_content.text

    dashboard_page.go_to_dashboard_for_service(service_id)
Example #7
0
def do_user_can_add_sms_sender_to_service(driver):
    dashboard_page = DashboardPage(driver)
    dashboard_page.go_to_dashboard_for_service()

    service_id = dashboard_page.get_service_id()

    sms_sender_page = SmsSenderPage(driver)

    sms_sender_page.go_to_add_text_message_sender(service_id)
    sms_sender_page.insert_sms_sender('second')
    sms_sender_page.click_save_sms_sender()

    main_content = sms_sender_page.get_sms_senders()

    assert 'first \u2002 (default)' in main_content.text
    assert 'second' in main_content.text
    assert 'second \u2002 (default)' not in main_content.text

    dashboard_page.go_to_dashboard_for_service(service_id)
def do_user_can_update_reply_to_email_to_service(driver):
    if config["env"] != "preview":
        return True
    email_address = config['service']['email_reply_to']
    email_address2 = config['service']['email_reply_to_2']
    dashboard_page = DashboardPage(driver)
    dashboard_page.go_to_dashboard_for_service()

    service_id = dashboard_page.get_service_id()

    email_reply_to_page = EmailReplyTo(driver)

    email_reply_to_page.go_to_add_email_reply_to_address(service_id)
    email_reply_to_page.insert_email_reply_to_address(email_address2)
    email_reply_to_page.click_add_email_reply_to()

    email_reply_to_page.click_continue_button(time=120)

    body = email_reply_to_page.get_reply_to_email_addresses()

    assert email_address + default in body.text
    assert email_address2 in body.text

    sub_body = body.text[body.text.index(
        email_address2):]  # find the index of the email address
    # the id is the fifth entry [ 'email address, 'Change', 'email address', 'id label', id' ]
    email_reply_to_id = sub_body.split('\n')[4]

    email_reply_to_page.go_to_edit_email_reply_to_address(
        service_id, email_reply_to_id)
    email_reply_to_page.check_is_default_check_box()
    email_reply_to_page.click_add_email_reply_to()

    body = email_reply_to_page.get_reply_to_email_addresses()

    assert email_address in body.text
    assert email_address + default not in body.text
    assert email_address2 + default in body.text

    dashboard_page.go_to_dashboard_for_service(service_id)
def do_user_can_invite_someone_to_notify(driver, profile, base_url):

    dashboard_page = DashboardPage(driver)
    dashboard_page.click_team_members_link()

    team_members_page = TeamMembersPage(driver)
    assert team_members_page.h1_is_team_members()
    team_members_page.click_invite_user()

    invite_user_page = InviteUserPage(driver)

    invited_user_randomness = str(uuid.uuid1())
    invited_user_name = "Invited User " + invited_user_randomness
    invite_email = generate_unique_email(profile.email, invited_user_randomness)

    invite_user_page.fill_invitation_form(invite_email, send_messages=True)
    invite_user_page.send_invitation()
    invite_user_page.sign_out()
    invite_user_page.wait_until_url_is(base_url)

    # next part of interaction is from point of view of invitee
    # i.e. after visting invite_link we'll be registering using invite_email
    # but use same mobile number and password as profile

    invite_link = get_link(profile, profile.invitation_template_id, invite_email)
    driver.get(invite_link)
    register_from_invite_page = RegisterFromInvite(driver)
    register_from_invite_page.fill_registration_form(invited_user_name, profile)
    register_from_invite_page.click_continue()

    do_verify(driver, profile)
    dashboard_page = DashboardPage(driver)
    service_id = dashboard_page.get_service_id()
    dashboard_page.go_to_dashboard_for_service(service_id)

    assert dashboard_page.h2_is_service_name(profile.service_name)

    dashboard_page.sign_out()
    dashboard_page.wait_until_url_is(base_url)