From de1381dbfc356e6dca34872d32d098af1fae975b Mon Sep 17 00:00:00 2001 From: Valera Rozuvan Date: Wed, 2 Oct 2013 15:41:23 +0300 Subject: [PATCH] Added acceptance tests. --- .../contentstore/features/video.feature | 22 +++++++++++++++ cms/djangoapps/contentstore/features/video.py | 27 +++++++++++++++++++ .../courseware/features/video.feature | 7 +++++ 3 files changed, 56 insertions(+) diff --git a/cms/djangoapps/contentstore/features/video.feature b/cms/djangoapps/contentstore/features/video.feature index 105a26c868..940ca30c94 100644 --- a/cms/djangoapps/contentstore/features/video.feature +++ b/cms/djangoapps/contentstore/features/video.feature @@ -2,15 +2,18 @@ Feature: CMS.Video Component As a course author, I want to be able to view my created videos in Studio. + # 1 # Video Alpha Features will work in Firefox only when Firefox is the active window Scenario: Autoplay is disabled in Studio Given I have created a Video component Then when I view the video it does not have autoplay enabled + # 2 Scenario: Creating a video takes a single click Given I have clicked the new unit button Then creating a video takes a single click + # 3 # Sauce Labs cannot delete cookies @skip_sauce Scenario: Captions are hidden correctly @@ -18,12 +21,14 @@ Feature: CMS.Video Component And I have hidden captions Then when I view the video it does not show the captions + # 4 # Sauce Labs cannot delete cookies @skip_sauce Scenario: Captions are shown correctly Given I have created a Video component with subtitles Then when I view the video it does show the captions + # 5 # Sauce Labs cannot delete cookies @skip_sauce Scenario: Captions are toggled correctly @@ -31,7 +36,24 @@ Feature: CMS.Video Component And I have toggled captions Then when I view the video it does show the captions + # 6 Scenario: Video data is shown correctly Given I have created a video with only XML data And I reload the page Then the correct Youtube video is shown + + # 7 + Scenario: Closed captions become visible when the mouse hovers over CC button + Given I have created a Video component with subtitles + And Make sure captions are closed + Then Captions become invisible + And Hover over CC button + Then Captions become visible + + # 8 + Scenario: Open captions never become invisible + Given I have created a Video component with subtitles + And Make sure captions are open + Then Captions become visible + And Hover over CC button + Then Captions become visible diff --git a/cms/djangoapps/contentstore/features/video.py b/cms/djangoapps/contentstore/features/video.py index 20db375184..022a99af52 100644 --- a/cms/djangoapps/contentstore/features/video.py +++ b/cms/djangoapps/contentstore/features/video.py @@ -115,3 +115,30 @@ def the_youtube_video_is_shown(_step): world.wait_for_xmodule() ele = world.css_find('.video').first assert ele['data-streams'].split(':')[1] == world.scenario_dict['YOUTUBE_ID'] + + +@step('Make sure captions are (.+)$') +def make_sure_captions_are_closed(_step, captions_state): + if captions_state == 'closed': + if world.css_visible('.subtitles'): + world.browser.find_by_css('.hide-subtitles').click() + else: + if not world.css_visible('.subtitles'): + world.browser.find_by_css('.hide-subtitles').click() + + +@step('Hover over CC button$') +def hover_over_cc_button(_step): + world.browser.find_by_css('.hide-subtitles').mouse_over() + + +@step('Captions become (.+)$') +def captions_become_visible(_step, visibility_state): + # Captions become invisible by fading out. We must wait. + world.wait(2) + + if visibility_state == 'visible': + assert world.css_visible('.subtitles') + else: + assert not world.css_visible('.subtitles') + diff --git a/lms/djangoapps/courseware/features/video.feature b/lms/djangoapps/courseware/features/video.feature index 001481a6a5..7518bf6bdb 100644 --- a/lms/djangoapps/courseware/features/video.feature +++ b/lms/djangoapps/courseware/features/video.feature @@ -2,38 +2,45 @@ Feature: LMS.Video component As a student, I want to view course videos in LMS. + # 1 Scenario: Video component is fully rendered in the LMS in HTML5 mode Given the course has a Video component in HTML5 mode Then when I view the video it has rendered in HTML5 mode And all sources are correct + # 2 # Firefox doesn't have HTML5 (only mp4 - fix here) @skip_firefox Scenario: Autoplay is disabled in LMS for a Video component Given the course has a Video component in HTML5 mode Then when I view the video it does not have autoplay enabled + # 3 # Youtube testing Scenario: Video component is fully rendered in the LMS in Youtube mode with HTML5 sources Given youtube server is up and response time is 0.4 seconds And the course has a Video component in Youtube_HTML5 mode Then when I view the video it has rendered in Youtube mode + # 4 Scenario: Video component is not rendered in the LMS in Youtube mode with HTML5 sources Given youtube server is up and response time is 2 seconds And the course has a Video component in Youtube_HTML5 mode Then when I view the video it has rendered in HTML5 mode + # 5 Scenario: Video component is rendered in the LMS in Youtube mode without HTML5 sources Given youtube server is up and response time is 2 seconds And the course has a Video component in Youtube mode Then when I view the video it has rendered in Youtube mode + # 6 Scenario: Video component is rendered in the LMS in Youtube mode with HTML5 sources that doesn't supported by browser Given youtube server is up and response time is 2 seconds And the course has a Video component in Youtube_HTML5_Unsupported_Video mode Then when I view the video it has rendered in Youtube mode + # 7 Scenario: Video component is rendered in the LMS in HTML5 mode with HTML5 sources that doesn't supported by browser Given the course has a Video component in HTML5_Unsupported_Video mode Then error message is shown