def setup_problem_attempts(self, step, not_attempted=None):
        r"that the conditioned problem has (?P<not_attempted>not )?been attempted$"
        visit_scenario_item("CONDITION_SOURCE")

        if not_attempted is None:
            answer_problem(self.COURSE_NUM, "string", True)
            world.css_click("input.check")
Beispiel #2
0
 def view_gst(self, step):
     r'I view the Graphical Slider Tool$'
     visit_scenario_item('GST')
     world.wait_for_js_variable_truthy(
         '$(".xblock-student_view[data-type=GraphicalSliderTool]").data("initialized")'
     )
     world.wait_for_ajax_complete()
Beispiel #3
0
def view_video(_step, player_mode):

    i_am_registered_for_the_course(_step, coursenum)

    # Make sure we have a video
    add_video_to_course(coursenum, player_mode.lower())
    visit_scenario_item('SECTION')
Beispiel #4
0
    def setup_problem_attempts(self, step, not_attempted=None):
        r'that the conditioned problem has (?P<not_attempted>not )?been attempted$'
        visit_scenario_item('CONDITION_SOURCE')

        if not_attempted is None:
            answer_problem(self.COURSE_NUM, 'string', True)
            world.css_click("button.check")
Beispiel #5
0
def add_correct_lti_to_course(_step, fields):
    category = 'lti'
    host = getattr(settings, 'LETTUCE_HOST', '127.0.0.1')
    metadata = {
        'lti_id':
        'correct_lti_id',
        'launch_url':
        'http://{}:{}/correct_lti_endpoint'.format(host, settings.LTI_PORT),
    }

    if fields.strip() == 'incorrect_lti_id':  # incorrect fields
        metadata.update({'lti_id': 'incorrect_lti_id'})
    elif fields.strip() == 'correct':  # correct fields
        pass
    elif fields.strip() == 'no_launch_url':
        metadata.update({'launch_url': u''})
    else:  # incorrect parameter
        assert False

    if _step.hashes:
        metadata.update(_step.hashes[0])

    world.scenario_dict['LTI'] = world.ItemFactory.create(
        parent_location=world.scenario_dict['SECTION'].location,
        category=category,
        display_name='LTI',
        metadata=metadata,
    )

    world.scenario_dict['LTI'].TEST_BASE_PATH = '{host}:{port}'.format(
        host=world.browser.host,
        port=world.browser.port,
    )

    visit_scenario_item('LTI')
Beispiel #6
0
def add_correct_lti_to_course(_step, fields):
    category = 'lti'
    metadata = {
        'lti_id': 'correct_lti_id',
        'launch_url': world.lti_server.oauth_settings['lti_base'] + world.lti_server.oauth_settings['lti_endpoint'],
    }
    if fields.strip() == 'incorrect_lti_id':  # incorrect fields
        metadata.update({
            'lti_id': 'incorrect_lti_id'
        })
    elif fields.strip() == 'correct':  # correct fields
        pass
    elif fields.strip() == 'no_launch_url':
        metadata.update({
            'launch_url': u''
        })
    else:  # incorrect parameter
        assert False

    if _step.hashes:
        metadata.update(_step.hashes[0])

    world.scenario_dict['LTI'] = world.ItemFactory.create(
        parent_location=world.scenario_dict['SECTION'].location,
        category=category,
        display_name='LTI',
        metadata=metadata,
    )

    setattr(world.scenario_dict['LTI'], 'TEST_BASE_PATH', '{host}:{port}'.format(
        host=world.browser.host,
        port=world.browser.port,
    ))

    visit_scenario_item('LTI')
Beispiel #7
0
def add_correct_lti_to_course(_step, fields):
    category = 'lti'
    metadata = {
        'lti_id':
        'correct_lti_id',
        'launch_url':
        world.lti_server.oauth_settings['lti_base'] +
        world.lti_server.oauth_settings['lti_endpoint'],
    }
    if fields.strip() == 'incorrect_lti_id':  # incorrect fields
        metadata.update({'lti_id': 'incorrect_lti_id'})
    elif fields.strip() == 'correct':  # correct fields
        pass
    elif fields.strip() == 'no_launch_url':
        metadata.update({'launch_url': u''})
    else:  # incorrect parameter
        assert False

    if _step.hashes:
        metadata.update(_step.hashes[0])

    world.scenario_dict['LTI'] = world.ItemFactory.create(
        parent_location=world.scenario_dict['SECTION'].location,
        category=category,
        display_name='LTI',
        metadata=metadata,
    )

    setattr(
        world.scenario_dict['LTI'], 'TEST_BASE_PATH', '{host}:{port}'.format(
            host=world.browser.host,
            port=world.browser.port,
        ))

    visit_scenario_item('LTI')
