From 1ead857792824fd0d6d80d12d746d6f0ea92ea46 Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Thu, 30 May 2013 15:01:23 -0400 Subject: [PATCH] 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')