Esempio 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')
Esempio 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')
Esempio 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')
Esempio 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)
Esempio 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))
Esempio 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")
Esempio 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")
Esempio 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)
    )
Esempio 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))
Esempio 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")
Esempio 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()
Esempio 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()
Esempio 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))
Esempio 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()
Esempio 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()
Esempio 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')
Esempio 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()
Esempio 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")
Esempio 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')
Esempio 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')
Esempio 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")
Esempio 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')
Esempio 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())
Esempio n. 25
0
def save_button_disabled(_step):
    button_css = '.action-save'
    disabled = 'is-disabled'
    assert world.css_has_class(button_css, disabled)
Esempio n. 26
0
def save_button_disabled(step):
    button_css = ".action-save"
    disabled = "is-disabled"
    assert world.css_has_class(button_css, disabled)
Esempio 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")
Esempio 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)
Esempio 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')
Esempio 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())
Esempio 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')
Esempio n. 33
0
def check_handout_error(_step):
    handout_error_css = 'div#handout_error'
    assert world.css_has_class(handout_error_css, 'is-shown')
Esempio n. 34
0
def button_disabled(step, value):
    button_css = 'input[value="%s"]' % value
    assert world.css_has_class(button_css, 'is-disabled')
Esempio 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')
Esempio n. 36
0
def check_handout_error(_step):
    handout_error_css = 'div#handout_error'
    assert world.css_has_class(handout_error_css, 'is-shown')
Esempio n. 37
0
def button_disabled(_step, value):
    button_css = 'input[value="%s"]' % value
    assert world.css_has_class(button_css, 'is-disabled')
Esempio 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')
Esempio 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)
Esempio 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")