diff --git a/cms/djangoapps/contentstore/features/video.feature b/cms/djangoapps/contentstore/features/video.feature index e3aa9080b1..b13ce76b52 100644 --- a/cms/djangoapps/contentstore/features/video.feature +++ b/cms/djangoapps/contentstore/features/video.feature @@ -9,12 +9,22 @@ Feature: Video Component Given I have clicked the new unit button Then creating a video takes a single click - Scenario: Captions are shown correctly + Scenario: Captions are hidden correctly Given I have created a Video component And I have hidden captions Then when I view the video it does not show the captions - Scenario: something + Scenario: Captions are shown correctly Given I have created a Video component - And I have set "show captions" to false + And I have shown captions + Then when I view the video it does show the captions + + Scenario: Captions are hidden when "show captions" is false + Given I have created a Video component + And I have set "show captions" to False Then when I view the video it does not show the captions + + Scenario: Captions are shown when "show captions" is true + Given I have created a Video component + And I have set "show captions" to True + Then when I view the video it does show the captions diff --git a/cms/djangoapps/contentstore/features/video.py b/cms/djangoapps/contentstore/features/video.py index 33514b0b9e..0b50d0946f 100644 --- a/cms/djangoapps/contentstore/features/video.py +++ b/cms/djangoapps/contentstore/features/video.py @@ -18,18 +18,31 @@ def video_takes_a_single_click(step): assert(world.is_css_present('.xmodule_VideoModule')) -@step('I have hidden captions') -def hide_captions(step): - world.css_click('a.hide-subtitles') +@step('I have (hidden|shown) captions') +def hide_or_show_captions(step, shown): + if shown == 'hidden': + world.css_click('a.hide-subtitles') -@step('when I view the video it does not show the captions') -def does_not_show_captions(step): - assert world.css_find('.video')[0].has_class('closed') +@step('when I view the video it (.*) show the captions') +def does_not_show_captions(step, show_captions): + # Prevent cookies from overriding course settings + world.browser.cookies.delete('hide_captions') + if show_captions == 'does not': + assert world.css_find('.video')[0].has_class('closed') + else: + assert not world.css_find('.video')[0].has_class('closed') -@step('I have set "show captions" to false') -def set_show_captions_false(step): +# @step('when I view the video it does show the captions') +# def shows_captions(step): +# # Prevent cookies from overriding course settings +# world.browser.cookies.delete('hide_captions') +# assert not world.css_find('.video')[0].has_class('closed') + + +@step('I have set "show captions" to (.*)') +def set_show_captions_false(step, setting): world.css_click('a.edit-button') - world.browser.select('Show Captions', 'False') + world.browser.select('Show Captions', setting) world.css_click('a.save-button') diff --git a/common/lib/xmodule/xmodule/video_module.py b/common/lib/xmodule/xmodule/video_module.py index 1ee705a466..0170c4d310 100644 --- a/common/lib/xmodule/xmodule/video_module.py +++ b/common/lib/xmodule/xmodule/video_module.py @@ -75,7 +75,7 @@ class VideoModule(VideoFields, XModule): 'track': self.track, 'display_name': self.display_name_with_default, 'caption_asset_path': "/static/subs/", - 'show_captions': self.show_captions, + 'show_captions': 'true' if self.show_captions else 'false', 'start': self.start_time, 'end': self.end_time })