Ejemplo n.º 1
0
def does_not_autoplay(_step, video_type):
    world.wait(DELAY)
    world.wait_for_ajax_complete()
    actual = world.css_find('.%s' % video_type)[0]['data-autoplay']
    expected = [u'False', u'false', False]
    assert actual in expected
    assert world.css_has_class('.video_control', 'play')
Ejemplo n.º 2
0
def does_not_autoplay(_step, video_type):
    world.wait(DELAY)
    world.wait_for_ajax_complete()
    actual = world.css_find('.%s' % video_type)[0]['data-autoplay']
    expected = [u'False', u'false', False]
    assert actual in expected
    assert world.css_has_class('.video_control', 'play')
Ejemplo n.º 3
0
def shows_captions(step, show_captions):
    # Prevent cookies from overriding course settings
    world.browser.cookies.delete('hide_captions')
    if show_captions == 'does not':
        assert world.css_has_class('.video', 'closed')
    else:
        assert world.is_css_not_present('.video.closed')
Ejemplo n.º 4
0
def shows_captions(_step, video_type, show_captions):
    # Prevent cookies from overriding course settings
    world.browser.cookies.delete('hide_captions')
    if show_captions == 'does not':
        assert world.css_has_class('.%s' % video_type, 'closed')
    else:
        assert world.is_css_not_present('.%s.closed' % video_type)
Ejemplo n.º 5
0
def type_in_codemirror_plugin(_step, text):
    # Verify that raw code editor is not visible.
    assert world.css_has_class('.CodeMirror', 'is-inactive')
    # Verify that TinyMCE editor is present
    assert world.is_css_present('.tiny-mce')
    use_code_editor(
        lambda: type_in_codemirror(0, text, CODEMIRROR_SELECTOR_PREFIX))
Ejemplo n.º 6
0
def shows_captions(step, show_captions):
    # Prevent cookies from overriding course settings
    world.browser.cookies.delete("hide_captions")
    if show_captions == "does not":
        assert world.css_has_class(".video", "closed")
    else:
        assert world.is_css_not_present(".video.closed")
Ejemplo n.º 7
0
def does_not_autoplay(_step, video_type):
    world.wait(DELAY)
    world.wait_for_ajax_complete()
    actual = world.css_find(".%s" % video_type)[0]["data-autoplay"]
    expected = [u"False", u"false", False]
    assert actual in expected
    assert world.css_has_class(".video_control", "play")
Ejemplo n.º 8
0
def type_in_codemirror_plugin(step, text):
    # Verify that raw code editor is not visible.
    assert_true(world.css_has_class('.CodeMirror', 'is-inactive'))
    # Verify that TinyMCE editor is present
    assert_true(world.is_css_present('.tiny-mce'))
    use_code_editor(
        lambda: type_in_codemirror(0, text, CODEMIRROR_SELECTOR_PREFIX)
    )
Ejemplo n.º 9
0
def seek_video_to_n_seconds(_step, time_str):
    time = parse_time_str(time_str)
    jsCode = "$('.video').data('video-player-state').videoPlayer.onSlideSeek({{time: {0}}})".format(
        time)
    world.browser.execute_script(jsCode)
    world.wait_for(
        func=lambda _: world.retry_on_exception(lambda: elapsed_time(
        ) == time and not world.css_has_class('.video', 'is-buffering')),
        timeout=30)
    _step.given('I see video slider at "{0}" position'.format(time_str))
Ejemplo n.º 10
0
def approve_my_photo(step, name):
    button_css = {
        "face": "div#wrapper-facephoto li.control-approve",
        "photo_id": "div#wrapper-idphoto li.control-approve",
    }
    wrapper_css = {"face": "div#wrapper-facephoto", "photo_id": "div#wrapper-idphoto"}

    # Make sure that the carousel is in the right place
    assert world.css_has_class(wrapper_css[name], "carousel-active")
    assert world.css_find(button_css[name])

    # HACK: for now don't bother clicking the approve button for
    # id_photo, because it is sending you back to Step 1.
    # Come back and figure it out later. JZ Aug 29 2013
    if name == "face":
        world.css_click(button_css[name])

    # Make sure you didn't advance the carousel
    assert world.css_has_class(wrapper_css[name], "carousel-active")
Ejemplo n.º 11
0
def click_button(_step, button):
    world.css_click(VIDEO_BUTTONS[button])
    if button == "play":
        # Needs to wait for video buffrization
        world.wait_for(
            func=lambda _: world.css_has_class('.video', 'is-playing') and world.is_css_present(VIDEO_BUTTONS['pause']),
            timeout=30
        )

    world.wait_for_ajax_complete()
