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
aa0e8041
Commit
aa0e8041
authored
May 09, 2014
by
Muhammad Ammar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bok-Choy Video Tests Batch6
parent
2d132e10
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
128 additions
and
47 deletions
+128
-47
common/test/acceptance/pages/lms/video.py
+71
-16
common/test/acceptance/tests/test_video_module.py
+47
-0
lms/djangoapps/courseware/features/video.feature
+10
-31
No files found.
common/test/acceptance/pages/lms/video.py
View file @
aa0e8041
...
...
@@ -32,7 +32,8 @@ CSS_CLASS_NAMES = {
'video_xmodule'
:
'.xmodule_VideoModule'
,
'video_init'
:
'.is-initialized'
,
'video_time'
:
'div.vidtime'
,
'video_display_name'
:
'.vert h2'
'video_display_name'
:
'.vert h2'
,
'captions_lang_list'
:
'.langs-list li'
}
VIDEO_MODES
=
{
...
...
@@ -246,39 +247,62 @@ class VideoPage(PageObject):
selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_BUTTONS
[
button_id
])
return
self
.
q
(
css
=
selector
)
.
visible
@wait_for_js
def
show_captions
(
self
,
video_display_name
=
None
):
"""
Show the video captions.
Make Captions Visible.
Arguments:
video_display_name (str or None): Display name of a Video.
"""
self
.
_captions_visibility
(
True
,
video_display_name
)
def
hide_captions
(
self
,
video_display_name
=
None
):
"""
Make Captions Invisible.
Arguments:
video_display_name (str or None): Display name of a Video.
"""
self
.
_captions_visibility
(
False
,
video_display_name
)
@wait_for_js
def
_captions_visibility
(
self
,
captions_new_state
,
video_display_name
=
None
):
"""
Set the video captions visibility state.
Arguments:
video_display_name (str or None): Display name of a Video.
captions_new_state (bool): True means show captions, False means hide captions
"""
subtitle_selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'closed_captions'
])
states
=
{
True
:
'Shown'
,
False
:
'Hidden'
}
state
=
states
[
captions_new_state
]
def
_is_subtitles_open
():
caption_state_selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'closed_captions'
])
def
_captions_current_state
():
"""
Check if subtitles are opened
Get current visibility sate of captions.
Returns:
bool:
Subtitles Visibility
bool:
True means captions are visible, False means captions are not visible
"""
is_open
=
not
self
.
q
(
css
=
subtitle_selector
)
.
present
return
is_open
return
not
self
.
q
(
css
=
caption_state_selector
)
.
present
# Make sure that the CC button is there
EmptyPromise
(
lambda
:
self
.
is_button_shown
(
'CC'
,
video_display_name
),
EmptyPromise
(
lambda
:
self
.
is_button_shown
(
'CC'
),
"CC button is shown"
)
.
fulfill
()
#
Check if the captions are already open and click if not
if
_
is_subtitles_open
()
is
Fals
e
:
self
.
click_player_button
(
'CC'
,
video_display_name
)
#
toggle captions visibility state if needed
if
_
captions_current_state
()
!=
captions_new_stat
e
:
self
.
click_player_button
(
'CC'
)
# Verify that they are now open
EmptyPromise
(
_is_subtitles_open
,
"Subtitles are shown"
)
.
fulfill
()
# Verify that captions state is toggled/changed
EmptyPromise
(
lambda
:
_captions_current_state
()
==
captions_new_state
,
"Captions are {state}"
.
format
(
state
=
state
)
)
.
fulfill
()
@property
def
captions_text
(
self
,
video_display_name
=
None
):
...
...
@@ -594,3 +618,34 @@ class VideoPage(PageObject):
return
False
return
True
def
sources
(
self
,
video_display_name
=
None
):
"""
Extract all video source urls on current page.
Arguments:
video_display_name (str or None): Display name of a Video.
Returns:
list: Video Source URLs.
"""
sources_selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'video_sources'
])
return
self
.
q
(
css
=
sources_selector
)
.
map
(
lambda
el
:
el
.
get_attribute
(
'src'
)
.
split
(
'?'
)[
0
])
.
results
def
caption_languages
(
self
,
video_display_name
=
None
):
"""
Get caption languages available for a video.
Arguments:
video_display_name (str or None): Display name of a Video.
Returns:
dict: Language Codes('en', 'zh' etc) as keys and Language Names as Values('English', 'Chinese' etc)
"""
languages_selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'captions_lang_list'
])
language_codes
=
self
.
q
(
css
=
languages_selector
)
.
attrs
(
'data-lang-code'
)
language_names
=
self
.
q
(
css
=
languages_selector
)
.
attrs
(
'textContent'
)
return
dict
(
zip
(
language_codes
,
language_names
))
common/test/acceptance/tests/test_video_module.py
View file @
aa0e8041
...
...
@@ -490,6 +490,38 @@ class YouTubeVideoTest(VideoBaseTest):
# menu "download_transcript" doesn't exist
self
.
assertFalse
(
self
.
video
.
is_menu_exist
(
'download_transcript'
))
def
test_video_language_menu_working
(
self
):
"""
Scenario: Language menu works correctly in Video component
Given the course has a Video component in "Youtube" mode
And I have defined multiple language transcripts for the videos
And I make sure captions are closed
And I see video menu "language" with correct items
And I select language with code "zh"
Then I see "好 各位同学" text in the captions
And I select language with code "en"
Then I see "Hi, welcome to Edx." text in the captions
"""
self
.
assets
.
extend
([
'chinese_transcripts.srt'
,
'subs_OEoXaMPEzfM.srt.sjson'
])
data
=
{
'transcripts'
:
{
"zh"
:
"chinese_transcripts.srt"
},
'sub'
:
'OEoXaMPEzfM'
}
self
.
metadata
=
self
.
metadata_for_mode
(
'youtube'
,
additional_data
=
data
)
# go to video
self
.
navigate_to_video
()
self
.
video
.
hide_captions
()
correct_languages
=
{
'en'
:
'English'
,
'zh'
:
'Chinese'
}
self
.
assertEqual
(
self
.
video
.
caption_languages
(),
correct_languages
)
self
.
video
.
select_language
(
'zh'
)
unicode_text
=
"好 各位同学"
.
decode
(
'utf-8'
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
)
self
.
video
.
select_language
(
'en'
)
self
.
assertIn
(
'Hi, welcome to Edx.'
,
self
.
video
.
captions_text
)
class
YouTubeHtml5VideoTest
(
VideoBaseTest
):
""" Test YouTube HTML5 Video Player """
...
...
@@ -676,3 +708,18 @@ class Html5VideoTest(VideoBaseTest):
# check if we see "好 各位同学" text in the captions
unicode_text
=
"好 各位同学"
.
decode
(
'utf-8'
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
)
def
test_video_rendering
(
self
):
"""
Scenario: Video component is fully rendered in the LMS in HTML5 mode
Given the course has a Video component in "HTML5" mode
Then the video has rendered in "HTML5" mode
And video sources are correct
"""
self
.
metadata
=
self
.
metadata_for_mode
(
'html5'
)
self
.
navigate_to_video
()
self
.
assertTrue
(
self
.
video
.
is_video_rendered
(
'html5'
))
self
.
assertTrue
(
all
([
source
in
HTML5_SOURCES
for
source
in
self
.
video
.
sources
()]))
lms/djangoapps/courseware/features/video.feature
View file @
aa0e8041
...
...
@@ -3,12 +3,6 @@ Feature: LMS.Video component
As a student, I want to view course videos in LMS
# 1
Scenario
:
Video component is fully rendered in the LMS in HTML5 mode
Given
the course has a Video component in
"HTML5"
mode
When
the video has rendered in
"HTML5"
mode
And
all sources are correct
# 2
Scenario
:
Multiple videos in sequentials all load and work, switching between sequentials
Given
I am registered for the course
"test_course"
And
it has a video
"A"
in
"Youtube"
mode in position
"1"
of sequential
...
...
@@ -30,7 +24,7 @@ Feature: LMS.Video component
When
I open video
"A"
Then
video
"A"
should start playing at speed
"2.0"
#
3
#
2
Scenario
:
Video component stores speed correctly when each video is in separate sequence
Given
I am registered for the course
"test_course"
And
it has a video
"A"
in
"Youtube"
mode in position
"1"
of sequential
...
...
@@ -52,21 +46,6 @@ Feature: LMS.Video component
When
I open video
"C"
Then
video
"C"
should start playing at speed
"1.0"
# 4
Scenario
:
Language menu works correctly in Video component
Given
I am registered for the course
"test_course"
And
I have a
"chinese_transcripts.srt"
transcript file in assets
And
I have a
"subs_OEoXaMPEzfM.srt.sjson"
transcript file in assets
And it has a video in "Youtube" mode
:
|
transcripts
|
sub
|
|
{"zh":
"chinese_transcripts.srt"}
|
OEoXaMPEzfM
|
And
I make sure captions are closed
And
I see video menu
"language"
with correct items
And
I select language with code
"zh"
Then
I see
"好 各位同学"
text in the captions
And
I select language with code
"en"
And
I see
"Hi, welcome to Edx."
text in the captions
# 9
# Scenario: Youtube video has correct transcript if fields for other speeds are filled
# Given I am registered for the course "test_course"
...
...
@@ -85,7 +64,7 @@ Feature: LMS.Video component
# "1:56" is the duration in the VCR timer before the video plays.
# And I see duration "1:56"
#
6
#
3
Scenario
:
Verify that each video in each sub-section includes a transcript for non-Youtube countries
Given
youtube server is up and response time is 2 seconds
And
I am registered for the course
"test_course"
...
...
@@ -126,7 +105,7 @@ Feature: LMS.Video component
# And I click video button "play"
# Then I see video slider at "0:10" position
#
7
#
4
Scenario
:
End time works for Youtube video
Given
I am registered for the course
"test_course"
And it has a video in "Youtube" mode
:
...
...
@@ -136,7 +115,7 @@ Feature: LMS.Video component
And
I wait
"5"
seconds
Then I see video slider at "0
:
02"
position
#
8
#
5
Scenario
:
Youtube video with end-time at 1
:
00 and the video starts playing at 0
:
58
Given
I am registered for the course
"test_course"
And it has a video in "Youtube" mode
:
...
...
@@ -148,7 +127,7 @@ Feature: LMS.Video component
And
I wait
"5"
seconds
Then I see video slider at "1
:
00"
position
#
9
#
6
Scenario
:
Start time and end time work together for Youtube video
Given
I am registered for the course
"test_course"
And it has a video in "Youtube" mode
:
...
...
@@ -159,7 +138,7 @@ Feature: LMS.Video component
And
I wait
"5"
seconds
Then I see video slider at "0
:
12"
position
#
10
#
7
Scenario
:
Youtube video after pausing at end time video plays to the end from end time
Given
I am registered for the course
"test_course"
And it has a video in "Youtube" mode
:
...
...
@@ -174,7 +153,7 @@ Feature: LMS.Video component
# The default video length is 00:01:55.
Then I see video slider at "1
:
55"
position
#
11
#
8
Scenario
:
Youtube video with end-time at 0
:
32 and start-time at 0
:
30, the video starts playing from 0
:
28
Given
I am registered for the course
"test_course"
And it has a video in "Youtube" mode
:
...
...
@@ -186,7 +165,7 @@ Feature: LMS.Video component
And
I wait
"8"
seconds
Then I see video slider at "0
:
32"
position
#
12
#
9
Scenario
:
Youtube video with end-time at 1
:
00, the video starts playing from 1
:
52
Given
I am registered for the course
"test_course"
And it has a video in "Youtube" mode
:
...
...
@@ -199,7 +178,7 @@ Feature: LMS.Video component
# Video stops at the end.
Then I see video slider at "1
:
55"
position
# 1
3
# 1
0
@skip_firefox
Scenario
:
Quality button appears on play
Given
the course has a Video component in
"Youtube"
mode
...
...
@@ -207,7 +186,7 @@ Feature: LMS.Video component
And
I click video button
"play"
Then
I see video button
"quality"
is visible
# 1
4
# 1
1
@skip_firefox
Scenario
:
Quality button works correctly
Given
the course has a Video component in
"Youtube"
mode
...
...
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