Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
782cb054
Commit
782cb054
authored
May 31, 2013
by
Peter Fogg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add passing Lettuce testing for video autoplay in LMS.
parent
1ead8577
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
31 deletions
+60
-31
cms/djangoapps/contentstore/features/common.py
+7
-9
cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
+5
-8
lms/djangoapps/courseware/features/video.py
+14
-11
lms/templates/video.html
+18
-2
lms/templates/videoalpha.html
+16
-1
No files found.
cms/djangoapps/contentstore/features/common.py
View file @
782cb054
...
...
@@ -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$'
)
...
...
cms/djangoapps/contentstore/features/component_settings_editor.py
→
cms/djangoapps/contentstore/features/component_settings_editor
_helpers
.py
View file @
782cb054
# 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
)))
lms/djangoapps/courseware/features/video.py
View file @
782cb054
...
...
@@ -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'
)
lms/templates/video.html
View file @
782cb054
...
...
@@ -3,8 +3,24 @@
% endif
%if settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
<div
id=
"stub_out_video_for_testing"
></div>
<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"
>
<param
name=
"movie"
...
...
lms/templates/videoalpha.html
View file @
782cb054
...
...
@@ -3,7 +3,22 @@
% endif
%if settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
<div
id=
"stub_out_video_for_testing"
></div>
<div
id=
"stub_out_video_for_testing"
>
<div
class=
"video"
data-autoplay=
"${settings.MITX_FEATURES['AUTOPLAY_VIDEOS']}"
>
<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>
</div>
</div>
%else:
<div
id=
"video_${id}"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment