Add acceptance tests for checking rendering.
This commit is contained in:
@@ -39,9 +39,6 @@ MITX_FEATURES = {
|
||||
|
||||
'AUTH_USE_MIT_CERTIFICATES': False,
|
||||
|
||||
# do not display video when running automated acceptance tests
|
||||
'STUB_VIDEO_FOR_TESTING': False,
|
||||
|
||||
# email address for studio staff (eg to request course creation)
|
||||
'STUDIO_REQUEST_EMAIL': '',
|
||||
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
Feature: Video component
|
||||
As a student, I want to view course videos in LMS.
|
||||
|
||||
|
||||
Scenario: Video component is fully rendered in the LMS in HTML5 mode
|
||||
Given the course has a Video component in HTML5 mode
|
||||
Then when I view the video it has rendered in HTML5 mode
|
||||
And all sources are correct
|
||||
|
||||
Scenario: Video component is fully rendered in the LMS in Youtube mode
|
||||
Given the course has a Video component in Youtube mode
|
||||
Then when I view the video it has rendered in Youtube mode
|
||||
|
||||
Scenario: Autoplay is enabled in LMS for a Video component
|
||||
Given the course has a Video component
|
||||
Then when I view the video it has autoplay enabled
|
||||
Given the course has a Video component in HTML5 mode
|
||||
Then when I view the video it has autoplay enabled
|
||||
@@ -6,19 +6,24 @@ from common import i_am_registered_for_the_course, section_location
|
||||
|
||||
############### ACTIONS ####################
|
||||
|
||||
HTML5_SOURCES = [
|
||||
'https://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.mp4',
|
||||
'https://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.webm',
|
||||
'https://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.ogv'
|
||||
]
|
||||
|
||||
@step('when I view the (.*) it has autoplay enabled')
|
||||
def does_autoplay_video(_step, video_type):
|
||||
assert(world.css_find('.%s' % video_type)[0]['data-autoplay'] == 'True')
|
||||
|
||||
|
||||
@step('the course has a Video component')
|
||||
def view_video(_step):
|
||||
@step('the course has a Video component in (.*) mode')
|
||||
def view_video(_step, player_mode):
|
||||
coursenum = 'test_course'
|
||||
i_am_registered_for_the_course(step, coursenum)
|
||||
|
||||
# Make sure we have a video
|
||||
add_video_to_course(coursenum)
|
||||
add_video_to_course(coursenum, player_mode.lower())
|
||||
chapter_name = world.scenario_dict['SECTION'].display_name.replace(" ", "_")
|
||||
section_name = chapter_name
|
||||
url = django_url('/courses/%s/%s/%s/courseware/%s/%s' %
|
||||
@@ -27,9 +32,43 @@ def view_video(_step):
|
||||
world.browser.visit(url)
|
||||
|
||||
|
||||
def add_video_to_course(course):
|
||||
world.ItemFactory.create(parent_location=section_location(course),
|
||||
category='video',
|
||||
display_name='Video')
|
||||
def add_video_to_course(course, player_mode):
|
||||
category = 'video'
|
||||
|
||||
kwargs = {
|
||||
'parent_location': section_location(course),
|
||||
'category': category,
|
||||
'display_name': 'Video'
|
||||
}
|
||||
|
||||
if player_mode == 'html5':
|
||||
kwargs.update({
|
||||
'metadata': {
|
||||
'youtube_id_1_0': '',
|
||||
'youtube_id_0_75': '',
|
||||
'youtube_id_1_25': '',
|
||||
'youtube_id_1_5': '',
|
||||
'html5_sources': HTML5_SOURCES
|
||||
}
|
||||
})
|
||||
|
||||
world.ItemFactory.create(**kwargs)
|
||||
|
||||
|
||||
@step('when I view the video it has rendered in (.*) mode')
|
||||
def video_is_rendered(_step, mode):
|
||||
modes = {
|
||||
'html5': 'video',
|
||||
'youtube': 'iframe'
|
||||
}
|
||||
if mode.lower() in modes:
|
||||
assert world.css_find('.video {0}'.format(modes[mode.lower()])).first
|
||||
else:
|
||||
assert False
|
||||
|
||||
@step('all sources are correct')
|
||||
def all_sources_are_correct(_step):
|
||||
sources = world.css_find('.video video source')
|
||||
assert set(source['src'] for source in sources) == set(HTML5_SOURCES)
|
||||
|
||||
|
||||
|
||||
@@ -75,10 +75,6 @@ XQUEUE_INTERFACE = {
|
||||
"basic_auth": ('anant', 'agarwal'),
|
||||
}
|
||||
|
||||
# Do not display the YouTube videos in the browser while running the
|
||||
# acceptance tests. This makes them faster and more reliable
|
||||
MITX_FEATURES['STUB_VIDEO_FOR_TESTING'] = True
|
||||
|
||||
# Forums are disabled in test.py to speed up unit tests, but we do not have
|
||||
# per-test control for acceptance tests
|
||||
MITX_FEATURES['ENABLE_DISCUSSION_SERVICE'] = True
|
||||
|
||||
@@ -70,10 +70,6 @@ XQUEUE_INTERFACE = {
|
||||
"basic_auth": ('anant', 'agarwal'),
|
||||
}
|
||||
|
||||
# Do not display the YouTube videos in the browser while running the
|
||||
# acceptance tests. This makes them faster and more reliable
|
||||
MITX_FEATURES['STUB_VIDEO_FOR_TESTING'] = True
|
||||
|
||||
# Include the lettuce app for acceptance testing, including the 'harvest' django-admin command
|
||||
INSTALLED_APPS += ('lettuce.django',)
|
||||
LETTUCE_APPS = ('courseware',)
|
||||
|
||||
@@ -86,8 +86,6 @@ MITX_FEATURES = {
|
||||
|
||||
'DISABLE_LOGIN_BUTTON': False, # used in systems where login is automatic, eg MIT SSL
|
||||
|
||||
'STUB_VIDEO_FOR_TESTING': False, # do not display video when running automated acceptance tests
|
||||
|
||||
# extrernal access methods
|
||||
'ACCESS_REQUIRE_STAFF_FOR_COURSE': False,
|
||||
'AUTH_USE_OPENID': False,
|
||||
|
||||
@@ -8,18 +8,14 @@
|
||||
id="video_${id}"
|
||||
class="video"
|
||||
|
||||
% if not settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
|
||||
data-streams="${youtube_streams}"
|
||||
% endif
|
||||
data-streams="${youtube_streams}"
|
||||
|
||||
${'data-sub="{}"'.format(sub) if sub else ''}
|
||||
${'data-autoplay="{}"'.format(autoplay) if autoplay else ''}
|
||||
|
||||
% if not settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
|
||||
${'data-mp4-source="{}"'.format(sources.get('mp4')) if sources.get('mp4') else ''}
|
||||
${'data-webm-source="{}"'.format(sources.get('webm')) if sources.get('webm') else ''}
|
||||
${'data-ogg-source="{}"'.format(sources.get('ogv')) if sources.get('ogv') else ''}
|
||||
% endif
|
||||
${'data-mp4-source="{}"'.format(sources.get('mp4')) if sources.get('mp4') else ''}
|
||||
${'data-webm-source="{}"'.format(sources.get('webm')) if sources.get('webm') else ''}
|
||||
${'data-ogg-source="{}"'.format(sources.get('ogv')) if sources.get('ogv') else ''}
|
||||
|
||||
data-caption-data-dir="${data_dir}"
|
||||
data-show-captions="${show_captions}"
|
||||
|
||||
Reference in New Issue
Block a user