From 2ed66ce7a5529abb9d445b994e2eddedc2ad48c9 Mon Sep 17 00:00:00 2001 From: Will Daly Date: Fri, 30 Aug 2013 11:48:35 -0400 Subject: [PATCH] Updated acceptance tests to match new behavior in video captions. --- .../features/video-editor.feature | 4 +- .../contentstore/features/video-editor.py | 13 +- .../contentstore/features/video.feature | 6 +- cms/djangoapps/contentstore/features/video.py | 21 ++- .../data/uploads/subs_OEoXaMPEzfM.srt.sjson | 143 ++++++++++++++++++ 5 files changed, 175 insertions(+), 12 deletions(-) create mode 100644 common/test/data/uploads/subs_OEoXaMPEzfM.srt.sjson diff --git a/cms/djangoapps/contentstore/features/video-editor.feature b/cms/djangoapps/contentstore/features/video-editor.feature index d238a7e523..9665046939 100644 --- a/cms/djangoapps/contentstore/features/video-editor.feature +++ b/cms/djangoapps/contentstore/features/video-editor.feature @@ -17,13 +17,13 @@ Feature: Video Component Editor # Sauce Labs cannot delete cookies @skip_sauce Scenario: Captions are hidden when "show captions" is false - Given I have created a Video component + Given I have created a Video component with subtitles And I have set "show captions" to False Then when I view the video it does not show the captions # Sauce Labs cannot delete cookies @skip_sauce Scenario: Captions are shown when "show captions" is true - Given I have created a Video component + Given I have created a Video component with subtitles 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-editor.py b/cms/djangoapps/contentstore/features/video-editor.py index 93d3be2ac0..ba16862739 100644 --- a/cms/djangoapps/contentstore/features/video-editor.py +++ b/cms/djangoapps/contentstore/features/video-editor.py @@ -7,20 +7,21 @@ from terrain.steps import reload_the_page @step('I have set "show captions" to (.*)$') def set_show_captions(step, setting): + # Prevent cookies from overriding course settings + world.browser.cookies.delete('hide_captions') + world.css_click('a.edit-button') world.wait_for(lambda _driver: world.css_visible('a.save-button')) world.browser.select('Show Captions', setting) world.css_click('a.save-button') -@step('when I view the (video.*) it (.*) show the captions$') -def shows_captions(_step, video_type, show_captions): - # Prevent cookies from overriding course settings - world.browser.cookies.delete('hide_captions') +@step('when I view the video it (.*) show the captions$') +def shows_captions(_step, show_captions): if show_captions == 'does not': - assert world.css_has_class('.%s' % video_type, 'closed') + assert world.is_css_present('div.video.closed') else: - assert world.is_css_not_present('.%s.closed' % video_type) + assert world.is_css_not_present('div.video.closed') @step('I see the correct video settings and default values$') diff --git a/cms/djangoapps/contentstore/features/video.feature b/cms/djangoapps/contentstore/features/video.feature index d2f9915f55..a6a4cec28b 100644 --- a/cms/djangoapps/contentstore/features/video.feature +++ b/cms/djangoapps/contentstore/features/video.feature @@ -13,20 +13,20 @@ Feature: Video Component # Sauce Labs cannot delete cookies @skip_sauce Scenario: Captions are hidden correctly - Given I have created a Video component + Given I have created a Video component with subtitles And I have hidden captions Then when I view the video it does not show the captions # Sauce Labs cannot delete cookies @skip_sauce Scenario: Captions are shown correctly - Given I have created a Video component + Given I have created a Video component with subtitles Then when I view the video it does show the captions # Sauce Labs cannot delete cookies @skip_sauce Scenario: Captions are toggled correctly - Given I have created a Video component + Given I have created a Video component with subtitles And I have toggled captions 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 afa9953c90..5a5d99e4d3 100644 --- a/cms/djangoapps/contentstore/features/video.py +++ b/cms/djangoapps/contentstore/features/video.py @@ -8,7 +8,6 @@ from contentstore.utils import get_modulestore ############### ACTIONS #################### - @step('I have created a Video component$') def i_created_a_video_component(step): world.create_component_instance( @@ -19,6 +18,26 @@ def i_created_a_video_component(step): ) +@step('I have created a Video component with subtitles$') +def i_created_a_video_component(step): + step.given('I have created a Video component') + + # Store the current URL so we can return here + video_url = world.browser.url + + # Upload subtitles for the video using the upload interface + step.given('I have uploaded subtitles') + + # Return to the video + world.visit(video_url) + + +@step('I have uploaded subtitles') +def i_have_uploaded_subtitles(step): + step.given('I go to the files and uploads page') + step.given('I upload the file "subs_OEoXaMPEzfM.srt.sjson"') + + @step('when I view the (.*) it does not have autoplay enabled$') def does_not_autoplay(_step, video_type): assert world.css_find('.%s' % video_type)[0]['data-autoplay'] == 'False' diff --git a/common/test/data/uploads/subs_OEoXaMPEzfM.srt.sjson b/common/test/data/uploads/subs_OEoXaMPEzfM.srt.sjson new file mode 100644 index 0000000000..3064722117 --- /dev/null +++ b/common/test/data/uploads/subs_OEoXaMPEzfM.srt.sjson @@ -0,0 +1,143 @@ +{ + "start": [ + 270, + 2720, + 5430, + 7160, + 10830, + 12880, + 15890, + 19000, + 22070, + 25170, + 27890, + 30590, + 32920, + 36360, + 39630, + 41170, + 42790, + 44590, + 47320, + 50250, + 51880, + 54320, + 57410, + 59160, + 62320, + 65099, + 68430, + 71360, + 73640, + 76580, + 78660, + 81480, + 83940, + 86230, + 88570, + 90520, + 93430, + 95940, + 99090, + 100910, + 103740, + 105610, + 108310, + 111100, + 112360 + ], + "end": [ + 2720, + 5430, + 7160, + 10830, + 12880, + 15890, + 19000, + 22070, + 25170, + 27890, + 30590, + 32920, + 36360, + 39630, + 41170, + 42790, + 44590, + 47320, + 50250, + 51880, + 54320, + 57410, + 59160, + 62320, + 65099, + 68430, + 71360, + 73640, + 76580, + 78660, + 81480, + 83940, + 86230, + 88570, + 90520, + 93430, + 95940, + 99090, + 100910, + 103740, + 105610, + 108310, + 111100, + 112360, + 114220 + ], + "text": [ + "LILA FISHER: Hi, welcome to Edx.", + "I'm Lila Fisher, an Edx fellow helping to put", + "together these courses.", + "As you know, our courses are entirely online.", + "So before we start learning about the subjects that", + "brought you here, let's learn about the tools that you will", + "use to navigate through the course material.", + "Let's start with what is on your screen right now.", + "You are watching a video of me talking.", + "You have several tools associated with these videos.", + "Some of them are standard video buttons, like the play", + "Pause Button on the bottom left.", + "Like most video players, you can see how far you are into", + "this particular video segment and how long the entire video", + "segment is.", + "Something that you might not be used to", + "is the speed option.", + "While you are going through the videos, you can speed up", + "or slow down the video player with these buttons.", + "Go ahead and try that now.", + "Make me talk faster and slower.", + "If you ever get frustrated by the pace of speech, you can", + "adjust it this way.", + "Another great feature is the transcript on the side.", + "This will follow along with everything that I am saying as", + "I am saying it, so you can read along if you like.", + "You can also click on any of the words, and you will notice", + "that the video jumps to that word.", + "The video slider at the bottom of the video will let you", + "navigate through the video quickly.", + "If you ever find the transcript distracting, you", + "can toggle the captioning button in order to make it go", + "away or reappear.", + "Now that you know about the video player, I want to point", + "out the sequence navigator.", + "Right now you're in a lecture sequence, which interweaves", + "many videos and practice exercises.", + "You can see how far you are in a particular sequence by", + "observing which tab you're on.", + "You can navigate directly to any video or exercise by", + "clicking on the appropriate tab.", + "You can also progress to the next element by pressing the", + "Arrow button, or by clicking on the next tab.", + "Try that now.", + "The tutorial will continue in the next video." + ] +} \ No newline at end of file