def when_i_reorder_group1_group2_s_function_keys_such_that( step, firstname, lastname): common.open_url('user', 'search', {'search': '%s %s' % (firstname, lastname)}) common.edit_line("%s %s" % (firstname, lastname)) pairs = [(k['Old'], k['New']) for k in step.hashes] user_action_webi.change_key_order(pairs) form.submit.submit_form()
def then_i_see_user_with_username_group1_group2_has_a_function_key(step, firstname, lastname, extension): common.open_url('user', 'search', {'search': '%s %s' % (firstname, lastname)}) common.edit_line("%s %s" % (firstname, lastname)) common.go_to_tab('Func Keys') destination_field = world.browser.find_element_by_id('it-phonefunckey-custom-typeval-0') assert destination_field.get_attribute('value') == extension type_field = Select(world.browser.find_element_by_id('it-phonefunckey-type-0')) assert type_field.first_selected_option.text == "Customized" common.open_url('user', 'search', {'search': ''})
def then_the_outcall_1_has_the_extension_patterns(step, outcall_name): common.open_url('outcall', 'list') common.edit_line(outcall_name) common.go_to_tab('Exten') for outcall_extension in step.hashes: extension_pattern = outcall_extension['extension_pattern'] extension_pattern_input = outcall_action_webi.exten_line(extension_pattern).find_element_by_xpath(".//input[@name='dialpattern[exten][]']") assert_that(extension_pattern_input, not_none())
def remove_directory(name): while common.element_is_in_list('cti_directory', name): common.remove_line(name) # Work around for directory associations that aren't deleted common.open_url('cti_direct_directory', 'list') try: common.edit_line('default') except Exception: pass # No default context configured else: submit.submit_form()
def when_i_remove_extension_patterns_from_outcall_1(step, outcall_name): common.open_url('outcall', 'list') common.edit_line(outcall_name) common.go_to_tab('Exten') for outcall_extension in step.hashes: extension_pattern = outcall_extension['extension_pattern'] delete_button = outcall_action_webi.exten_line(extension_pattern).find_element_by_id('lnk-del-row') delete_button.click() # Wait for the Javascript to remove the line time.sleep(1) form.submit.submit_form()
def when_i_add_the_following_extension_patterns_to_the_outcall_1(step, outcall_name): common.open_url('outcall', 'list') common.edit_line(outcall_name) common.go_to_tab('Exten') for outcall_extension in step.hashes: add_button = world.browser.find_element_by_id('lnk-add-row', 'Can\'t add an exten') add_button.click() input_exten = world.browser.find_elements_by_xpath( "//table[@id='list_exten']//input[@name='dialpattern[exten][]']")[-1] input_exten.send_keys(outcall_extension['extension_pattern']) form.submit.submit_form()
def then_i_see_user_with_username_group1_group2_has_a_function_key( step, firstname, lastname, extension): common.open_url('user', 'search', {'search': '%s %s' % (firstname, lastname)}) common.edit_line("%s %s" % (firstname, lastname)) common.go_to_tab('Func Keys') destination_field = world.browser.find_element_by_id( 'it-phonefunckey-custom-typeval-0') assert destination_field.get_attribute('value') == extension type_field = Select( world.browser.find_element_by_id('it-phonefunckey-type-0')) assert type_field.first_selected_option.text == "Customized" common.open_url('user', 'search', {'search': ''})
def then_the_profile_1_has_default_services_activated(step, profile_name): common.open_url('profile', 'list') common.edit_line(profile_name) time.sleep(world.timeout) # wait for the javascript to load expected_services = [ 'Enable DND', 'Unconditional transfer to a number', 'Transfer on busy', 'Transfer on no-answer', ] selected_services = profile_action_webi.selected_services() assert_that(selected_services, equal_to(expected_services))
def then_the_outcall_1_does_not_have_extension_patterns(step, outcall_name): common.open_url('outcall', 'list') common.edit_line(outcall_name) common.go_to_tab('Exten') for outcall_extension in step.hashes: extension_pattern = outcall_extension['extension_pattern'] try: outcall_action_webi.exten_line(extension_pattern) except NoSuchElementException: pass else: raise Exception('extension pattern %s unexpectedly found in outcall %s' % (outcall_extension, outcall_name))
def given_user_has_the_following_function_keys(step, firstname, lastname): common.open_url('user', 'search', {'search': '%s %s' % (firstname, lastname)}) common.edit_line("%s %s" % (firstname, lastname)) name_map = { 'Key': 'key_number', 'Type': 'key_type', 'Destination': 'destination', 'Label': 'label', 'Supervision': 'supervised', } for key_definition in step.hashes: key = dict((name_map[k], v) for k, v in key_definition.iteritems()) user_action_webi.type_func_key(**key) form.submit.submit_form()
def given_there_are_groups(step): for group in step.hashes: group_helper.delete_groups_with_number(group['exten']) group_helper.add_group( group['name'], group['exten'], group['context'] ) common.open_url('group', 'list', {'search': group['name']}) common.edit_line(group['name']) if 'ring seconds' in group: form.select.set_select_field_with_label('Ring time', '%s seconds' % group['ring seconds']) if 'noanswer' in group: common.go_to_tab('No answer') forward_dest_type, forward_dest_name = group['noanswer'].split(':', 1) if forward_dest_type == 'group': form.select.set_select_field_with_id('it-dialaction-noanswer-actiontype', 'Group') form.select.set_select_field_with_id_containing('it-dialaction-noanswer-group-actionarg1', forward_dest_name) form.submit.submit_form() common.open_url('group', 'list', {'search': ''})
def given_there_are_groups(step): for group in step.hashes: group_helper.delete_groups_with_number(group['exten']) group_helper.add_group(group['name'], group['exten'], group['context']) common.open_url('group', 'list', {'search': group['name']}) common.edit_line(group['name']) if 'ring seconds' in group: form.select.set_select_field_with_label( 'Ring time', '%s seconds' % group['ring seconds']) if 'noanswer' in group: common.go_to_tab('No answer') forward_dest_type, forward_dest_name = group['noanswer'].split( ':', 1) if forward_dest_type == 'group': form.select.set_select_field_with_id( 'it-dialaction-noanswer-actiontype', 'Group') form.select.set_select_field_with_id_containing( 'it-dialaction-noanswer-group-actionarg1', forward_dest_name) form.submit.submit_form() common.open_url('group', 'list', {'search': ''})
def when_i_edit_and_save_the_directory(step, directory): common.open_url('directory_config', 'list') common.edit_line(directory) submit.submit_form()
def switchboard_config_for_user(user): common.open_url('user') common.edit_line(user) select_simultaneous_calls(1) enable_call_transfer() form.submit.submit_form()
def when_i_add_xlet_to_profile(step, xlet_name, profile_name): common.open_url('profile', 'list') common.edit_line(profile_name) common.go_to_tab('Xlets') profile_action_webi.add_xlet(xlet_name) form.submit.submit_form()
def update_meetme(meetme): common.open_url('meetme', 'list') common.edit_line(meetme['name']) fill_form(meetme) form.submit.submit_form()
def when_i_modify_the_channel_type_of_group_group1_of_user_group2_to_group3( step, group, fullname, chantype): common.open_url('user', 'search', {'search': fullname}) common.edit_line(fullname) user_action_webi.select_chantype_of_group(group, chantype) form.submit.submit_form()
def then_the_channel_type_of_group_group1_of_user_group2_is_group3(step, group, fullname, chantype): common.open_url('user', 'search', {'search': fullname}) common.edit_line(fullname) assert_that(user_action_webi.get_chantype_of_group(group), equal_to(chantype))
def when_i_disable_custom_codecs_for_this_line(step): line_action_webi.search_line_number(world.id) common.edit_line(world.id) _open_codec_page() Checkbox.from_label("Customize codecs:").uncheck() form.submit.submit_form()
def _fn(schedule_name, *args, **kwargs): common.open_url('schedule') common.edit_line(schedule_name) fn(*args, **kwargs) form.submit.submit_form()
def when_i_edit_the_config_file_group1_and_reload_dialplan(step, file_name): common.open_url('configfiles') common.edit_line(file_name) actions.type_reload_dialplan(True) form.submit.submit_form()
def deactivate_bsfilter(user): common.open_url('user', 'search', {'search': user}) common.edit_line(user) common.go_to_tab('Services') form.select.set_select_field_with_id('it-userfeatures-bsfilter', 'No') form.submit.submit_form()
def _fn(schedule_name, *args, **kwargs): common.open_url("schedule") common.edit_line(schedule_name) fn(*args, **kwargs) form.submit.submit_form()
def then_the_channel_type_of_group_group1_of_user_group2_is_group3( step, group, fullname, chantype): common.open_url('user', 'search', {'search': fullname}) common.edit_line(fullname) assert_that(user_action_webi.get_chantype_of_group(group), equal_to(chantype))
def when_i_edit_the_outcall_and_set_context(step, name, context): common.open_url('outcall', 'list') common.edit_line(name) type_field = Select(world.browser.find_element_by_id('it-outcall-context', 'Outcall form not loaded')) type_field.select_by_value(context) form.submit.submit_form()
def then_the_user_group1_has_the_following_func_keys(step, user): common.open_url('user', 'search', {'search': user}) common.edit_line(user) common.go_to_tab('Func Keys') for line_number, line in enumerate(step.hashes, 1): _check_func_key(line, line_number)
def when_i_reorder_group1_group2_s_function_keys_such_that(step, firstname, lastname): common.open_url('user', 'search', {'search': '%s %s' % (firstname, lastname)}) common.edit_line("%s %s" % (firstname, lastname)) pairs = [(k['Old'], k['New']) for k in step.hashes] user_action_webi.change_key_order(pairs) form.submit.submit_form()
def when_i_modify_the_channel_type_of_group_group1_of_user_group2_to_group3(step, group, fullname, chantype): common.open_url('user', 'search', {'search': fullname}) common.edit_line(fullname) user_action_webi.select_chantype_of_group(group, chantype) form.submit.submit_form()