Ejemplo n.º 12
0
def click_button(_step, button):
    world.css_click(VIDEO_BUTTONS[button])
    if button == "play":
        # Needs to wait for video buffrization
        world.wait_for(
            func=lambda _: world.css_has_class('.video', 'is-playing') and
            world.is_css_present(VIDEO_BUTTONS['pause']),
            timeout=30)

    world.wait_for_ajax_complete()
Ejemplo n.º 13
0
def seek_video_to_n_seconds(_step, time_str):
    time = parse_time_str(time_str)
    jsCode = "$('.video').data('video-player-state').videoPlayer.onSlideSeek({{time: {0}}})".format(time)
    world.browser.execute_script(jsCode)
    world.wait_for(
        func=lambda _: world.retry_on_exception(
            lambda: elapsed_time() == time and not world.css_has_class(".video", "is-buffering")
        ),
        timeout=30,
    )
    _step.given('I see video slider at "{0}" position'.format(time_str))
Ejemplo n.º 14
0
def select_language(_step, code):
    _open_menu("language")
    selector = VIDEO_MENUS["language"] + ' li[data-lang-code={code}]'.format(
        code=code)
    item = world.css_find(selector)

    item.click()

    assert world.css_has_class(selector, 'active')
    assert len(world.css_find(VIDEO_MENUS["language"] + ' li.active')) == 1
    assert world.css_visible('.subtitles')
    world.wait_for_ajax_complete()
Ejemplo n.º 15
0
def select_language(_step, code):
    _open_menu("language")
    selector = VIDEO_MENUS["language"] + ' li[data-lang-code={code}]'.format(
        code=code
    )

    world.css_click(selector)

    assert world.css_has_class(selector, 'active')
    assert len(world.css_find(VIDEO_MENUS["language"] + ' li.active')) == 1
    assert world.css_visible('.subtitles')
    world.wait_for_ajax_complete()
Ejemplo n.º 16
0
def approve_my_photo(step, name):
    button_css = {
        'face': 'div#wrapper-facephoto li.control-approve',
        'photo_id': 'div#wrapper-idphoto li.control-approve',
    }
    wrapper_css = {
        'face': 'div#wrapper-facephoto',
        'photo_id': 'div#wrapper-idphoto',
    }

    # Make sure that the carousel is in the right place
    assert world.css_has_class(wrapper_css[name], 'carousel-active')
    assert world.css_find(button_css[name])

    # HACK: for now don't bother clicking the approve button for
    # id_photo, because it is sending you back to Step 1.
    # Come back and figure it out later. JZ Aug 29 2013
    if name == 'face':
        world.css_click(button_css[name])

    # Make sure you didn't advance the carousel
    assert world.css_has_class(wrapper_css[name], 'carousel-active')
Ejemplo n.º 17
0
def select_language(_step, code):
    selector = VIDEO_MENUS["language"] + ' li[data-lang-code="{code}"]'.format(
        code=code
    )

    world.wait_for_present(selector)
    world.css_find(VIDEO_BUTTONS["CC"])[0].mouse_over()
    world.wait_for_visible(selector)
    world.css_click(selector)

    assert world.css_has_class(selector, 'active')
    assert len(world.css_find(VIDEO_MENUS["language"] + ' li.active')) == 1
    assert world.css_visible('.subtitles')
    world.wait_for_ajax_complete()
Ejemplo n.º 18
0
def select_language(_step, code):
    # Make sure that all ajax requests that affects the language menu are finished.
    # For example, request to get new translation etc.
    world.wait_for_ajax_complete()
    selector = VIDEO_MENUS["language"] + ' li[data-lang-code="{code}"]'.format(code=code)

    world.css_find(VIDEO_BUTTONS["CC"])[0].mouse_over()
    world.wait_for_present(".lang.open")
    world.css_click(selector)

    assert world.css_has_class(selector, "is-active")
    assert len(world.css_find(VIDEO_MENUS["language"] + " li.is-active")) == 1

    # Make sure that all ajax requests that affects the display of captions are finished.
    # For example, request to get new translation etc.
    world.wait_for_ajax_complete()
    world.wait_for_visible(".subtitles")
    world.wait_for_present(".video.is-captions-rendered")
Ejemplo n.º 19
0
def select_language(_step, code):
    # Make sure that all ajax requests that affects the language menu are finished.
    # For example, request to get new translation etc.
    world.wait_for_ajax_complete()

    selector = VIDEO_MENUS["language"] + ' li[data-lang-code="{code}"]'.format(
        code=code)

    world.css_find(VIDEO_BUTTONS["CC"])[0].mouse_over()
    world.css_click(selector)

    assert world.css_has_class(selector, 'active')
    assert len(world.css_find(VIDEO_MENUS["language"] + ' li.active')) == 1

    # Make sure that all ajax requests that affects the display of captions are finished.
    # For example, request to get new translation etc.
    world.wait_for_ajax_complete()
    world.wait_for_visible('.subtitles')
