From f317244ac4e5f9e7f8cc58e462484a4455fb2f2f Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Fri, 19 Jul 2013 11:47:28 -0400 Subject: [PATCH] Convert Video Alpha to metadata-only. --- CHANGELOG.rst | 3 + .../contentstore/features/common.py | 20 + .../features/videoalpha-editor.feature | 25 ++ .../features/videoalpha-editor.py | 18 + .../contentstore/features/videoalpha.feature | 6 + .../contentstore/features/videoalpha.py | 10 + cms/templates/widgets/tabs-aggregator.html | 2 +- .../widgets/tabs/metadata-edit-tab.html | 4 + .../xmodule/xmodule/tests/test_videoalpha.py | 332 +++++++++++++++-- .../lib/xmodule/xmodule/videoalpha_module.py | 345 +++++++++++++----- lms/djangoapps/courseware/tests/__init__.py | 6 +- .../courseware/tests/test_videoalpha_mongo.py | 69 ++-- .../courseware/tests/test_videoalpha_xml.py | 87 ++--- 13 files changed, 727 insertions(+), 200 deletions(-) create mode 100644 cms/djangoapps/contentstore/features/videoalpha-editor.feature create mode 100644 cms/djangoapps/contentstore/features/videoalpha-editor.py create mode 100644 cms/djangoapps/contentstore/features/videoalpha.feature create mode 100644 cms/djangoapps/contentstore/features/videoalpha.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cba3d2dbf8..9de2890c37 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -42,6 +42,9 @@ Common: Add a manage.py that knows about edx-platform specific settings and proj Common: Added *experimental* support for jsinput type. +Studio: Remove XML from HTML5 video component editor. All settings are +moved to be edited as metadata. + Common: Added setting to specify Celery Broker vhost Common: Utilize new XBlock bulk save API in LMS and CMS. diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index 8b23bc3635..30ee0518c1 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -228,6 +228,26 @@ def i_created_a_video_component(step): ) +@step('I have created a Video Alpha component$') +def i_created_video_alpha(step): + step.given('I have enabled the videoalpha advanced module') + world.css_click('a.course-link') + step.given('I have added a new subsection') + step.given('I expand the first section') + world.css_click('a.new-unit-item') + world.css_click('.large-advanced-icon') + world.click_component_from_menu('videoalpha', None, '.xmodule_VideoAlphaModule') + + +@step('I have enabled the (.*) advanced module$') +def i_enabled_the_advanced_module(step, module): + step.given('I have opened a new course section in Studio') + world.css_click('.nav-course-settings') + world.css_click('.nav-course-settings-advanced') + type_in_codemirror(0, '["%s"]' % module) + press_the_notification_button(step, 'Save') + + @step('I have clicked the new unit button') def open_new_unit(step): step.given('I have opened a new course section in Studio') diff --git a/cms/djangoapps/contentstore/features/videoalpha-editor.feature b/cms/djangoapps/contentstore/features/videoalpha-editor.feature new file mode 100644 index 0000000000..6021772c1c --- /dev/null +++ b/cms/djangoapps/contentstore/features/videoalpha-editor.feature @@ -0,0 +1,25 @@ +Feature: Video Alpha Component Editor + As a course author, I want to be able to create videoalpha components. + + Scenario: User can view metadata + Given I have created a Video Alpha component + And I edit and select Settings + Then I see the correct videoalpha settings and default values + + Scenario: User can modify display name + Given I have created a Video Alpha component + And I edit and select Settings + Then I can modify the display name + And my display name change is persisted on save + + @skip + 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 + + @skip + 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/videoalpha-editor.py b/cms/djangoapps/contentstore/features/videoalpha-editor.py new file mode 100644 index 0000000000..2d882d2fda --- /dev/null +++ b/cms/djangoapps/contentstore/features/videoalpha-editor.py @@ -0,0 +1,18 @@ +# disable missing docstring +# pylint: disable=C0111 + +from lettuce import world, step + + +@step('I see the correct videoalpha settings and default values$') +def correct_videoalpha_settings(_step): + world.verify_all_setting_entries([['Default Speed', '', False], + ['Display Name', 'Video Alpha', False], + ['Download Track', '', False], + ['Download Video', '', False], + ['HTML5 Subtitles', '', False], + ['Show Captions', 'True', False], + ['Speed: .75x', '', False], + ['Speed: 1.25x', '', False], + ['Speed: 1.5x', '', False], + ['Video Sources', '', False]]) diff --git a/cms/djangoapps/contentstore/features/videoalpha.feature b/cms/djangoapps/contentstore/features/videoalpha.feature new file mode 100644 index 0000000000..58f32da68b --- /dev/null +++ b/cms/djangoapps/contentstore/features/videoalpha.feature @@ -0,0 +1,6 @@ +Feature: Video Alpha Component + As a course author, I want to be able to view my created videos in Studio. + + Scenario: Autoplay is disabled in Studio + Given I have created a Video Alpha component + Then when I view the video alpha it does not have autoplay enabled diff --git a/cms/djangoapps/contentstore/features/videoalpha.py b/cms/djangoapps/contentstore/features/videoalpha.py new file mode 100644 index 0000000000..f95284a00a --- /dev/null +++ b/cms/djangoapps/contentstore/features/videoalpha.py @@ -0,0 +1,10 @@ +# disable missing docstring +# pylint: disable=C0111 + +from lettuce import world, step + + +@step('when I view the video alpha it does not have autoplay enabled') +def does_not_autoplay(_step): + assert world.css_find('.videoalpha')[0]['data-autoplay'] == 'False' + assert world.css_has_class('.video_control', 'play') diff --git a/cms/templates/widgets/tabs-aggregator.html b/cms/templates/widgets/tabs-aggregator.html index d5953005b5..02c34d4dc1 100644 --- a/cms/templates/widgets/tabs-aggregator.html +++ b/cms/templates/widgets/tabs-aggregator.html @@ -9,7 +9,7 @@ % endfor -
+
% for tab in tabs:
<%include file="${tab['template']}" args="tabName=tab['name']"/> diff --git a/cms/templates/widgets/tabs/metadata-edit-tab.html b/cms/templates/widgets/tabs/metadata-edit-tab.html index 4fc8314afd..0caf9d2078 100644 --- a/cms/templates/widgets/tabs/metadata-edit-tab.html +++ b/cms/templates/widgets/tabs/metadata-edit-tab.html @@ -20,5 +20,9 @@ <%static:include path="js/metadata-option-entry.underscore" /> + +