Example #1
0
def set_show_captions(step, setting):
    # Prevent cookies from overriding course settings
    world.browser.cookies.delete("hide_captions")

    world.css_click("a.edit-button")
    world.wait_for(lambda _driver: world.css_visible("a.save-button"))
    world.click_link_by_text("Advanced")
    world.browser.select("Show Transcript", setting)
    world.css_click("a.save-button")
def set_show_captions(step, setting):
    # Prevent cookies from overriding course settings
    world.browser.cookies.delete('hide_captions')

    world.css_click('a.edit-button')
    world.wait_for(lambda _driver: world.css_visible('a.save-button'))
    world.click_link_by_text('Advanced')
    world.browser.select('Transcript Display', setting)
    world.css_click('a.save-button')
Example #3
0
def i_click_on_error_dialog(step):
    world.click_link_by_text('Correct failed component')
    assert_true(
        world.css_html("span.inline-error").startswith(
            "Problem i4x://MITx/999/problem"))
    assert_equal(
        1,
        world.browser.url.count(
            "unit/MITx.999.Robot_Super_Course/branch/draft/block/vertical"))
Example #4
0
def check_transcripts_field(_step, values, field_name):
    world.wait(DELAY)
    world.wait_for_ajax_complete()

    world.click_link_by_text('Advanced')
    field_id = '#' + world.browser.find_by_xpath('//label[text()="%s"]' % field_name.strip())[0]['for']
    values_list = [i.strip() == world.css_value(field_id) for i in values.split('|')]
    assert any(values_list)
    world.click_link_by_text('Basic')
Example #5
0
def set_show_captions(step, setting):
    # Prevent cookies from overriding course settings
    world.browser.cookies.delete('hide_captions')

    world.css_click('a.edit-button')
    world.wait_for(lambda _driver: world.css_visible('a.save-button'))
    world.click_link_by_text('Advanced')
    world.browser.select('Transcript Display', setting)
    world.css_click('a.save-button')
Example #6
0
def i_click_on_error_dialog(step):
    world.click_link_by_text('Correct failed component')
    assert_true(world.css_html("span.inline-error").startswith("Problem i4x://MITx/999/problem"))
    course_key = SlashSeparatedCourseKey("MITx", "999", "Robot_Super_Course")
    # we don't know the actual ID of the vertical. So just check that we did go to a
    # vertical page in the course (there should only be one).
    vertical_usage_key = course_key.make_usage_key("vertical", "")
    vertical_url = reverse_usage_url('unit_handler', vertical_usage_key)
    assert_equal(1, world.browser.url.count(vertical_url))
Example #7
0
def i_click_on_error_dialog(step):
    world.click_link_by_text('Correct failed component')
    assert_true(
        world.css_html("span.inline-error").startswith(
            "Problem i4x://MITx/999/problem"))
    course_key = SlashSeparatedCourseKey("MITx", "999", "Robot_Super_Course")
    # we don't know the actual ID of the vertical. So just check that we did go to a
    # vertical page in the course (there should only be one).
    vertical_usage_key = course_key.make_usage_key("vertical", "")
    vertical_url = reverse_usage_url('unit_handler', vertical_usage_key)
    assert_equal(1, world.browser.url.count(vertical_url))
def i_click_on_error_dialog(step):
    world.click_link_by_text('Correct failed component')
    assert_true(world.css_html("span.inline-error").startswith("Problem i4x://MITx/999/problem"))
    course_key = SlashSeparatedCourseKey("MITx", "999", "Robot_Super_Course")
    # we don't know the actual ID of the vertical. So just check that we did go to a
    # vertical page in the course (there should only be one).
    vertical_usage_key = course_key.make_usage_key("vertical", None)
    vertical_url = reverse_usage_url('container_handler', vertical_usage_key)
    # Remove the trailing "/None" from the URL - we don't know the course ID, so we just want to
    # check that we visited a vertical URL.
    if vertical_url.endswith("/None"):
        vertical_url = vertical_url[:-5]
    assert_equal(1, world.browser.url.count(vertical_url))
