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
45c2abbb
Commit
45c2abbb
authored
Aug 07, 2014
by
muhammad-ammar
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4261 from edx/ammar/video-tests-refactoring
Refactor Bok-Choy LMS Video Tests
parents
f0e737a7
c237364e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
183 additions
and
278 deletions
+183
-278
common/test/acceptance/pages/lms/video/video.py
+134
-230
common/test/acceptance/tests/video/test_video_module.py
+38
-37
common/test/acceptance/tests/video/test_video_times.py
+10
-10
requirements/edx/github.txt
+1
-1
No files found.
common/test/acceptance/pages/lms/video/video.py
View file @
45c2abbb
...
...
@@ -58,36 +58,13 @@ class VideoPage(PageObject):
"""
url
=
None
current_video_display_name
=
None
@wait_for_js
def
is_browser_on_page
(
self
):
return
self
.
q
(
css
=
'div{0}'
.
format
(
CSS_CLASS_NAMES
[
'video_xmodule'
]))
.
present
@wait_for_js
# TODO(muhammad-ammar) Move this function to somewhere else so that others can use it also. # pylint: disable=W0511
def
_wait_for_element
(
self
,
element_selector
,
promise_desc
):
"""
Wait for element specified by `element_selector` is present in DOM.
Arguments:
element_selector (str): css selector of the element.
promise_desc (str): Description of the Promise, used in log messages.
"""
def
_is_element_present
():
"""
Check if web-element present in DOM.
Returns:
bool: Tells elements presence.
"""
return
self
.
q
(
css
=
element_selector
)
.
present
EmptyPromise
(
_is_element_present
,
promise_desc
,
timeout
=
200
)
.
fulfill
()
@wait_for_js
def
wait_for_video_class
(
self
):
"""
Wait until element with class name `video` appeared in DOM.
...
...
@@ -96,29 +73,7 @@ class VideoPage(PageObject):
self
.
wait_for_ajax
()
video_selector
=
'{0}'
.
format
(
CSS_CLASS_NAMES
[
'video_container'
])
self
.
_wait_for_element
(
video_selector
,
'Video is initialized'
)
def
_wait_for_element_visibility
(
self
,
element_selector
,
promise_desc
):
"""
Wait for an element to be visible.
Arguments:
element_selector (str): css selector of the element.
promise_desc (str): Description of the Promise, used in log messages.
"""
def
_is_element_visible
():
"""
Check if a web-element is visible.
Returns:
bool: Tells element visibility status.
"""
return
self
.
q
(
css
=
element_selector
)
.
visible
EmptyPromise
(
_is_element_visible
,
promise_desc
,
timeout
=
200
)
.
fulfill
()
self
.
wait_for_element_presence
(
video_selector
,
'Video is initialized'
)
@wait_for_js
def
wait_for_video_player_render
(
self
):
...
...
@@ -127,12 +82,12 @@ class VideoPage(PageObject):
"""
self
.
wait_for_video_class
()
self
.
_wait_for_element
(
CSS_CLASS_NAMES
[
'video_init'
],
'Video Player Initialized'
)
self
.
_wait_for_element
(
CSS_CLASS_NAMES
[
'video_time'
],
'Video Player Initialized'
)
self
.
wait_for_element_presence
(
CSS_CLASS_NAMES
[
'video_init'
],
'Video Player Initialized'
)
self
.
wait_for_element_presence
(
CSS_CLASS_NAMES
[
'video_time'
],
'Video Player Initialized'
)
video_player_buttons
=
[
'volume'
,
'play'
,
'fullscreen'
,
'speed'
]
for
button
in
video_player_buttons
:
self
.
_
wait_for_element_visibility
(
VIDEO_BUTTONS
[
button
],
'{} button is visible'
.
format
(
button
.
title
()))
self
.
wait_for_element_visibility
(
VIDEO_BUTTONS
[
button
],
'{} button is visible'
.
format
(
button
.
title
()))
def
_is_finished_loading
():
"""
...
...
@@ -167,12 +122,11 @@ class VideoPage(PageObject):
else
:
return
'.vert.vert-0'
def
get_element_selector
(
self
,
video_display_name
,
class_name
):
def
get_element_selector
(
self
,
class_name
):
"""
Construct unique element selector.
Arguments:
video_display_name (str or None): Display name of a Video.
class_name (str): css class name for an element.
Returns:
...
...
@@ -180,22 +134,31 @@ class VideoPage(PageObject):
"""
return
'{vertical} {video_element}'
.
format
(
vertical
=
self
.
get_video_vertical_selector
(
video_display_name
),
vertical
=
self
.
get_video_vertical_selector
(
self
.
current_
video_display_name
),
video_element
=
class_name
)
def
is_video_rendered
(
self
,
mode
,
video_display_name
=
None
):
def
use_video
(
self
,
video_display_name
):
"""
Set current video display name.
Arguments:
video_display_name (str): Display name of a Video.
"""
self
.
current_video_display_name
=
video_display_name
def
is_video_rendered
(
self
,
mode
):
"""
Check that if video is rendered in `mode`.
Arguments:
mode (str): Video mode, `html5` or `youtube`.
video_display_name (str or None): Display name of a Video.
Returns:
bool: Tells if video is rendered in `mode`.
"""
selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_MODES
[
mode
])
selector
=
self
.
get_element_selector
(
VIDEO_MODES
[
mode
])
def
_is_element_present
():
"""
...
...
@@ -211,18 +174,16 @@ class VideoPage(PageObject):
return
Promise
(
_is_element_present
,
'Video Rendering Failed in {0} mode.'
.
format
(
mode
))
.
fulfill
()
def
is_autoplay_enabled
(
self
,
video_display_name
=
None
):
@property
def
is_autoplay_enabled
(
self
):
"""
Extract `data-autoplay` attribute to check video autoplay is enabled or disabled.
Arguments:
video_display_name (str or None): Display name of a Video.
Returns:
bool: Tells if autoplay enabled/disabled.
"""
selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'video_container'
])
selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'video_container'
])
auto_play
=
self
.
q
(
css
=
selector
)
.
attrs
(
'data-autoplay'
)[
0
]
if
auto_play
.
lower
()
==
'false'
:
...
...
@@ -230,97 +191,81 @@ class VideoPage(PageObject):
return
True
def
is_error_message_shown
(
self
,
video_display_name
=
None
):
@property
def
is_error_message_shown
(
self
):
"""
Checks if video player error message shown.
Arguments:
video_display_name (str or None): Display name of a Video.
Returns:
bool: Tells about error message visibility.
"""
selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'error_message'
])
selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'error_message'
])
return
self
.
q
(
css
=
selector
)
.
visible
def
is_spinner_shown
(
self
,
video_display_name
=
None
):
@property
def
is_spinner_shown
(
self
):
"""
Checks if video spinner shown.
Arguments:
video_display_name (str or None): Display name of a Video.
Returns:
bool: Tells about spinner visibility.
"""
selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'video_spinner'
])
selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'video_spinner'
])
return
self
.
q
(
css
=
selector
)
.
visible
def
error_message_text
(
self
,
video_display_name
=
None
):
@property
def
error_message_text
(
self
):
"""
Extract video player error message text.
Arguments:
video_display_name (str or None): Display name of a Video.
Returns:
str: Error message text.
"""
selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'error_message'
])
selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'error_message'
])
return
self
.
q
(
css
=
selector
)
.
text
[
0
]
def
is_button_shown
(
self
,
button_id
,
video_display_name
=
None
):
def
is_button_shown
(
self
,
button_id
):
"""
Check if a video button specified by `button_id` is visible.
Arguments:
button_id (str): key in VIDEO_BUTTONS dictionary, its value will give us the css selector for button.
video_display_name (str or None): Display name of a Video.
Returns:
bool: Tells about a buttons visibility.
"""
selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_BUTTONS
[
button_id
])
selector
=
self
.
get_element_selector
(
VIDEO_BUTTONS
[
button_id
])
return
self
.
q
(
css
=
selector
)
.
visible
def
show_captions
(
self
,
video_display_name
=
None
):
def
show_captions
(
self
):
"""
Make Captions Visible.
Arguments:
video_display_name (str or None): Display name of a Video.
"""
self
.
_captions_visibility
(
True
,
video_display_name
)
self
.
_captions_visibility
(
True
)
def
hide_captions
(
self
,
video_display_name
=
None
):
def
hide_captions
(
self
):
"""
Make Captions Invisible.
Arguments:
video_display_name (str or None): Display name of a Video.
"""
self
.
_captions_visibility
(
False
,
video_display_name
)
self
.
_captions_visibility
(
False
)
@wait_for_js
def
_captions_visibility
(
self
,
captions_new_state
,
video_display_name
=
None
):
def
_captions_visibility
(
self
,
captions_new_state
):
"""
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
"""
states
=
{
True
:
'Shown'
,
False
:
'Hidden'
}
state
=
states
[
captions_new_state
]
caption_state_selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'closed_captions'
])
caption_state_selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'closed_captions'
])
def
_captions_current_state
():
"""
...
...
@@ -344,99 +289,71 @@ class VideoPage(PageObject):
EmptyPromise
(
lambda
:
_captions_current_state
()
==
captions_new_state
,
"Captions are {state}"
.
format
(
state
=
state
))
.
fulfill
()
def
captions_text
(
self
,
video_display_name
=
None
):
@property
def
captions_text
(
self
):
"""
Extract captions text.
Arguments:
video_display_name (str or None): Display name of a Video.
Returns:
str: Captions Text.
"""
# wait until captions rendered completely
captions_rendered_selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'captions_rendered'
])
self
.
_wait_for_element
(
captions_rendered_selector
,
'Captions Rendered'
)
captions_rendered_selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'captions_rendered'
])
self
.
wait_for_element_presence
(
captions_rendered_selector
,
'Captions Rendered'
)
captions_selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'captions_text'
])
captions_selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'captions_text'
])
subs
=
self
.
q
(
css
=
captions_selector
)
.
html
return
' '
.
join
(
subs
)
def
set_speed
(
self
,
speed
,
video_display_name
=
None
):
@property
def
speed
(
self
):
"""
Get current video speed value.
Return:
str: speed value
"""
speed_selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'video_speed'
])
return
self
.
q
(
css
=
speed_selector
)
.
text
[
0
]
@speed.setter
def
speed
(
self
,
speed
):
"""
Change the video play speed.
Arguments:
speed (str): Video speed value
video_display_name (str or None): Display name of a Video.
"""
# mouse over to video speed button
speed_menu_selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_BUTTONS
[
'speed'
])
speed_menu_selector
=
self
.
get_element_selector
(
VIDEO_BUTTONS
[
'speed'
])
element_to_hover_over
=
self
.
q
(
css
=
speed_menu_selector
)
.
results
[
0
]
hover
=
ActionChains
(
self
.
browser
)
.
move_to_element
(
element_to_hover_over
)
hover
.
perform
()
speed_selector
=
self
.
get_element_selector
(
video_display_name
,
'li[data-speed="{speed}"] a'
.
format
(
speed
=
speed
))
speed_selector
=
self
.
get_element_selector
(
'li[data-speed="{speed}"] a'
.
format
(
speed
=
speed
))
self
.
q
(
css
=
speed_selector
)
.
first
.
click
()
def
get_speed
(
self
,
video_display_name
=
None
):
"""
Get current video speed value.
Arguments:
video_display_name (str or None): Display name of a Video.
Return:
str: speed value
"""
speed_selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'video_speed'
])
return
self
.
q
(
css
=
speed_selector
)
.
text
[
0
]
def
click_player_button
(
self
,
button
,
video_display_name
=
None
):
def
click_player_button
(
self
,
button
):
"""
Click on `button`.
Arguments:
button (str): key in VIDEO_BUTTONS dictionary, its value will give us the css selector for `button`
video_display_name (str or None): Display name of a Video.
"""
button_selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_BUTTONS
[
button
])
button_selector
=
self
.
get_element_selector
(
VIDEO_BUTTONS
[
button
])
self
.
q
(
css
=
button_selector
)
.
first
.
click
()
button_states
=
{
'play'
:
'playing'
,
'pause'
:
'pause'
}
if
button
in
button_states
:
self
.
wait_for_state
(
button_states
[
button
]
,
video_display_name
)
self
.
wait_for_state
(
button_states
[
button
])
self
.
wait_for_ajax
()
def
_wait_for_video_play
(
self
,
video_display_name
=
None
):
"""
Wait until video starts playing
Arguments:
video_display_name (str or None): Display name of a Video.
"""
playing_selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'video_container'
])
pause_selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_BUTTONS
[
'pause'
])
def
_check_promise
():
"""
Promise check
Returns:
bool: Is promise satisfied.
"""
return
'is-playing'
in
self
.
q
(
css
=
playing_selector
)
.
attrs
(
'class'
)[
0
]
and
self
.
q
(
css
=
pause_selector
)
.
present
EmptyPromise
(
_check_promise
,
'Video is Playing'
,
timeout
=
200
)
.
fulfill
()
def
_get_element_dimensions
(
self
,
selector
):
"""
Gets the width and height of element specified by `selector`
...
...
@@ -451,37 +368,34 @@ class VideoPage(PageObject):
element
=
self
.
q
(
css
=
selector
)
.
results
[
0
]
return
element
.
size
def
_get_dimensions
(
self
,
video_display_name
=
None
):
@property
def
_dimensions
(
self
):
"""
Gets the video player dimensions.
Arguments:
video_display_name (str or None): Display name of a Video.
Returns:
tuple: Dimensions
"""
iframe_selector
=
self
.
get_element_selector
(
video_display_name
,
'.video-player iframe,'
)
video_selector
=
self
.
get_element_selector
(
video_display_name
,
' .video-player video'
)
iframe_selector
=
self
.
get_element_selector
(
'.video-player iframe,'
)
video_selector
=
self
.
get_element_selector
(
' .video-player video'
)
video
=
self
.
_get_element_dimensions
(
iframe_selector
+
video_selector
)
wrapper
=
self
.
_get_element_dimensions
(
self
.
get_element_selector
(
video_display_name
,
'.tc-wrapper'
))
controls
=
self
.
_get_element_dimensions
(
self
.
get_element_selector
(
video_display_name
,
'.video-controls'
))
wrapper
=
self
.
_get_element_dimensions
(
self
.
get_element_selector
(
'.tc-wrapper'
))
controls
=
self
.
_get_element_dimensions
(
self
.
get_element_selector
(
'.video-controls'
))
progress_slider
=
self
.
_get_element_dimensions
(
self
.
get_element_selector
(
video_display_name
,
'.video-controls > .slider'
))
self
.
get_element_selector
(
'.video-controls > .slider'
))
expected
=
dict
(
wrapper
)
expected
[
'height'
]
-=
controls
[
'height'
]
+
0.5
*
progress_slider
[
'height'
]
return
video
,
expected
def
is_aligned
(
self
,
is_transcript_visible
,
video_display_name
=
None
):
def
is_aligned
(
self
,
is_transcript_visible
):
"""
Check if video is aligned properly.
Arguments:
is_transcript_visible (bool): Transcript is visible or not.
video_display_name (str or None): Display name of a Video.
Returns:
bool: Alignment result.
...
...
@@ -497,7 +411,7 @@ class VideoPage(PageObject):
# Currently there is no other way to wait instead of explicit wait
time
.
sleep
(
0.2
)
real
,
expected
=
self
.
_
get_dimensions
(
video_display_name
)
real
,
expected
=
self
.
_
dimensions
width
=
round
(
100
*
real
[
'width'
]
/
expected
[
'width'
])
==
wrapper_width
...
...
@@ -507,7 +421,7 @@ class VideoPage(PageObject):
# Currently there is no other way to wait instead of explicit wait
time
.
sleep
(
0.2
)
real
,
expected
=
self
.
_
get_dimensions
(
video_display_name
)
real
,
expected
=
self
.
_
dimensions
height
=
abs
(
expected
[
'height'
]
-
real
[
'height'
])
<=
5
...
...
@@ -534,20 +448,19 @@ class VideoPage(PageObject):
response
=
requests
.
get
(
url
,
**
kwargs
)
return
response
.
status_code
<
400
,
response
.
headers
,
response
.
content
def
downloaded_transcript_contains_text
(
self
,
transcript_format
,
text_to_search
,
video_display_name
=
None
):
def
downloaded_transcript_contains_text
(
self
,
transcript_format
,
text_to_search
):
"""
Download the transcript in format `transcript_format` and check that it contains the text `text_to_search`
Arguments:
transcript_format (str): Transcript file format `srt` or `txt`
text_to_search (str): Text to search in Transcript.
video_display_name (str or None): Display name of a Video.
Returns:
bool: Transcript download result.
"""
transcript_selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_MENUS
[
'transcript-format'
])
transcript_selector
=
self
.
get_element_selector
(
VIDEO_MENUS
[
'transcript-format'
])
# check if we have a transcript with correct format
if
'.'
+
transcript_format
not
in
self
.
q
(
css
=
transcript_selector
)
.
text
[
0
]:
...
...
@@ -558,7 +471,7 @@ class VideoPage(PageObject):
'txt'
:
'text/plain'
,
}
transcript_url_selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_BUTTONS
[
'download_transcript'
])
transcript_url_selector
=
self
.
get_element_selector
(
VIDEO_BUTTONS
[
'download_transcript'
])
url
=
self
.
q
(
css
=
transcript_url_selector
)
.
attrs
(
'href'
)[
0
]
result
,
headers
,
content
=
self
.
_get_transcript
(
url
)
...
...
@@ -573,40 +486,42 @@ class VideoPage(PageObject):
return
True
def
current_language
(
self
,
video_display_name
=
None
):
selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_MENUS
[
"language"
]
+
' li.is-active'
)
def
current_language
(
self
):
"""
Get current selected video transcript language.
"""
selector
=
self
.
get_element_selector
(
VIDEO_MENUS
[
"language"
]
+
' li.is-active'
)
return
self
.
q
(
css
=
selector
)
.
first
.
attrs
(
'data-lang-code'
)[
0
]
def
select_language
(
self
,
code
,
video_display_name
=
None
):
def
select_language
(
self
,
code
):
"""
Select captions for language `code`.
Arguments:
code (str): two character language code like `en`, `zh`.
video_display_name (str or None): Display name of a Video.
"""
self
.
wait_for_ajax
()
# mouse over to CC button
cc_button_selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_BUTTONS
[
"CC"
])
cc_button_selector
=
self
.
get_element_selector
(
VIDEO_BUTTONS
[
"CC"
])
element_to_hover_over
=
self
.
q
(
css
=
cc_button_selector
)
.
results
[
0
]
ActionChains
(
self
.
browser
)
.
move_to_element
(
element_to_hover_over
)
.
perform
()
language_selector
=
VIDEO_MENUS
[
"language"
]
+
' li[data-lang-code="{code}"]'
.
format
(
code
=
code
)
language_selector
=
self
.
get_element_selector
(
video_display_name
,
language_selector
)
self
.
_
wait_for_element_visibility
(
language_selector
,
'language menu is visible'
)
language_selector
=
self
.
get_element_selector
(
language_selector
)
self
.
wait_for_element_visibility
(
language_selector
,
'language menu is visible'
)
self
.
q
(
css
=
language_selector
)
.
first
.
click
()
# Sometimes language is not clicked correctly. So, if the current language code
# differs form the expected, we try to change it again.
if
self
.
current_language
(
video_display_name
)
!=
code
:
self
.
select_language
(
code
,
video_display_name
)
if
self
.
current_language
()
!=
code
:
self
.
select_language
(
code
)
if
'is-active'
!=
self
.
q
(
css
=
language_selector
)
.
attrs
(
'class'
)[
0
]:
return
False
active_lang_selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_MENUS
[
"language"
]
+
' li.is-active'
)
active_lang_selector
=
self
.
get_element_selector
(
VIDEO_MENUS
[
"language"
]
+
' li.is-active'
)
if
len
(
self
.
q
(
css
=
active_lang_selector
)
.
results
)
!=
1
:
return
False
...
...
@@ -614,43 +529,41 @@ class VideoPage(PageObject):
# For example, request to get new translation etc.
self
.
wait_for_ajax
()
captions_selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'captions'
])
captions_selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'captions'
])
EmptyPromise
(
lambda
:
self
.
q
(
css
=
captions_selector
)
.
visible
,
'Subtitles Visible'
)
.
fulfill
()
# wait until captions rendered completely
captions_rendered_selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'captions_rendered'
])
self
.
_wait_for_element
(
captions_rendered_selector
,
'Captions Rendered'
)
captions_rendered_selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'captions_rendered'
])
self
.
wait_for_element_presence
(
captions_rendered_selector
,
'Captions Rendered'
)
return
True
def
is_menu_
exist
(
self
,
menu_name
,
video_display_name
=
Non
e
):
def
is_menu_
present
(
self
,
menu_nam
e
):
"""
Check if menu `menu_name` exists.
Arguments:
menu_name (str): Menu key from VIDEO_MENUS.
video_display_name (str or None): Display name of a Video.
Returns:
bool: Menu existence result
"""
selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_MENUS
[
menu_name
])
selector
=
self
.
get_element_selector
(
VIDEO_MENUS
[
menu_name
])
return
self
.
q
(
css
=
selector
)
.
present
def
select_transcript_format
(
self
,
transcript_format
,
video_display_name
=
None
):
def
select_transcript_format
(
self
,
transcript_format
):
"""
Select transcript with format `transcript_format`.
Arguments:
transcript_format (st): Transcript file format `srt` or `txt`.
video_display_name (str or None): Display name of a Video.
Returns:
bool: Selection Result.
"""
button_selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_MENUS
[
'transcript-format'
])
button_selector
=
self
.
get_element_selector
(
VIDEO_MENUS
[
'transcript-format'
])
button
=
self
.
q
(
css
=
button_selector
)
.
results
[
0
]
...
...
@@ -663,7 +576,7 @@ class VideoPage(PageObject):
if
'...'
not
in
self
.
q
(
css
=
button_selector
)
.
text
[
0
]:
return
False
menu_selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_MENUS
[
'download_transcript'
])
menu_selector
=
self
.
get_element_selector
(
VIDEO_MENUS
[
'download_transcript'
])
menu_items
=
self
.
q
(
css
=
menu_selector
+
' a'
)
.
results
for
item
in
menu_items
:
if
item
.
get_attribute
(
'data-value'
)
==
transcript_format
:
...
...
@@ -681,67 +594,67 @@ class VideoPage(PageObject):
return
True
def
sources
(
self
,
video_display_name
=
None
):
@property
def
sources
(
self
):
"""
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'
])
sources_selector
=
self
.
get_element_selector
(
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
):
@property
def
caption_languages
(
self
):
"""
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'
])
languages_selector
=
self
.
get_element_selector
(
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
))
def
position
(
self
,
video_display_name
=
None
):
@property
def
position
(
self
):
"""
Gets current video slider position.
Arguments:
video_display_name (str or None): Display name of a Video.
Returns:
str: current seek position in format min:sec.
"""
selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'video_time'
])
selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'video_time'
])
current_seek_position
=
self
.
q
(
css
=
selector
)
.
text
[
0
]
return
current_seek_position
.
split
(
'/'
)[
0
]
.
strip
()
def
seconds
(
self
,
video_display_name
=
None
):
return
int
(
self
.
position
(
video_display_name
)
.
split
(
':'
)[
1
])
@property
def
seconds
(
self
):
"""
Extract seconds part from current video slider position.
Returns:
str
def
state
(
self
,
video_display_name
=
None
):
"""
Extract the current state (play, pause etc) of video.
return
int
(
self
.
position
.
split
(
':'
)[
1
])
Arguments:
video_display_name (str or None): Display name of a Video.
@property
def
state
(
self
):
"""
Extract the current state (play, pause etc) of video.
Returns:
str: current video state
"""
state_selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'video_container'
])
state_selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'video_container'
])
current_state
=
self
.
q
(
css
=
state_selector
)
.
attrs
(
'class'
)[
0
]
if
'is-playing'
in
current_state
:
...
...
@@ -769,17 +682,16 @@ class VideoPage(PageObject):
else
:
return
EmptyPromise
(
check_func
,
desc
,
timeout
=
timeout
)
.
fulfill
()
def
wait_for_state
(
self
,
state
,
video_display_name
=
None
):
def
wait_for_state
(
self
,
state
):
"""
Wait until `state` occurs.
Arguments:
state (str): State we wait for.
video_display_name (str or None): Display name of a Video.
"""
self
.
_wait_for
(
lambda
:
self
.
state
(
video_display_name
)
==
state
,
lambda
:
self
.
state
==
state
,
'State is {state}'
.
format
(
state
=
state
)
)
...
...
@@ -797,17 +709,16 @@ class VideoPage(PageObject):
time_obj
=
time
.
strptime
(
time_str
,
'
%
M:
%
S'
)
return
time_obj
.
tm_min
*
60
+
time_obj
.
tm_sec
def
seek
(
self
,
seek_value
,
video_display_name
=
None
):
def
seek
(
self
,
seek_value
):
"""
Seek the video to position specified by `seek_value`.
Arguments:
seek_value (str): seek value
video_display_name (str or None): Display name of a Video.
"""
seek_time
=
self
.
_parse_time_str
(
seek_value
)
seek_selector
=
self
.
get_element_selector
(
video_display_name
,
' .video'
)
seek_selector
=
self
.
get_element_selector
(
' .video'
)
js_code
=
"$('{seek_selector}').data('video-player-state').videoPlayer.onSlideSeek({{time: {seek_time}}})"
.
format
(
seek_selector
=
seek_selector
,
seek_time
=
seek_time
)
self
.
browser
.
execute_script
(
js_code
)
...
...
@@ -818,7 +729,7 @@ class VideoPage(PageObject):
"""
Check if buffering completed
"""
return
self
.
state
(
video_display_name
)
!=
'buffering'
return
self
.
state
!=
'buffering'
self
.
_wait_for
(
_is_buffering_completed
,
'Buffering completed after Seek.'
)
...
...
@@ -829,18 +740,16 @@ class VideoPage(PageObject):
self
.
browser
.
refresh
()
self
.
wait_for_video_player_render
()
def
duration
(
self
,
video_display_name
=
None
):
@property
def
duration
(
self
):
"""
Extract video duration.
Arguments:
video_display_name (str or None): Display name of a Video.
Returns:
str: duration in format min:sec
"""
selector
=
self
.
get_element_selector
(
video_display_name
,
CSS_CLASS_NAMES
[
'video_time'
])
selector
=
self
.
get_element_selector
(
CSS_CLASS_NAMES
[
'video_time'
])
# The full time has the form "0:32 / 3:14" elapsed/duration
all_times
=
self
.
q
(
css
=
selector
)
.
text
[
0
]
...
...
@@ -849,46 +758,41 @@ class VideoPage(PageObject):
return
duration_str
.
strip
()
def
wait_for_position
(
self
,
position
,
video_display_name
=
None
):
def
wait_for_position
(
self
,
position
):
"""
Wait until current will be equal to `position`.
Arguments:
position (str): position we wait for.
video_display_name (str or None): Display name of a Video.
"""
self
.
_wait_for
(
lambda
:
self
.
position
(
video_display_name
)
==
position
,
lambda
:
self
.
position
==
position
,
'Position is {position}'
.
format
(
position
=
position
)
)
def
is_quality_button_visible
(
self
,
video_display_name
=
None
):
@property
def
is_quality_button_visible
(
self
):
"""
Get the visibility state of quality button
Arguments:
video_display_name (str or None): Display name of a Video.
Returns:
bool: visibility status
"""
selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_BUTTONS
[
'quality'
])
selector
=
self
.
get_element_selector
(
VIDEO_BUTTONS
[
'quality'
])
return
self
.
q
(
css
=
selector
)
.
visible
def
is_quality_button_active
(
self
,
video_display_name
=
None
):
@property
def
is_quality_button_active
(
self
):
"""
Check if quality button is active or not.
Arguments:
video_display_name (str or None): Display name of a Video.
Returns:
bool: active status
"""
selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_BUTTONS
[
'quality'
])
selector
=
self
.
get_element_selector
(
VIDEO_BUTTONS
[
'quality'
])
classes
=
self
.
q
(
css
=
selector
)
.
attrs
(
'class'
)[
0
]
.
split
()
return
'active'
in
classes
common/test/acceptance/tests/video/test_video_module.py
View file @
45c2abbb
...
...
@@ -266,7 +266,7 @@ class YouTubeVideoTest(VideoBaseTest):
# Verify that we see "好 各位同学" text in the captions
unicode_text
=
"好 各位同学"
.
decode
(
'utf-8'
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
()
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
)
def
test_cc_button_transcripts_and_sub_fields_empty
(
self
):
"""
...
...
@@ -283,7 +283,7 @@ class YouTubeVideoTest(VideoBaseTest):
self
.
video
.
show_captions
()
# Verify that we see "Hi, welcome to Edx." text in the captions
self
.
assertIn
(
'Hi, welcome to Edx.'
,
self
.
video
.
captions_text
()
)
self
.
assertIn
(
'Hi, welcome to Edx.'
,
self
.
video
.
captions_text
)
def
test_cc_button_hidden_no_translations
(
self
):
"""
...
...
@@ -347,7 +347,7 @@ class YouTubeVideoTest(VideoBaseTest):
self
.
navigate_to_video
()
# check if "Hi, welcome to Edx." text in the captions
self
.
assertIn
(
'Hi, welcome to Edx.'
,
self
.
video
.
captions_text
()
)
self
.
assertIn
(
'Hi, welcome to Edx.'
,
self
.
video
.
captions_text
)
# check if we can download transcript in "srt" format that has text "Hi, welcome to Edx."
self
.
assertTrue
(
self
.
video
.
downloaded_transcript_contains_text
(
'srt'
,
'Hi, welcome to Edx.'
))
...
...
@@ -357,7 +357,7 @@ class YouTubeVideoTest(VideoBaseTest):
# check if we see "好 各位同学" text in the captions
unicode_text
=
"好 各位同学"
.
decode
(
'utf-8'
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
()
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
)
# check if we can download transcript in "srt" format that has text "好 各位同学"
unicode_text
=
"好 各位同学"
.
decode
(
'utf-8'
)
...
...
@@ -495,7 +495,7 @@ class YouTubeVideoTest(VideoBaseTest):
self
.
course_nav
.
go_to_sequential
(
'C'
)
# menu "download_transcript" doesn't exist
self
.
assertFalse
(
self
.
video
.
is_menu_
exis
t
(
'download_transcript'
))
self
.
assertFalse
(
self
.
video
.
is_menu_
presen
t
(
'download_transcript'
))
def
_verify_caption_text
(
self
,
text
):
self
.
video
.
_wait_for
(
...
...
@@ -526,7 +526,7 @@ class YouTubeVideoTest(VideoBaseTest):
self
.
video
.
hide_captions
()
correct_languages
=
{
'en'
:
'English'
,
'zh'
:
'Chinese'
}
self
.
assertEqual
(
self
.
video
.
caption_languages
()
,
correct_languages
)
self
.
assertEqual
(
self
.
video
.
caption_languages
,
correct_languages
)
self
.
video
.
select_language
(
'zh'
)
...
...
@@ -554,9 +554,10 @@ class YouTubeVideoTest(VideoBaseTest):
Execute video steps
"""
for
video_name
in
video_names
:
self
.
video
.
click_player_button
(
'play'
,
video_name
)
self
.
assertIn
(
self
.
video
.
state
(
video_name
),
[
'playing'
,
'buffering'
])
self
.
video
.
click_player_button
(
'pause'
,
video_name
)
self
.
video
.
use_video
(
video_name
)
self
.
video
.
click_player_button
(
'play'
)
self
.
assertIn
(
self
.
video
.
state
,
[
'playing'
,
'buffering'
])
self
.
video
.
click_player_button
(
'pause'
)
# go to video
self
.
navigate_to_video
()
...
...
@@ -588,23 +589,23 @@ class YouTubeVideoTest(VideoBaseTest):
# select the "2.0" speed on video "A"
self
.
course_nav
.
go_to_sequential
(
'A'
)
self
.
video
.
s
et_speed
(
'2.0'
)
self
.
video
.
s
peed
=
'2.0'
# select the "0.50" speed on video "B"
self
.
course_nav
.
go_to_sequential
(
'B'
)
self
.
video
.
s
et_speed
(
'0.50'
)
self
.
video
.
s
peed
=
'0.50'
# open video "C"
self
.
course_nav
.
go_to_sequential
(
'C'
)
# check if video "C" should start playing at speed "0.75"
self
.
assertEqual
(
self
.
video
.
get_speed
()
,
'0.75x'
)
self
.
assertEqual
(
self
.
video
.
speed
,
'0.75x'
)
# open video "A"
self
.
course_nav
.
go_to_sequential
(
'A'
)
# check if video "A" should start playing at speed "2.0"
self
.
assertEqual
(
self
.
video
.
get_speed
()
,
'2.0x'
)
self
.
assertEqual
(
self
.
video
.
speed
,
'2.0x'
)
# reload the page
self
.
video
.
reload_page
()
...
...
@@ -613,22 +614,22 @@ class YouTubeVideoTest(VideoBaseTest):
self
.
course_nav
.
go_to_sequential
(
'A'
)
# check if video "A" should start playing at speed "2.0"
self
.
assertEqual
(
self
.
video
.
get_speed
()
,
'2.0x'
)
self
.
assertEqual
(
self
.
video
.
speed
,
'2.0x'
)
# select the "1.0" speed on video "A"
self
.
video
.
s
et_speed
(
'1.0'
)
self
.
video
.
s
peed
=
'1.0'
# open video "B"
self
.
course_nav
.
go_to_sequential
(
'B'
)
# check if video "B" should start playing at speed "0.50"
self
.
assertEqual
(
self
.
video
.
get_speed
()
,
'0.50x'
)
self
.
assertEqual
(
self
.
video
.
speed
,
'0.50x'
)
# open video "C"
self
.
course_nav
.
go_to_sequential
(
'C'
)
# check if video "C" should start playing at speed "1.0"
self
.
assertEqual
(
self
.
video
.
get_speed
()
,
'1.0x'
)
self
.
assertEqual
(
self
.
video
.
speed
,
'1.0x'
)
def
test_video_has_correct_transcript
(
self
):
"""
...
...
@@ -652,15 +653,15 @@ class YouTubeVideoTest(VideoBaseTest):
self
.
video
.
show_captions
()
self
.
assertIn
(
'Hi, welcome to Edx.'
,
self
.
video
.
captions_text
()
)
self
.
assertIn
(
'Hi, welcome to Edx.'
,
self
.
video
.
captions_text
)
self
.
video
.
s
et_speed
(
'1.50'
)
self
.
video
.
s
peed
=
'1.50'
self
.
video
.
reload_page
()
self
.
assertIn
(
'Hi, welcome to Edx.'
,
self
.
video
.
captions_text
()
)
self
.
assertIn
(
'Hi, welcome to Edx.'
,
self
.
video
.
captions_text
)
self
.
assertTrue
(
self
.
video
.
duration
()
,
'1.56'
)
self
.
assertTrue
(
self
.
video
.
duration
,
'1.56'
)
def
test_video_position_stored_correctly_wo_seek
(
self
):
"""
...
...
@@ -689,7 +690,7 @@ class YouTubeVideoTest(VideoBaseTest):
self
.
video
.
click_player_button
(
'play'
)
self
.
video
.
click_player_button
(
'pause'
)
self
.
assertGreaterEqual
(
self
.
video
.
seconds
()
,
5
)
self
.
assertGreaterEqual
(
self
.
video
.
seconds
,
5
)
@skip
(
"Intermittently fails 03 June 2014"
)
def
test_video_position_stored_correctly_with_seek
(
self
):
...
...
@@ -719,7 +720,7 @@ class YouTubeVideoTest(VideoBaseTest):
self
.
video
.
click_player_button
(
'play'
)
self
.
video
.
click_player_button
(
'pause'
)
self
.
assertGreaterEqual
(
self
.
video
.
seconds
()
,
10
)
self
.
assertGreaterEqual
(
self
.
video
.
seconds
,
10
)
class
YouTubeHtml5VideoTest
(
VideoBaseTest
):
...
...
@@ -759,7 +760,7 @@ class Html5VideoTest(VideoBaseTest):
self
.
navigate_to_video
()
# Verify that the video has autoplay mode disabled
self
.
assertFalse
(
self
.
video
.
is_autoplay_enabled
()
)
self
.
assertFalse
(
self
.
video
.
is_autoplay_enabled
)
def
test_html5_video_rendering_with_unsupported_sources
(
self
):
"""
...
...
@@ -773,14 +774,14 @@ class Html5VideoTest(VideoBaseTest):
self
.
navigate_to_video_no_render
()
# Verify that error message is shown
self
.
assertTrue
(
self
.
video
.
is_error_message_shown
()
)
self
.
assertTrue
(
self
.
video
.
is_error_message_shown
)
# Verify that error message has correct text
correct_error_message_text
=
'No playable video sources found.'
self
.
assertIn
(
correct_error_message_text
,
self
.
video
.
error_message_text
()
)
self
.
assertIn
(
correct_error_message_text
,
self
.
video
.
error_message_text
)
# Verify that spinner is not shown
self
.
assertFalse
(
self
.
video
.
is_spinner_shown
()
)
self
.
assertFalse
(
self
.
video
.
is_spinner_shown
)
def
test_download_button_wo_english_transcript
(
self
):
"""
...
...
@@ -800,7 +801,7 @@ class Html5VideoTest(VideoBaseTest):
# check if we see "好 各位同学" text in the captions
unicode_text
=
"好 各位同学"
.
decode
(
'utf-8'
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
()
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
)
# check if we can download transcript in "srt" format that has text "好 各位同学"
unicode_text
=
"好 各位同学"
.
decode
(
'utf-8'
)
...
...
@@ -825,7 +826,7 @@ class Html5VideoTest(VideoBaseTest):
self
.
navigate_to_video
()
# check if "Hi, welcome to Edx." text in the captions
self
.
assertIn
(
'Hi, welcome to Edx.'
,
self
.
video
.
captions_text
()
)
self
.
assertIn
(
'Hi, welcome to Edx.'
,
self
.
video
.
captions_text
)
# check if we can download transcript in "srt" format that has text "Hi, welcome to Edx."
self
.
assertTrue
(
self
.
video
.
downloaded_transcript_contains_text
(
'srt'
,
'Hi, welcome to Edx.'
))
...
...
@@ -836,7 +837,7 @@ class Html5VideoTest(VideoBaseTest):
# check if we see "好 各位同学" text in the captions
unicode_text
=
"好 各位同学"
.
decode
(
'utf-8'
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
()
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
)
#Then I can download transcript in "srt" format that has text "好 各位同学"
unicode_text
=
"好 各位同学"
.
decode
(
'utf-8'
)
...
...
@@ -887,7 +888,7 @@ class Html5VideoTest(VideoBaseTest):
self
.
video
.
show_captions
()
# check if we see "Hi, welcome to Edx." text in the captions
self
.
assertIn
(
"Hi, welcome to Edx."
,
self
.
video
.
captions_text
()
)
self
.
assertIn
(
"Hi, welcome to Edx."
,
self
.
video
.
captions_text
)
def
test_cc_button_wo_english_transcript
(
self
):
"""
...
...
@@ -909,7 +910,7 @@ class Html5VideoTest(VideoBaseTest):
# check if we see "好 各位同学" text in the captions
unicode_text
=
"好 各位同学"
.
decode
(
'utf-8'
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
()
)
self
.
assertIn
(
unicode_text
,
self
.
video
.
captions_text
)
def
test_video_rendering
(
self
):
"""
...
...
@@ -924,7 +925,7 @@ class Html5VideoTest(VideoBaseTest):
self
.
assertTrue
(
self
.
video
.
is_video_rendered
(
'html5'
))
self
.
assertTrue
(
all
([
source
in
HTML5_SOURCES
for
source
in
self
.
video
.
sources
()
]))
self
.
assertTrue
(
all
([
source
in
HTML5_SOURCES
for
source
in
self
.
video
.
sources
]))
class
YouTubeQualityTest
(
VideoBaseTest
):
...
...
@@ -945,11 +946,11 @@ class YouTubeQualityTest(VideoBaseTest):
"""
self
.
navigate_to_video
()
self
.
assertFalse
(
self
.
video
.
is_quality_button_visible
()
)
self
.
assertFalse
(
self
.
video
.
is_quality_button_visible
)
self
.
video
.
click_player_button
(
'play'
)
self
.
assertTrue
(
self
.
video
.
is_quality_button_visible
()
)
self
.
assertTrue
(
self
.
video
.
is_quality_button_visible
)
@skip_if_browser
(
'firefox'
)
def
test_quality_button_works_correctly
(
self
):
...
...
@@ -966,8 +967,8 @@ class YouTubeQualityTest(VideoBaseTest):
self
.
video
.
click_player_button
(
'play'
)
self
.
assertFalse
(
self
.
video
.
is_quality_button_active
()
)
self
.
assertFalse
(
self
.
video
.
is_quality_button_active
)
self
.
video
.
click_player_button
(
'quality'
)
self
.
assertTrue
(
self
.
video
.
is_quality_button_active
()
)
self
.
assertTrue
(
self
.
video
.
is_quality_button_active
)
common/test/acceptance/tests/video/test_video_times.py
View file @
45c2abbb
...
...
@@ -27,11 +27,11 @@ class VideoTimesTest(VideoBaseTest):
# go to video
self
.
navigate_to_video
()
self
.
assertEqual
(
self
.
video
.
position
()
,
'0:10'
)
self
.
assertEqual
(
self
.
video
.
position
,
'0:10'
)
self
.
video
.
click_player_button
(
'play'
)
self
.
assertGreaterEqual
(
int
(
self
.
video
.
position
()
.
split
(
':'
)[
1
]),
10
)
self
.
assertGreaterEqual
(
int
(
self
.
video
.
position
.
split
(
':'
)[
1
]),
10
)
def
test_video_end_time_with_default_start_time
(
self
):
"""
...
...
@@ -53,7 +53,7 @@ class VideoTimesTest(VideoBaseTest):
# wait until video stop playing
self
.
video
.
wait_for_state
(
'pause'
)
self
.
assertEqual
(
self
.
video
.
position
()
,
'0:02'
)
self
.
assertEqual
(
self
.
video
.
position
,
'0:02'
)
def
test_video_end_time_wo_default_start_time
(
self
):
"""
...
...
@@ -78,7 +78,7 @@ class VideoTimesTest(VideoBaseTest):
# wait until video stop playing
self
.
video
.
wait_for_state
(
'pause'
)
self
.
assertEqual
(
self
.
video
.
position
()
,
'1:00'
)
self
.
assertEqual
(
self
.
video
.
position
,
'1:00'
)
def
test_video_start_time_and_end_time
(
self
):
"""
...
...
@@ -96,14 +96,14 @@ class VideoTimesTest(VideoBaseTest):
# go to video
self
.
navigate_to_video
()
self
.
assertEqual
(
self
.
video
.
position
()
,
'0:10'
)
self
.
assertEqual
(
self
.
video
.
position
,
'0:10'
)
self
.
video
.
click_player_button
(
'play'
)
# wait until video stop playing
self
.
video
.
wait_for_state
(
'pause'
)
self
.
assertEqual
(
self
.
video
.
position
()
,
'0:12'
)
self
.
assertEqual
(
self
.
video
.
position
,
'0:12'
)
@skip
(
"Intermittently fails 03 June 2014"
)
def
test_video_end_time_and_finish_time
(
self
):
...
...
@@ -135,14 +135,14 @@ class VideoTimesTest(VideoBaseTest):
# wait until video stop playing
self
.
video
.
wait_for_state
(
'pause'
)
self
.
assertEqual
(
self
.
video
.
position
()
,
'1:42'
)
self
.
assertEqual
(
self
.
video
.
position
,
'1:42'
)
self
.
video
.
click_player_button
(
'play'
)
# wait until video stop playing
self
.
video
.
wait_for_state
(
'finished'
)
self
.
assertIn
(
self
.
video
.
position
()
,
[
'1:54'
,
'1:55'
])
self
.
assertIn
(
self
.
video
.
position
,
[
'1:54'
,
'1:55'
])
def
test_video_end_time_with_seek
(
self
):
"""
...
...
@@ -167,7 +167,7 @@ class VideoTimesTest(VideoBaseTest):
# wait until video stop playing
self
.
video
.
wait_for_state
(
'pause'
)
self
.
assertEqual
(
self
.
video
.
position
()
,
'0:32'
)
self
.
assertEqual
(
self
.
video
.
position
,
'0:32'
)
def
test_video_finish_time_with_seek
(
self
):
"""
...
...
@@ -198,4 +198,4 @@ class VideoTimesTest(VideoBaseTest):
# wait until video stop playing
self
.
video
.
wait_for_state
(
'finished'
)
self
.
assertIn
(
self
.
video
.
position
()
,
[
'1:54'
,
'1:55'
])
self
.
assertIn
(
self
.
video
.
position
,
[
'1:54'
,
'1:55'
])
requirements/edx/github.txt
View file @
45c2abbb
...
...
@@ -24,7 +24,7 @@
-e git+https://github.com/edx/django-waffle.git@823a102e48#egg=django-waffle
-e git+https://github.com/edx/event-tracking.git@0.1.0#egg=event-tracking
-e git+https://github.com/edx/edx-analytics-api-client.git@0.1.0#egg=analytics-client
-e git+https://github.com/edx/bok-choy.git@
821d3b0ac742c204a93d802a8732be024a0bce22
#egg=bok_choy
-e git+https://github.com/edx/bok-choy.git@
feb61863967134a378a7c912576cb31a94ba02bf
#egg=bok_choy
-e git+https://github.com/edx-solutions/django-splash.git@9965a53c269666a30bb4e2b3f6037c138aef2a55#egg=django-splash
-e git+https://github.com/edx/acid-block.git@459aff7b63db8f2c5decd1755706c1a64fb4ebb1#egg=acid-xblock
-e git+https://github.com/edx/edx-ora2.git@release-2014-07-28T12.09#egg=edx-ora2
...
...
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