def set_the_weight_to_abc(step, bad_weight): set_weight(bad_weight) # We show the clear button immediately on type, hence the "True" here. world.verify_setting_entry(world.get_setting_entry(PROBLEM_WEIGHT), PROBLEM_WEIGHT, "", True) world.save_component_and_reopen(step) # But no change was actually ever sent to the model, so on reopen, explicitly_set is False world.verify_setting_entry(world.get_setting_entry(PROBLEM_WEIGHT), PROBLEM_WEIGHT, "", False)
def set_the_max_attempts(step, max_attempts_set, max_attempts_displayed, max_attempts_persisted): world.get_setting_entry(MAXIMUM_ATTEMPTS).find_by_css( '.setting-input')[0].fill(max_attempts_set) world.verify_setting_entry(world.get_setting_entry(MAXIMUM_ATTEMPTS), MAXIMUM_ATTEMPTS, max_attempts_displayed, True) world.save_component_and_reopen(step) world.verify_setting_entry(world.get_setting_entry(MAXIMUM_ATTEMPTS), MAXIMUM_ATTEMPTS, max_attempts_persisted, True)
def video_name_persisted(step): world.save_component() reload_the_page(step) world.wait_for_xmodule() world.edit_component() world.verify_setting_entry(world.get_setting_entry('Display Name'), 'Display Name', '3.4', True)
def video_name_persisted(step): world.save_component() reload_the_page(step) world.wait_for_xmodule() world.edit_component() world.verify_setting_entry(world.get_setting_entry(DISPLAY_NAME), DISPLAY_NAME, '3.4', True)
def verify_modified_weight(): world.verify_setting_entry(world.get_setting_entry(PROBLEM_WEIGHT), PROBLEM_WEIGHT, "3.5", True)
def i_can_revert_to_default_for_unset_weight(step): world.revert_setting_entry(PROBLEM_WEIGHT) world.save_component_and_reopen(step) world.verify_setting_entry(world.get_setting_entry(PROBLEM_WEIGHT), PROBLEM_WEIGHT, "", False)
def i_can_revert_to_default_for_randomization(step): world.revert_setting_entry(RANDOMIZATION) world.save_component_and_reopen(step) world.verify_setting_entry(world.get_setting_entry(RANDOMIZATION), RANDOMIZATION, "Never", False)
def verify_modified_display_name_with_html(): world.verify_setting_entry(world.get_setting_entry(DISPLAY_NAME), DISPLAY_NAME, "<script>alert('test')</script>", True)
def verify_modified_display_name_with_special_chars(): world.verify_setting_entry(world.get_setting_entry(DISPLAY_NAME), DISPLAY_NAME, "updated ' \" &", True)
def i_can_modify_the_display_name_with_special_chars(step): world.get_setting_entry(DISPLAY_NAME).find_by_css( '.setting-input')[0].fill("updated ' \" &") verify_modified_display_name_with_special_chars()
def i_can_modify_the_display_name(step): # Verifying that the display name can be a string containing a floating point value # (to confirm that we don't throw an error because it is of the wrong type). world.get_setting_entry(DISPLAY_NAME).find_by_css( '.setting-input')[0].fill('3.4') verify_modified_display_name()
def set_weight(weight): world.get_setting_entry(PROBLEM_WEIGHT).find_by_css( '.setting-input')[0].fill(weight)
def verify_unset_display_name(): world.verify_setting_entry(world.get_setting_entry(DISPLAY_NAME), DISPLAY_NAME, '', False)
def verify_modified_randomization(): world.verify_setting_entry(world.get_setting_entry(RANDOMIZATION), RANDOMIZATION, "Per Student", True)
def i_can_modify_video_display_name(_step): index = world.get_setting_entry_index(DISPLAY_NAME) world.set_field_value(index, '3.4') world.verify_setting_entry(world.get_setting_entry(DISPLAY_NAME), DISPLAY_NAME, '3.4', True)
def verify_modified_display_name(): world.verify_setting_entry(world.get_setting_entry(DISPLAY_NAME), DISPLAY_NAME, '3.4', True)
def video_name_persisted(step): world.css_click('a.save-button') reload_the_page(step) world.edit_component() world.verify_setting_entry(world.get_setting_entry('Display Name'), 'Display Name', '3.4', True)
def verify_unset_display_name(): world.verify_setting_entry(world.get_setting_entry(DISPLAY_NAME), DISPLAY_NAME, 'Blank Advanced Problem', False)
def i_can_modify_the_display_name(step): world.get_setting_entry(DISPLAY_NAME).find_by_css( '.setting-input')[0].fill('modified') verify_modified_display_name()