def i_click_on_error_dialog(step):
    world.click_link_by_text('Correct failed component')
    assert_true(
        world.css_html("span.inline-error").startswith(
            "Problem i4x://MITx/999/problem"))
    course_key = SlashSeparatedCourseKey("MITx", "999", "Robot_Super_Course")
    # we don't know the actual ID of the vertical. So just check that we did go to a
    # vertical page in the course (there should only be one).
    vertical_usage_key = course_key.make_usage_key("vertical", None)
    vertical_url = reverse_usage_url('container_handler', vertical_usage_key)
    # Remove the trailing "/None" from the URL - we don't know the course ID, so we just want to
    # check that we visited a vertical URL.
    if vertical_url.endswith("/None"):
        vertical_url = vertical_url[:-5]
    assert_equal(1, world.browser.url.count(vertical_url))
Example #10
0
def i_click_on_error_dialog(step):
    world.click_link_by_text('Correct failed component')

    problem_string = unicode(world.scenario_dict['COURSE'].id.make_usage_key("problem", 'ignore'))
    problem_string = u"Problem {}".format(problem_string[:problem_string.rfind('ignore')])
    assert_true(
        world.css_html("span.inline-error").startswith(problem_string),
        u"{} does not start with {}".format(
            world.css_html("span.inline-error"), problem_string
        ))
    # we don't know the actual ID of the vertical. So just check that we did go to a
    # vertical page in the course (there should only be one).
    vertical_usage_key = world.scenario_dict['COURSE'].id.make_usage_key("vertical", None)
    vertical_url = reverse_usage_url('container_handler', vertical_usage_key)
    # Remove the trailing "/None" from the URL - we don't know the course ID, so we just want to
    # check that we visited a vertical URL.
    if vertical_url.endswith("/None"):
        vertical_url = vertical_url[:-5]
    assert_equal(1, world.browser.url.count(vertical_url))
Example #11
0
def i_click_on_error_dialog(step):
    world.wait_for_visible(".button.action-primary")
    world.click_link_by_text('Correct failed component')

    problem_string = unicode(world.scenario_dict['COURSE'].id.make_usage_key("problem", 'ignore'))
    problem_string = u"Problem {}".format(problem_string[:problem_string.rfind('ignore')])
    assert_true(
        world.css_html("span.inline-error").startswith(problem_string),
        u"{} does not start with {}".format(
            world.css_html("span.inline-error"), problem_string
        ))
    # we don't know the actual ID of the vertical. So just check that we did go to a
    # vertical page in the course (there should only be one).
    vertical_usage_key = world.scenario_dict['COURSE'].id.make_usage_key("vertical", "test")
    vertical_url = reverse_usage_url('container_handler', vertical_usage_key)
    # Remove the trailing "/None" from the URL - we don't know the course ID, so we just want to
    # check that we visited a vertical URL.
    if vertical_url.endswith("/test") or vertical_url.endswith("@test"):
        vertical_url = vertical_url[:-5]
    assert_equal(1, world.browser.url.count(vertical_url))
Example #12
0
def open_tab(_step, tab_name):
    world.click_link_by_text(tab_name.strip())
    world.wait_for_ajax_complete()
Example #13
0
def check_transcripts_field(_step, values, field_name):
    world.click_link_by_text("Advanced")
    field_id = "#" + world.browser.find_by_xpath('//label[text()="%s"]' % field_name.strip())[0]["for"]
    values_list = [i.strip() == world.css_value(field_id) for i in values.split("|")]
    assert any(values_list)
    world.click_link_by_text("Basic")
Example #14
0
def open_tab(_step, tab_name):
    world.click_link_by_text(tab_name.strip())
Example #15
0
def open_tab(_step, tab_name):
    world.click_link_by_text(tab_name.strip())
    world.wait_for_ajax_complete()
Example #16
0
def i_click_on_error_dialog(step):
    world.click_link_by_text('Correct failed component')
    assert_true(world.css_html("span.inline-error").startswith("Problem i4x://MITx/999/problem"))
    assert_equal(1, world.browser.url.count("unit/MITx.999.Robot_Super_Course/branch/draft/block/vertical"))