diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index ee684e53dc..4c674dc34c 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -28,7 +28,6 @@ def click_component_from_menu(instance_id, expected_css): world.css_click(elem_css) assert_equal(1, len(world.css_find(expected_css))) - @world.absorb def edit_component_and_select_settings(): world.css_click('a.edit-button') diff --git a/cms/djangoapps/contentstore/features/video.feature b/cms/djangoapps/contentstore/features/video.feature new file mode 100644 index 0000000000..a4cf84d978 --- /dev/null +++ b/cms/djangoapps/contentstore/features/video.feature @@ -0,0 +1,6 @@ +Feature: Video 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 component + Then when I view the video it does not have autoplay enabled diff --git a/cms/djangoapps/contentstore/features/video.py b/cms/djangoapps/contentstore/features/video.py new file mode 100644 index 0000000000..f25b8d6d7e --- /dev/null +++ b/cms/djangoapps/contentstore/features/video.py @@ -0,0 +1,11 @@ +#pylint: disable=C0111 + +from lettuce import world, step + +############### ACTIONS #################### + + +@step('when I view the video it does not have autoplay enabled') +def does_not_autoplay(step): + assert world.css_find('.video')[0]['data-autoplay'] == 'False' + assert world.css_find('.video_control')[0].has_class('play') diff --git a/cms/envs/common.py b/cms/envs/common.py index e60d337731..ed90572715 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -40,7 +40,10 @@ MITX_FEATURES = { 'SEGMENT_IO': True, # Enable URL that shows information about the status of various services - 'ENABLE_SERVICE_STATUS': False + 'ENABLE_SERVICE_STATUS': False, + + # Don't autoplay videos for course authors + 'AUTOPLAY_VIDEOS': False } ENABLE_JASMINE = False diff --git a/cms/templates/unit.html b/cms/templates/unit.html index 36d643325d..851e3da260 100644 --- a/cms/templates/unit.html +++ b/cms/templates/unit.html @@ -99,7 +99,6 @@ ${name} - % endif % endfor diff --git a/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee b/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee index 22308a5568..561ca07c8a 100644 --- a/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee +++ b/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee @@ -66,7 +66,7 @@ class @VideoPlayer extends Subview at: 'top center' onReady: (event) => - unless onTouchBasedDevice() + unless onTouchBasedDevice() or $('.video:first').data('autoplay') == 'False' $('.video-load-complete:first').data('video').player.play() onStateChange: (event) => diff --git a/lms/djangoapps/courseware/features/common.py b/lms/djangoapps/courseware/features/common.py index e81568ae4b..874ba0142a 100644 --- a/lms/djangoapps/courseware/features/common.py +++ b/lms/djangoapps/courseware/features/common.py @@ -20,7 +20,7 @@ logger = getLogger(__name__) TEST_COURSE_ORG = 'edx' TEST_COURSE_NAME = 'Test Course' -TEST_SECTION_NAME = "Problem" +TEST_SECTION_NAME = 'Test Section' @step(u'The course "([^"]*)" exists$') diff --git a/lms/djangoapps/courseware/features/video.feature b/lms/djangoapps/courseware/features/video.feature new file mode 100644 index 0000000000..c4d96f93f7 --- /dev/null +++ b/lms/djangoapps/courseware/features/video.feature @@ -0,0 +1,6 @@ +Feature: Video component + As a student, I want to view course videos in LMS. + + Scenario: Autoplay is enabled in LMS + Given the course has a Video component + Then when I view the video it has autoplay enabled diff --git a/lms/djangoapps/courseware/features/video.py b/lms/djangoapps/courseware/features/video.py new file mode 100644 index 0000000000..9930489d4b --- /dev/null +++ b/lms/djangoapps/courseware/features/video.py @@ -0,0 +1,34 @@ +#pylint: disable=C0111 + +from lettuce import world, step +from lettuce.django import django_url +from common import TEST_COURSE_NAME, TEST_SECTION_NAME, i_am_registered_for_the_course, section_location + +############### ACTIONS #################### + + +@step('when I view the video it has autoplay enabled') +def does_autoplay(step): + assert(world.css_find('.video')[0]['data-autoplay'] == 'True') + + +@step('the course has a Video component') +def view_video(step): + coursename = TEST_COURSE_NAME.replace(' ', '_') + i_am_registered_for_the_course(step, coursename) + + # Make sure we have a video + add_video_to_course(coursename) + chapter_name = TEST_SECTION_NAME.replace(" ", "_") + section_name = chapter_name + url = django_url('/courses/edx/Test_Course/Test_Course/courseware/%s/%s' % + (chapter_name, section_name)) + + world.browser.visit(url) + + +def add_video_to_course(course): + template_name = 'i4x://edx/templates/video/default' + world.ItemFactory.create(parent_location=section_location(course), + template=template_name, + display_name='Video') diff --git a/lms/envs/common.py b/lms/envs/common.py index e7bc9519d9..f75dcf8804 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -113,7 +113,10 @@ MITX_FEATURES = { 'ENABLE_SERVICE_STATUS': False, # Toggle to indicate use of a custom theme - 'USE_CUSTOM_THEME': False + 'USE_CUSTOM_THEME': False, + + # Do autoplay videos for students + 'AUTOPLAY_VIDEOS': True } # Used for A/B testing diff --git a/lms/templates/video.html b/lms/templates/video.html index 24785abf72..267372176a 100644 --- a/lms/templates/video.html +++ b/lms/templates/video.html @@ -3,8 +3,24 @@ % endif %if settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']: -
- +