Beispiel #8
0
def add_correct_lti_to_course(_step, fields):
    category = 'lti'
    host = getattr(settings, 'LETTUCE_HOST', '127.0.0.1')
    metadata = {
        'lti_id': 'correct_lti_id',
        'launch_url': 'http://{}:{}/correct_lti_endpoint'.format(host, settings.LTI_PORT),
    }

    if fields.strip() == 'incorrect_lti_id':  # incorrect fields
        metadata.update({
            'lti_id': 'incorrect_lti_id'
        })
    elif fields.strip() == 'correct':  # correct fields
        pass
    elif fields.strip() == 'no_launch_url':
        metadata.update({
            'launch_url': u''
        })
    else:  # incorrect parameter
        assert False

    if _step.hashes:
        metadata.update(_step.hashes[0])

    world.scenario_dict['LTI'] = world.ItemFactory.create(
        parent_location=world.scenario_dict['SECTION'].location,
        category=category,
        display_name='LTI',
        metadata=metadata,
    )

    visit_scenario_item('LTI')
Beispiel #9
0
def add_correct_lti_to_course(_step, fields):
    category = "lti"
    metadata = {
        "lti_id": "correct_lti_id",
        "launch_url": "http://127.0.0.1:{}/correct_lti_endpoint".format(settings.LTI_PORT),
    }

    if fields.strip() == "incorrect_lti_id":  # incorrect fields
        metadata.update({"lti_id": "incorrect_lti_id"})
    elif fields.strip() == "correct":  # correct fields
        pass
    elif fields.strip() == "no_launch_url":
        metadata.update({"launch_url": u""})
    else:  # incorrect parameter
        assert False

    if _step.hashes:
        metadata.update(_step.hashes[0])

    world.scenario_dict["LTI"] = world.ItemFactory.create(
        parent_location=world.scenario_dict["SECTION"].location,
        category=category,
        display_name="LTI",
        metadata=metadata,
    )

    setattr(
        world.scenario_dict["LTI"],
        "TEST_BASE_PATH",
        "{host}:{port}".format(host=world.browser.host, port=world.browser.port),
    )

    visit_scenario_item("LTI")
Beispiel #10
0
def view_video(_step, player_mode):

    i_am_registered_for_the_course(_step, coursenum)

    # Make sure we have a video
    add_video_to_course(coursenum, player_mode.lower())
    visit_scenario_item('SECTION')
Beispiel #11
0
    def setup_problem_attempts(self, step, not_attempted=None):
        r'that the conditioned problem has (?P<not_attempted>not )?been attempted$'
        visit_scenario_item('CONDITION_SOURCE')

        if not_attempted is None:
            answer_problem(self.COURSE_NUM, 'string', True)
            world.css_click("input.check")
Beispiel #12
0
def _view_problem(step, problem_type, problem_settings=None):
    i_am_registered_for_the_course(step, 'model_course')

    # Ensure that the course has this problem type
    add_problem_to_course(world.scenario_dict['COURSE'].number, problem_type, problem_settings)

    # Go to the one section in the factory-created course
    # which should be loaded with the correct problem
    visit_scenario_item('SECTION')
    def answer_poll(self, step, answer):
        r' I answer the conditioned poll "([^"]*)"$'
        visit_scenario_item("CONDITION_SOURCE")
        world.wait_for_js_variable_truthy('$(".xblock-student_view[data-type=Poll]").data("initialized")')
        world.wait_for_ajax_complete()

        answer_text = [
            poll_answer["text"]
            for poll_answer in world.scenario_dict["CONDITION_SOURCE"].answers
            if poll_answer["id"] == answer
        ][0]

        text_selector = ".poll_answer .text"

        poll_texts = world.retry_on_exception(lambda: [elem.text for elem in world.css_find(text_selector)])

        for idx, poll_text in enumerate(poll_texts):
            if poll_text == answer_text:
                world.css_click(text_selector, index=idx)
                return
