Merge pull request #197 from edx/will/fix-video-acceptance-tests
Will/fix video acceptance tests
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
Feature: Video component
|
Feature: Video component
|
||||||
As a student, I want to view course videos in LMS.
|
As a student, I want to view course videos in LMS.
|
||||||
|
|
||||||
Scenario: Autoplay is enabled in LMS
|
Scenario: Autoplay is enabled in LMS for a Video component
|
||||||
Given the course has a Video component
|
Given the course has a Video component
|
||||||
Then when I view the video it has autoplay enabled
|
Then when I view the video it has autoplay enabled
|
||||||
|
|
||||||
|
Scenario: Autoplay is enabled in the LMS for a VideoAlpha component
|
||||||
|
Given the course has a VideoAlpha component
|
||||||
|
Then when I view the video it has autoplay enabled
|
||||||
|
|||||||
@@ -27,8 +27,30 @@ def view_video(_step):
|
|||||||
world.browser.visit(url)
|
world.browser.visit(url)
|
||||||
|
|
||||||
|
|
||||||
|
@step('the course has a VideoAlpha component')
|
||||||
|
def view_videoalpha(step):
|
||||||
|
coursename = TEST_COURSE_NAME.replace(' ', '_')
|
||||||
|
i_am_registered_for_the_course(step, coursename)
|
||||||
|
|
||||||
|
# Make sure we have a videoalpha
|
||||||
|
add_videoalpha_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):
|
def add_video_to_course(course):
|
||||||
template_name = 'i4x://edx/templates/video/default'
|
template_name = 'i4x://edx/templates/video/default'
|
||||||
world.ItemFactory.create(parent_location=section_location(course),
|
world.ItemFactory.create(parent_location=section_location(course),
|
||||||
template=template_name,
|
template=template_name,
|
||||||
display_name='Video')
|
display_name='Video')
|
||||||
|
|
||||||
|
|
||||||
|
def add_videoalpha_to_course(course):
|
||||||
|
template_name = 'i4x://edx/templates/videoalpha/Video_Alpha'
|
||||||
|
world.ItemFactory.create(parent_location=section_location(course),
|
||||||
|
template=template_name,
|
||||||
|
display_name='Video Alpha')
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
Feature: Video Alpha 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
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
#pylint: disable=C0111
|
|
||||||
#pylint: disable=W0613
|
|
||||||
#pylint: disable=W0621
|
|
||||||
|
|
||||||
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('.videoalpha')[0]['data-autoplay'] == 'True')
|
|
||||||
|
|
||||||
|
|
||||||
@step('the course has a Video component')
|
|
||||||
def view_videoalpha(step):
|
|
||||||
coursename = TEST_COURSE_NAME.replace(' ', '_')
|
|
||||||
i_am_registered_for_the_course(step, coursename)
|
|
||||||
|
|
||||||
# Make sure we have a videoalpha
|
|
||||||
add_videoalpha_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_videoalpha_to_course(course):
|
|
||||||
template_name = 'i4x://edx/templates/videoalpha/default'
|
|
||||||
world.ItemFactory.create(parent_location=section_location(course),
|
|
||||||
template=template_name,
|
|
||||||
display_name='Video Alpha 1')
|
|
||||||
@@ -2,37 +2,33 @@
|
|||||||
<h2> ${display_name} </h2>
|
<h2> ${display_name} </h2>
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
%if settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
|
%if settings.MITX_FEATURES.get('USE_YOUTUBE_OBJECT_API') and normal_speed_video_id:
|
||||||
<div id="stub_out_video_for_testing">
|
|
||||||
<div class="video" data-autoplay="${settings.MITX_FEATURES['AUTOPLAY_VIDEOS']}">
|
|
||||||
<section class="video-controls">
|
|
||||||
<div class="slider"></div>
|
|
||||||
<div>
|
|
||||||
<ul class="vcr">
|
|
||||||
<li><a class="video_control" href="#"></a></li>
|
|
||||||
<li>
|
|
||||||
<div class="vidtime">0:00 / 0:00</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div class="secondary-controls">
|
|
||||||
<a href="#" class="add-fullscreen" title="Fill browser">Fill Browser</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
%elif settings.MITX_FEATURES.get('USE_YOUTUBE_OBJECT_API') and normal_speed_video_id:
|
|
||||||
<object width="640" height="390">
|
<object width="640" height="390">
|
||||||
<param name="movie"
|
<param name="movie"
|
||||||
value="https://www.youtube.com/v/${normal_speed_video_id}?version=3&autoplay=1&rel=0"></param>
|
% if not settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
|
||||||
|
value="https://www.youtube.com/v/${normal_speed_video_id}?version=3&autoplay=1&rel=0">
|
||||||
|
% endif
|
||||||
|
</param>
|
||||||
<param name="allowScriptAccess" value="always"></param>
|
<param name="allowScriptAccess" value="always"></param>
|
||||||
<embed src="https://www.youtube.com/v/${normal_speed_video_id}?version=3&autoplay=1&rel=0"
|
<embed
|
||||||
type="application/x-shockwave-flash"
|
% if not settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
|
||||||
allowscriptaccess="always"
|
src="https://www.youtube.com/v/${normal_speed_video_id}?version=3&autoplay=1&rel=0"
|
||||||
width="640" height="390"></embed>
|
% endif
|
||||||
|
type="application/x-shockwave-flash"
|
||||||
|
allowscriptaccess="always"
|
||||||
|
width="640" height="390"></embed>
|
||||||
</object>
|
</object>
|
||||||
%else:
|
%else:
|
||||||
<div id="video_${id}" class="video" data-streams="${streams}" data-show-captions="${show_captions}" data-start="${start}" data-end="${end}" data-caption-asset-path="${caption_asset_path}" data-autoplay="${settings.MITX_FEATURES['AUTOPLAY_VIDEOS']}">
|
<div id="video_${id}" class="video"
|
||||||
|
|
||||||
|
% if not settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
|
||||||
|
data-streams="${streams}"
|
||||||
|
% endif
|
||||||
|
|
||||||
|
data-show-captions="${show_captions}"
|
||||||
|
data-start="${start}" data-end="${end}"
|
||||||
|
data-caption-asset-path="${caption_asset_path}"
|
||||||
|
data-autoplay="${settings.MITX_FEATURES['AUTOPLAY_VIDEOS']}">
|
||||||
<div class="tc-wrapper">
|
<div class="tc-wrapper">
|
||||||
<article class="video-wrapper">
|
<article class="video-wrapper">
|
||||||
<section class="video-player">
|
<section class="video-player">
|
||||||
|
|||||||
@@ -2,34 +2,38 @@
|
|||||||
<h2> ${display_name} </h2>
|
<h2> ${display_name} </h2>
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
%if settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
|
<div
|
||||||
<div id="stub_out_video_for_testing"></div>
|
id="video_${id}"
|
||||||
%else:
|
class="video"
|
||||||
<div
|
|
||||||
id="video_${id}"
|
% if not settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
|
||||||
class="video"
|
data-streams="${youtube_streams}"
|
||||||
data-streams="${youtube_streams}"
|
% endif
|
||||||
${'data-sub="{}"'.format(sub) if sub else ''}
|
|
||||||
${'data-mp4-source="{}"'.format(sources.get('mp4')) if sources.get('mp4') else ''}
|
${'data-sub="{}"'.format(sub) if sub 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 ''}
|
% if not settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
|
||||||
data-caption-data-dir="${data_dir}"
|
${'data-mp4-source="{}"'.format(sources.get('mp4')) if sources.get('mp4') else ''}
|
||||||
data-show-captions="${show_captions}"
|
${'data-webm-source="{}"'.format(sources.get('webm')) if sources.get('webm') else ''}
|
||||||
data-start="${start}"
|
${'data-ogg-source="{}"'.format(sources.get('ogv')) if sources.get('ogv') else ''}
|
||||||
data-end="${end}"
|
% endif
|
||||||
data-caption-asset-path="${caption_asset_path}"
|
|
||||||
data-autoplay="${autoplay}"
|
data-caption-data-dir="${data_dir}"
|
||||||
>
|
data-show-captions="${show_captions}"
|
||||||
<div class="tc-wrapper">
|
data-start="${start}"
|
||||||
<article class="video-wrapper">
|
data-end="${end}"
|
||||||
<section class="video-player">
|
data-caption-asset-path="${caption_asset_path}"
|
||||||
<div id="${id}"></div>
|
data-autoplay="${autoplay}"
|
||||||
</section>
|
>
|
||||||
<section class="video-controls"></section>
|
<div class="tc-wrapper">
|
||||||
</article>
|
<article class="video-wrapper">
|
||||||
</div>
|
<section class="video-player">
|
||||||
</div>
|
<div id="${id}"></div>
|
||||||
%endif
|
</section>
|
||||||
|
<section class="video-controls"></section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
% if sources.get('main'):
|
% if sources.get('main'):
|
||||||
<div class="video-sources">
|
<div class="video-sources">
|
||||||
|
|||||||
Reference in New Issue
Block a user