Ejemplo n.º 20
0
def does_not_autoplay(_step, video_type):
    assert world.css_find('.%s' % video_type)[0]['data-autoplay'] == 'False'
    assert world.css_has_class('.video_control', 'play')
Ejemplo n.º 21
0
def does_not_autoplay(_step, video_type):
    assert world.css_find('.%s' % video_type)[0]['data-autoplay'] == 'False'
    assert world.css_has_class('.video_control', 'play')
def check_handout_error(_step):
    handout_error_css = "div#handout_error"
    assert world.css_has_class(handout_error_css, "is-shown")
Ejemplo n.º 23
0
def i_see_active_button(_step, button, state):
    selector = VIDEO_BUTTONS[button]
    if state == 'active':
        assert world.css_has_class(selector, 'active')
    else:
        assert not world.css_has_class(selector, 'active')
Ejemplo n.º 24
0
def caption_line_has_class(_step, index, className):
    SELECTOR = ".subtitles > li[data-index='{index}']".format(
        index=int(index.strip()))
    assert world.css_has_class(SELECTOR, className.strip())
Ejemplo n.º 25
0
def save_button_disabled(_step):
    button_css = '.action-save'
    disabled = 'is-disabled'
    assert world.css_has_class(button_css, disabled)
Ejemplo n.º 26
0
def save_button_disabled(step):
    button_css = ".action-save"
    disabled = "is-disabled"
    assert world.css_has_class(button_css, disabled)
Ejemplo n.º 27
0
def save_button_disabled(step):
    button_css = '.action-save'
    disabled = 'is-disabled'
    assert world.css_has_class(button_css, disabled)
def check_handout_error(_step):
    handout_save_button = "form.edit-handouts-form a.save-button"
    assert world.css_has_class(handout_save_button, "is-disabled")
Ejemplo n.º 29
0
def type_in_raw_editor(_step, text):
    # Verify that CodeMirror editor is not hidden
    assert not world.css_has_class('.CodeMirror', 'is-inactive')
    # Verify that TinyMCE Editor is not present
    assert world.is_css_not_present('.tiny-mce')
    type_in_codemirror(0, text)
Ejemplo n.º 30
0
def does_not_autoplay(_step, video_type):
    actual = world.css_find('.%s' % video_type)[0]['data-autoplay']
    expected = [u'False', u'false', False]
    assert actual in expected
    assert world.css_has_class('.video_control', 'play')
Ejemplo n.º 31
0
def caption_line_has_class(_step, index, className):
    SELECTOR = ".subtitles > li[data-index='{index}']".format(index=int(index.strip()))
    assert world.css_has_class(SELECTOR, className.strip())
Ejemplo n.º 32
0
def check_handout_error(_step):
    handout_save_button = 'form.edit-handouts-form a.save-button'
    assert not world.css_has_class(handout_save_button, 'is-disabled')
Ejemplo n.º 33
0
def check_handout_error(_step):
    handout_error_css = 'div#handout_error'
    assert world.css_has_class(handout_error_css, 'is-shown')
Ejemplo n.º 34
0
def button_disabled(step, value):
    button_css = 'input[value="%s"]' % value
    assert world.css_has_class(button_css, 'is-disabled')
Ejemplo n.º 35
0
def i_see_active_button(_step, button, state):
    selector = VIDEO_BUTTONS[button]
    if state == 'active':
       assert world.css_has_class(selector, 'active')
    else:
       assert not world.css_has_class(selector, 'active')
Ejemplo n.º 36
0
def check_handout_error(_step):
    handout_error_css = 'div#handout_error'
    assert world.css_has_class(handout_error_css, 'is-shown')
Ejemplo n.º 37
0
def button_disabled(_step, value):
    button_css = 'input[value="%s"]' % value
    assert world.css_has_class(button_css, 'is-disabled')
Ejemplo n.º 38
0
def check_handout_error(_step):
    handout_save_button = 'form.edit-handouts-form a.save-button'
    assert not world.css_has_class(handout_save_button, 'is-disabled')
Ejemplo n.º 39
0
def type_in_raw_editor(step, text):
    # Verify that CodeMirror editor is not hidden
    assert_false(world.css_has_class('.CodeMirror', 'is-inactive'))
    # Verify that TinyMCE Editor is not present
    assert_true(world.is_css_not_present('.tiny-mce'))
    type_in_codemirror(0, text)
Ejemplo n.º 40
0
def does_not_autoplay(_step, video_type):
    world.wait_for_xmodule()
    assert world.css_find(".%s" % video_type)[0]["data-autoplay"] == "False"
    assert world.css_has_class(".video_control", "play")