Beispiel #14
0
    def answer_poll(self, step, answer):
        r' I answer the conditioned poll "([^"]*)"$'
        visit_scenario_item('CONDITION_SOURCE')
        world.wait_for_js_variable_truthy(
            '$(".xblock-student_view[data-type=Poll]").data("initialized")')
        world.wait_for_ajax_complete()

        answer_text = [
            poll_answer['text']
            for poll_answer in world.scenario_dict['CONDITION_SOURCE'].answers
            if poll_answer['id'] == answer
        ][0]

        text_selector = '.poll_answer .text'

        poll_texts = world.retry_on_exception(
            lambda: [elem.text for elem in world.css_find(text_selector)])

        for idx, poll_text in enumerate(poll_texts):
            if poll_text == answer_text:
                world.css_click(text_selector, index=idx)
                return
Beispiel #15
0
def view_video(_step, player_mode):
    i_am_registered_for_the_course(_step, coursenum)
    data = _step.hashes[0] if _step.hashes else None
    add_video_to_course(coursenum, player_mode=player_mode.lower(), data=data)
    visit_scenario_item('SECTION')
    wait_for_video()
Beispiel #16
0
def view_video(_step, player_mode):
    i_am_registered_for_the_course(_step, coursenum)
    add_video_to_course(coursenum, player_mode.lower(), _step.hashes)
    visit_scenario_item('SECTION')
Beispiel #17
0
def visit_lti_component(_step):
    visit_scenario_item('LTI')
Beispiel #18
0
def add_video(_step, player_mode):
    add_video_to_course(coursenum, player_mode.lower(), _step.hashes)
    visit_scenario_item('SECTION')
Beispiel #19
0
def visit_video_section(_step):
    visit_scenario_item('SECTION')
    wait_for_video()
Beispiel #20
0
 def view_component(self, step):
     r"""I view the annotatable component$"""
     visit_scenario_item('ANNOTATABLE')
Beispiel #21
0
 def when_i_view_the_conditional(self, step):
     r'I view the conditional$'
     visit_scenario_item('CONDITIONAL')
     world.wait_for_js_variable_truthy(
         '$(".xblock-student_view[data-type=Conditional]").data("initialized")'
     )
Beispiel #22
0
def visit_video_section(_step):
    visit_scenario_item('SECTION')
    wait_for_video()
 def when_i_view_the_conditional(self, step):
     r"I view the conditional$"
     visit_scenario_item("CONDITIONAL")
     world.wait_for_js_variable_truthy('$(".xblock-student_view[data-type=Conditional]").data("initialized")')
Beispiel #24
0
def visit_lti_component(_step):
    visit_scenario_item('LTI')
def view_word_cloud(_step):
    coursenum = 'test_course'
    i_am_registered_for_the_course(_step, coursenum)

    add_word_cloud_to_course(coursenum)
    visit_scenario_item('SECTION')
Beispiel #26
0
def add_video(_step, player_mode):
    data = _step.hashes[0] if _step.hashes else None
    add_video_to_course(coursenum, player_mode=player_mode.lower(), data=data)
    visit_scenario_item('SECTION')
    wait_for_video()
Beispiel #27
0
def view_video(_step, player_mode):
    i_am_registered_for_the_course(_step, coursenum)
    data = _step.hashes[0] if _step.hashes else None
    add_video_to_course(coursenum, player_mode=player_mode.lower(), data=data)
    visit_scenario_item('SECTION')
    wait_for_video()
Beispiel #28
0
 def view_gst(self, step):
     r'I view the Graphical Slider Tool$'
     visit_scenario_item('GST')
     world.wait_for_js_variable_truthy('$(".xblock-student_view[data-type=GraphicalSliderTool]").data("initialized")')
     world.wait_for_ajax_complete()
Beispiel #29
0
def add_video(_step, player_mode):
    data = _step.hashes[0] if _step.hashes else None
    add_video_to_course(coursenum, player_mode=player_mode.lower(), data=data)
    visit_scenario_item('SECTION')
    wait_for_video()