diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index afb38c3f9e..95938242ca 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -154,3 +154,12 @@ def set_date_and_time(date_css, desired_date, time_css, desired_time): e = world.css_find(time_css).first e._element.send_keys(Keys.TAB) time.sleep(float(1)) + + +@step('I have created a Video component$') +def i_created_a_video_component(step): + world.create_component_instance( + step, '.large-video-icon', + 'i4x://edx/templates/video/default', + '.xmodule_VideoModule' + ) diff --git a/cms/djangoapps/contentstore/features/component_settings_editor.py b/cms/djangoapps/contentstore/features/component_settings_editor.py new file mode 100644 index 0000000000..0a4e761fbd --- /dev/null +++ b/cms/djangoapps/contentstore/features/component_settings_editor.py @@ -0,0 +1,32 @@ +#pylint: disable=C0111 +#pylint: disable=W0621 + +from lettuce import world +from nose.tools import assert_equal + +import time + + +@world.absorb +def create_component_instance(step, component_button_css, instance_id, expected_css): + click_new_component_button(step, component_button_css) + click_component_from_menu(instance_id, expected_css) + + +@world.absorb +def click_new_component_button(step, component_button_css): + step.given('I have opened a new course section in Studio') + 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(component_button_css) + + +@world.absorb +def click_component_from_menu(instance_id, expected_css): + new_instance = world.browser.find_by_id(instance_id) + assert_equal(1, len(new_instance)) + # TODO: why is this sleep necessary? + time.sleep(float(1)) + new_instance[0].click() + assert_equal(1, len(world.css_find(expected_css))) diff --git a/cms/djangoapps/contentstore/features/video.feature b/cms/djangoapps/contentstore/features/video.feature new file mode 100644 index 0000000000..31fb01814c --- /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 it it does not autoplay \ No newline at end of file diff --git a/cms/djangoapps/contentstore/features/video.py b/cms/djangoapps/contentstore/features/video.py new file mode 100644 index 0000000000..2e5ab0f6ed --- /dev/null +++ b/cms/djangoapps/contentstore/features/video.py @@ -0,0 +1,14 @@ +#pylint: disable=C0111 +#pylint: disable=W0621 + +from lettuce import world, step +from common import * +from nose.tools import assert_equal + +############### ACTIONS #################### + + +@step('when I view it it does not autoplay') +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 3f322b5001..6a1f1bf0af 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -42,8 +42,8 @@ MITX_FEATURES = { # Enable URL that shows information about the status of various services 'ENABLE_SERVICE_STATUS': False, - # We're in the CMS. - 'IN_CMS': True + # 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 cb34f42a09..f6540fa1e5 100644 --- a/cms/templates/unit.html +++ b/cms/templates/unit.html @@ -82,14 +82,14 @@ % if has_markdown or type != "problem": % if is_empty: