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