Commit aa49ef47 by polesye

Merge pull request #727 from edx/anton/video_minor_fixes

Video Player: minor fixes
parents 594a73d4 7a68516d
...@@ -5,7 +5,7 @@ from lettuce import world, step ...@@ -5,7 +5,7 @@ from lettuce import world, step
from terrain.steps import reload_the_page from terrain.steps import reload_the_page
@step('I have set "show captions" to (.*)') @step('I have set "show captions" to (.*)$')
def set_show_captions(step, setting): def set_show_captions(step, setting):
world.css_click('a.edit-button') world.css_click('a.edit-button')
world.wait_for(lambda _driver: world.css_visible('a.save-button')) world.wait_for(lambda _driver: world.css_visible('a.save-button'))
...@@ -13,7 +13,7 @@ def set_show_captions(step, setting): ...@@ -13,7 +13,7 @@ def set_show_captions(step, setting):
world.css_click('a.save-button') world.css_click('a.save-button')
@step('when I view the (video.*) it (.*) show the captions') @step('when I view the (video.*) it (.*) show the captions$')
def shows_captions(_step, video_type, show_captions): def shows_captions(_step, video_type, show_captions):
# Prevent cookies from overriding course settings # Prevent cookies from overriding course settings
world.browser.cookies.delete('hide_captions') world.browser.cookies.delete('hide_captions')
...@@ -39,7 +39,7 @@ def correct_video_settings(_step): ...@@ -39,7 +39,7 @@ def correct_video_settings(_step):
['Youtube ID for 1.5x speed', '', False]]) ['Youtube ID for 1.5x speed', '', False]])
@step('my video display name change is persisted on save') @step('my video display name change is persisted on save$')
def video_name_persisted(step): def video_name_persisted(step):
world.css_click('a.save-button') world.css_click('a.save-button')
reload_the_page(step) reload_the_page(step)
......
...@@ -19,25 +19,25 @@ def i_created_a_video_component(step): ...@@ -19,25 +19,25 @@ def i_created_a_video_component(step):
) )
@step('when I view the (.*) it does not have autoplay enabled') @step('when I view the (.*) it does not have autoplay enabled$')
def does_not_autoplay(_step, video_type): def does_not_autoplay(_step, video_type):
assert world.css_find('.%s' % video_type)[0]['data-autoplay'] == 'False' assert world.css_find('.%s' % video_type)[0]['data-autoplay'] == 'False'
assert world.css_has_class('.video_control', 'play') assert world.css_has_class('.video_control', 'play')
@step('creating a video takes a single click') @step('creating a video takes a single click$')
def video_takes_a_single_click(_step): def video_takes_a_single_click(_step):
assert(not world.is_css_present('.xmodule_VideoModule')) assert(not world.is_css_present('.xmodule_VideoModule'))
world.css_click("a[data-category='video']") world.css_click("a[data-category='video']")
assert(world.is_css_present('.xmodule_VideoModule')) assert(world.is_css_present('.xmodule_VideoModule'))
@step('I edit the component') @step('I edit the component$')
def i_edit_the_component(_step): def i_edit_the_component(_step):
world.edit_component() world.edit_component()
@step('I have (hidden|toggled) captions') @step('I have (hidden|toggled) captions$')
def hide_or_show_captions(step, shown): def hide_or_show_captions(step, shown):
button_css = 'a.hide-subtitles' button_css = 'a.hide-subtitles'
if shown == 'hidden': if shown == 'hidden':
...@@ -54,7 +54,7 @@ def hide_or_show_captions(step, shown): ...@@ -54,7 +54,7 @@ def hide_or_show_captions(step, shown):
world.css_click(button_css) world.css_click(button_css)
@step('I have created a video with only XML data') @step('I have created a video with only XML data$')
def xml_only_video(step): def xml_only_video(step):
# Create a new video *without* metadata. This requires a certain # Create a new video *without* metadata. This requires a certain
# amount of rummaging to make sure all the correct data is present # amount of rummaging to make sure all the correct data is present
...@@ -84,7 +84,7 @@ def xml_only_video(step): ...@@ -84,7 +84,7 @@ def xml_only_video(step):
reload_the_page(step) reload_the_page(step)
@step('The correct Youtube video is shown') @step('The correct Youtube video is shown$')
def the_youtube_video_is_shown(_step): def the_youtube_video_is_shown(_step):
ele = world.css_find('.video').first ele = world.css_find('.video').first
assert ele['data-streams'].split(':')[1] == world.scenario_dict['YOUTUBE_ID'] assert ele['data-streams'].split(':')[1] == world.scenario_dict['YOUTUBE_ID']
......
...@@ -12,12 +12,12 @@ HTML5_SOURCES = [ ...@@ -12,12 +12,12 @@ HTML5_SOURCES = [
'https://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.ogv' 'https://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.ogv'
] ]
@step('when I view the (.*) it has autoplay enabled') @step('when I view the (.*) it has autoplay enabled$')
def does_autoplay_video(_step, video_type): def does_autoplay_video(_step, video_type):
assert(world.css_find('.%s' % video_type)[0]['data-autoplay'] == 'True') assert(world.css_find('.%s' % video_type)[0]['data-autoplay'] == 'True')
@step('the course has a Video component in (.*) mode') @step('the course has a Video component in (.*) mode$')
def view_video(_step, player_mode): def view_video(_step, player_mode):
coursenum = 'test_course' coursenum = 'test_course'
i_am_registered_for_the_course(step, coursenum) i_am_registered_for_the_course(step, coursenum)
...@@ -55,18 +55,16 @@ def add_video_to_course(course, player_mode): ...@@ -55,18 +55,16 @@ def add_video_to_course(course, player_mode):
world.ItemFactory.create(**kwargs) world.ItemFactory.create(**kwargs)
@step('when I view the video it has rendered in (.*) mode') @step('when I view the video it has rendered in (.*) mode$')
def video_is_rendered(_step, mode): def video_is_rendered(_step, mode):
modes = { modes = {
'html5': 'video', 'html5': 'video',
'youtube': 'iframe' 'youtube': 'iframe'
} }
if mode.lower() in modes: html_tag = modes[mode.lower()]
assert world.css_find('.video {0}'.format(modes[mode.lower()])).first assert world.css_find('.video {0}'.format(html_tag)).first
else:
assert False
@step('all sources are correct') @step('all sources are correct$')
def all_sources_are_correct(_step): def all_sources_are_correct(_step):
sources = world.css_find('.video video source') sources = world.css_find('.video video source')
assert set(source['src'] for source in sources) == set(HTML5_SOURCES) assert set(source['src'] for source in sources) == set(HTML5_SOURCES)
......
...@@ -20,8 +20,7 @@ import unittest ...@@ -20,8 +20,7 @@ import unittest
from django.conf import settings from django.conf import settings
from xmodule.video_module import ( from xmodule.video_module import VideoDescriptor, _create_youtube_string
VideoDescriptor, _create_youtube_string)
from xmodule.modulestore import Location from xmodule.modulestore import Location
from xmodule.tests import get_test_system, LogicTest from xmodule.tests import get_test_system, LogicTest
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment