From e0d5118ca083700889c51a42d7ca9405643b0fe6 Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Wed, 29 May 2013 15:45:36 -0400 Subject: [PATCH 01/13] Add hidden HTML so that the video player knows whether or not we're in the LMS. --- common/lib/xmodule/xmodule/video_module.py | 3 ++- lms/templates/video.html | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/video_module.py b/common/lib/xmodule/xmodule/video_module.py index f902a9665b..ddc91392b9 100644 --- a/common/lib/xmodule/xmodule/video_module.py +++ b/common/lib/xmodule/xmodule/video_module.py @@ -139,7 +139,8 @@ class VideoModule(VideoFields, XModule): 'show_captions': self.show_captions, 'start': self.start_time, 'end': self.end_time, - 'normal_speed_video_id': normal_speed_video_id + 'normal_speed_video_id': normal_speed_video_id, + 'in_lms': True if self.system.course_id is not None else False }) diff --git a/lms/templates/video.html b/lms/templates/video.html index 24785abf72..558c7acec2 100644 --- a/lms/templates/video.html +++ b/lms/templates/video.html @@ -39,3 +39,9 @@

Download subtitles here.

% endif + +%if in_lms: + +%else: + +%endif From 0332d22a0281e78835c6c8e1541a9a21a8d35f4c Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Wed, 29 May 2013 15:52:42 -0400 Subject: [PATCH 02/13] Prevent autoplaying of videos in Studio. --- .../xmodule/xmodule/js/src/video/display/video_player.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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..f02386dc43 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 $('#in_lms').hasClass('false') $('.video-load-complete:first').data('video').player.play() onStateChange: (event) => From 81d3aa14641c94e9bbacf53432523690bc3c12f8 Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Wed, 29 May 2013 16:00:43 -0400 Subject: [PATCH 03/13] Use `self.system.debug` instead of `self.system.course_id`; this seems less hacky. --- common/lib/xmodule/xmodule/video_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/video_module.py b/common/lib/xmodule/xmodule/video_module.py index ddc91392b9..7d5d765fb3 100644 --- a/common/lib/xmodule/xmodule/video_module.py +++ b/common/lib/xmodule/xmodule/video_module.py @@ -140,7 +140,7 @@ class VideoModule(VideoFields, XModule): 'start': self.start_time, 'end': self.end_time, 'normal_speed_video_id': normal_speed_video_id, - 'in_lms': True if self.system.course_id is not None else False + 'in_lms': self.system.debug }) From 3bfe3de679402e3c8176b9215e8eee42fecec375 Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Wed, 29 May 2013 16:07:36 -0400 Subject: [PATCH 04/13] Do autoplay in lms, not in cms. --- common/lib/xmodule/xmodule/video_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/video_module.py b/common/lib/xmodule/xmodule/video_module.py index 7d5d765fb3..9e2ca892e2 100644 --- a/common/lib/xmodule/xmodule/video_module.py +++ b/common/lib/xmodule/xmodule/video_module.py @@ -140,7 +140,7 @@ class VideoModule(VideoFields, XModule): 'start': self.start_time, 'end': self.end_time, 'normal_speed_video_id': normal_speed_video_id, - 'in_lms': self.system.debug + 'in_lms': not self.system.debug }) From 5465bda5f3e10efbcd59bb451e5ca2c84860c38a Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Wed, 29 May 2013 17:00:25 -0400 Subject: [PATCH 05/13] Use MITX_FEATURES to tell if we're in the CMS; this is much cleaner. Also use $.data instead of a hidden div. --- cms/envs/common.py | 5 ++++- .../xmodule/js/src/video/display/video_player.coffee | 2 +- common/lib/xmodule/xmodule/video_module.py | 3 +-- lms/templates/video.html | 8 +------- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/cms/envs/common.py b/cms/envs/common.py index 90e15186d7..3f322b5001 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, + + # We're in the CMS. + 'IN_CMS': True } ENABLE_JASMINE = False 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 f02386dc43..47f822bd92 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() or $('#in_lms').hasClass('false') + unless onTouchBasedDevice() or $('.video:first').data('in-cms') $('.video-load-complete:first').data('video').player.play() onStateChange: (event) => diff --git a/common/lib/xmodule/xmodule/video_module.py b/common/lib/xmodule/xmodule/video_module.py index 9e2ca892e2..f902a9665b 100644 --- a/common/lib/xmodule/xmodule/video_module.py +++ b/common/lib/xmodule/xmodule/video_module.py @@ -139,8 +139,7 @@ class VideoModule(VideoFields, XModule): 'show_captions': self.show_captions, 'start': self.start_time, 'end': self.end_time, - 'normal_speed_video_id': normal_speed_video_id, - 'in_lms': not self.system.debug + 'normal_speed_video_id': normal_speed_video_id }) diff --git a/lms/templates/video.html b/lms/templates/video.html index 558c7acec2..0bbcf046cd 100644 --- a/lms/templates/video.html +++ b/lms/templates/video.html @@ -16,7 +16,7 @@ width="640" height="390"> %else: -
+
@@ -39,9 +39,3 @@

Download subtitles here.

% endif - -%if in_lms: - -%else: - -%endif From 6eeb12ad1c61eb5a8a35b03a3d00bc245a0c84ed Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Thu, 30 May 2013 11:32:40 -0400 Subject: [PATCH 06/13] Add Lettuce tests for autoplay in Studio. --- .../contentstore/features/common.py | 9 ++++++ .../features/component_settings_editor.py | 32 +++++++++++++++++++ .../contentstore/features/video.feature | 6 ++++ cms/djangoapps/contentstore/features/video.py | 14 ++++++++ cms/envs/common.py | 4 +-- cms/templates/unit.html | 8 ++--- .../js/src/video/display/video_player.coffee | 2 +- lms/envs/common.py | 5 ++- lms/templates/video.html | 2 +- 9 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 cms/djangoapps/contentstore/features/component_settings_editor.py create mode 100644 cms/djangoapps/contentstore/features/video.feature create mode 100644 cms/djangoapps/contentstore/features/video.py 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:
  • - + ${name}
  • % else:
  • - + ${name}
  • @@ -106,14 +106,14 @@ % if not has_markdown: % if is_empty:
  • - + ${name}
  • % else:
  • - + ${name} 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 47f822bd92..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() or $('.video:first').data('in-cms') + unless onTouchBasedDevice() or $('.video:first').data('autoplay') == 'False' $('.video-load-complete:first').data('video').player.play() onStateChange: (event) => 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 0bbcf046cd..2a864b2f18 100644 --- a/lms/templates/video.html +++ b/lms/templates/video.html @@ -16,7 +16,7 @@ width="640" height="390"> %else: -
    +
    From 1ead857792824fd0d6d80d12d746d6f0ea92ea46 Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Thu, 30 May 2013 15:01:23 -0400 Subject: [PATCH 07/13] Working on Lettuce tests for video in LMS. In progress, committing for the great git history rewrite. --- cms/djangoapps/contentstore/features/video.py | 1 - .../courseware/features/video.feature | 6 ++++ lms/djangoapps/courseware/features/video.py | 31 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 lms/djangoapps/courseware/features/video.feature create mode 100644 lms/djangoapps/courseware/features/video.py diff --git a/cms/djangoapps/contentstore/features/video.py b/cms/djangoapps/contentstore/features/video.py index 2e5ab0f6ed..27a938798a 100644 --- a/cms/djangoapps/contentstore/features/video.py +++ b/cms/djangoapps/contentstore/features/video.py @@ -3,7 +3,6 @@ from lettuce import world, step from common import * -from nose.tools import assert_equal ############### ACTIONS #################### diff --git a/lms/djangoapps/courseware/features/video.feature b/lms/djangoapps/courseware/features/video.feature new file mode 100644 index 0000000000..5fbd338941 --- /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 it it does autoplay \ No newline at end of file diff --git a/lms/djangoapps/courseware/features/video.py b/lms/djangoapps/courseware/features/video.py new file mode 100644 index 0000000000..4aa1a399c9 --- /dev/null +++ b/lms/djangoapps/courseware/features/video.py @@ -0,0 +1,31 @@ +#pylint: disable=C0111 +#pylint: disable=W0621 + +from lettuce import world, step +from common import * + +############### ACTIONS #################### + + +@step('when I view it it does autoplay') +def does_autoplay(step): + assert world.css_find('.video')[0]['data-autoplay'] == 'True' + assert world.css_find('.video_control')[0].has_class('pause') + +@step('the course has a Video component') +def view_video(step): + model_course = 'model_course' + coursename = TEST_COURSE_NAME.replace(' ', '_') + i_am_registered_for_the_course(step, coursename) + # Make sure we have a video + video = create_video_component(coursename) + url = django_url('/courses/edx/%s/Test_Course/courseware/' % model_course) + world.browser.visit(url) + print('\n\n\n') + print world.browser.html + print('\n\n\n') + + +def create_video_component(course): + return world.ItemFactory.create(parent_location=section_location(course), + template='i4x://edx/templates/video/default') From 782cb054100500acb2703304a2b909b9e1bf40ac Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Fri, 31 May 2013 11:22:45 -0400 Subject: [PATCH 08/13] Add passing Lettuce testing for video autoplay in LMS. --- .../contentstore/features/common.py | 16 ++++++------ ...y => component_settings_editor_helpers.py} | 13 ++++------ lms/djangoapps/courseware/features/video.py | 25 +++++++++++-------- lms/templates/video.html | 20 +++++++++++++-- lms/templates/videoalpha.html | 17 ++++++++++++- 5 files changed, 60 insertions(+), 31 deletions(-) rename cms/djangoapps/contentstore/features/{component_settings_editor.py => component_settings_editor_helpers.py} (76%) diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index 95938242ca..96b840ae96 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -5,8 +5,6 @@ from lettuce import world, step from nose.tools import assert_true from nose.tools import assert_equal -from xmodule.modulestore.django import _MODULESTORES, modulestore -from xmodule.templates import update_templates from auth.authz import get_user_by_email from selenium.webdriver.common.keys import Keys @@ -50,31 +48,31 @@ def i_press_the_category_delete_icon(step, category): @step('I have opened a new course in Studio$') def i_have_opened_a_new_course(step): + open_new_course() + + +####### HELPER FUNCTIONS ############## +def open_new_course(): world.clear_courses() log_into_studio() create_a_course() -####### HELPER FUNCTIONS ############## def create_studio_user( uname='robot', email='robot+studio@edx.org', password='test', is_staff=False): - studio_user = world.UserFactory.build( + studio_user = world.UserFactory( username=uname, email=email, password=password, is_staff=is_staff) - studio_user.set_password(password) - studio_user.save() registration = world.RegistrationFactory(user=studio_user) registration.register(studio_user) registration.activate() - user_profile = world.UserProfileFactory(user=studio_user) - def fill_in_course_info( name='Robot Super Course', @@ -153,7 +151,7 @@ def set_date_and_time(date_css, desired_date, time_css, desired_time): world.css_fill(time_css, desired_time) e = world.css_find(time_css).first e._element.send_keys(Keys.TAB) - time.sleep(float(1)) + time.sleep(float(1)) @step('I have created a Video component$') diff --git a/cms/djangoapps/contentstore/features/component_settings_editor.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py similarity index 76% rename from cms/djangoapps/contentstore/features/component_settings_editor.py rename to cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index 0a4e761fbd..a2710a19cd 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -1,10 +1,9 @@ +# disable missing docstring #pylint: disable=C0111 -#pylint: disable=W0621 from lettuce import world from nose.tools import assert_equal - -import time +from terrain.steps import reload_the_page @world.absorb @@ -24,9 +23,7 @@ def click_new_component_button(step, 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() + elem_css = "a[data-location='%s']" % instance_id + assert_equal(1, len(world.css_find(elem_css))) + world.css_click(elem_css) assert_equal(1, len(world.css_find(expected_css))) diff --git a/lms/djangoapps/courseware/features/video.py b/lms/djangoapps/courseware/features/video.py index 4aa1a399c9..982e75afd7 100644 --- a/lms/djangoapps/courseware/features/video.py +++ b/lms/djangoapps/courseware/features/video.py @@ -9,23 +9,26 @@ from common import * @step('when I view it it does autoplay') def does_autoplay(step): - assert world.css_find('.video')[0]['data-autoplay'] == 'True' - assert world.css_find('.video_control')[0].has_class('pause') + assert(world.css_find('.video')[0]['data-autoplay'] == 'True') + @step('the course has a Video component') def view_video(step): - model_course = 'model_course' coursename = TEST_COURSE_NAME.replace(' ', '_') i_am_registered_for_the_course(step, coursename) + # Make sure we have a video - video = create_video_component(coursename) - url = django_url('/courses/edx/%s/Test_Course/courseware/' % model_course) + 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) - print('\n\n\n') - print world.browser.html - print('\n\n\n') -def create_video_component(course): - return world.ItemFactory.create(parent_location=section_location(course), - template='i4x://edx/templates/video/default') +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/templates/video.html b/lms/templates/video.html index 2a864b2f18..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']: -
    - +
    +
    +
    +
    +
    +
      +
    • +
    • +
      0:00 / 0:00
      +
    • +
    + +
    +
    +
    +
    %elif settings.MITX_FEATURES.get('USE_YOUTUBE_OBJECT_API') and normal_speed_video_id: +
    +
    +
    +
    +
      +
    • +
    • +
      0:00 / 0:00
      +
    • +
    + +
    +
    +
    %else:
    Date: Fri, 31 May 2013 11:58:05 -0400 Subject: [PATCH 09/13] Remove unnecessary suppression. --- cms/djangoapps/contentstore/features/video.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cms/djangoapps/contentstore/features/video.py b/cms/djangoapps/contentstore/features/video.py index 27a938798a..e408809754 100644 --- a/cms/djangoapps/contentstore/features/video.py +++ b/cms/djangoapps/contentstore/features/video.py @@ -1,5 +1,4 @@ #pylint: disable=C0111 -#pylint: disable=W0621 from lettuce import world, step from common import * From 453bf421339bf92884cc00124d2f44cdfaa041e4 Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Fri, 31 May 2013 12:12:14 -0400 Subject: [PATCH 10/13] Revert changes to how video_alpha is stubbed out for testing. --- lms/templates/videoalpha.html | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/lms/templates/videoalpha.html b/lms/templates/videoalpha.html index c6c22abdcb..2028d3c320 100644 --- a/lms/templates/videoalpha.html +++ b/lms/templates/videoalpha.html @@ -3,22 +3,7 @@ % endif %if settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']: -
    -
    -
    -
    -
      -
    • -
    • -
      0:00 / 0:00
      -
    • -
    - -
    -
    -
    +
    %else:
    Date: Fri, 31 May 2013 12:16:25 -0400 Subject: [PATCH 11/13] Remove unnecessary pylint warning disable. --- lms/djangoapps/courseware/features/video.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lms/djangoapps/courseware/features/video.py b/lms/djangoapps/courseware/features/video.py index 982e75afd7..75e60e5a45 100644 --- a/lms/djangoapps/courseware/features/video.py +++ b/lms/djangoapps/courseware/features/video.py @@ -1,5 +1,4 @@ #pylint: disable=C0111 -#pylint: disable=W0621 from lettuce import world, step from common import * From 2277c82efdc456e5873987eabac88810b2cece5b Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Fri, 31 May 2013 12:54:09 -0400 Subject: [PATCH 12/13] Fix pep8 whitespace violation. --- lms/djangoapps/courseware/features/video.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/courseware/features/video.py b/lms/djangoapps/courseware/features/video.py index 75e60e5a45..5af6375b7a 100644 --- a/lms/djangoapps/courseware/features/video.py +++ b/lms/djangoapps/courseware/features/video.py @@ -15,14 +15,14 @@ def does_autoplay(step): def view_video(step): coursename = TEST_COURSE_NAME.replace(' ', '_') i_am_registered_for_the_course(step, coursename) - + # Make sure we have a video 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) From 5434f2750e9ad6c0c2a41f5c3da56438774d88ae Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Fri, 31 May 2013 15:58:12 -0400 Subject: [PATCH 13/13] Cleaning up code to fix pylint/pep8 errors. --- cms/djangoapps/contentstore/features/video.feature | 2 +- cms/djangoapps/contentstore/features/video.py | 3 +-- lms/djangoapps/courseware/features/common.py | 2 +- lms/djangoapps/courseware/features/video.feature | 2 +- lms/djangoapps/courseware/features/video.py | 7 ++++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cms/djangoapps/contentstore/features/video.feature b/cms/djangoapps/contentstore/features/video.feature index 31fb01814c..a4cf84d978 100644 --- a/cms/djangoapps/contentstore/features/video.feature +++ b/cms/djangoapps/contentstore/features/video.feature @@ -3,4 +3,4 @@ Feature: Video Component 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 + 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 index e408809754..f25b8d6d7e 100644 --- a/cms/djangoapps/contentstore/features/video.py +++ b/cms/djangoapps/contentstore/features/video.py @@ -1,12 +1,11 @@ #pylint: disable=C0111 from lettuce import world, step -from common import * ############### ACTIONS #################### -@step('when I view it it does not autoplay') +@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/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 index 5fbd338941..c4d96f93f7 100644 --- a/lms/djangoapps/courseware/features/video.feature +++ b/lms/djangoapps/courseware/features/video.feature @@ -3,4 +3,4 @@ Feature: Video component Scenario: Autoplay is enabled in LMS Given the course has a Video component - Then when I view it it does autoplay \ No newline at end of file + 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 index 5af6375b7a..9930489d4b 100644 --- a/lms/djangoapps/courseware/features/video.py +++ b/lms/djangoapps/courseware/features/video.py @@ -1,12 +1,13 @@ #pylint: disable=C0111 from lettuce import world, step -from common import * +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 it it does autoplay') +@step('when I view the video it has autoplay enabled') def does_autoplay(step): assert(world.css_find('.video')[0]['data-autoplay'] == 'True') @@ -17,7 +18,7 @@ def view_video(step): i_am_registered_for_the_course(step, coursename) # Make sure we have a video - video = add_video_to_course(coursename) + 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' %