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
dc135e43
Commit
dc135e43
authored
Jun 12, 2014
by
Muhammad Ammar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Video Test Improvements
parent
501a1b59
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
7 deletions
+47
-7
common/test/acceptance/pages/lms/video/video.py
+42
-3
common/test/acceptance/tests/video/test_video_module.py
+5
-4
No files found.
common/test/acceptance/pages/lms/video/video.py
View file @
dc135e43
...
@@ -97,6 +97,28 @@ class VideoPage(PageObject):
...
@@ -97,6 +97,28 @@ class VideoPage(PageObject):
video_selector
=
'{0}'
.
format
(
CSS_CLASS_NAMES
[
'video_container'
])
video_selector
=
'{0}'
.
format
(
CSS_CLASS_NAMES
[
'video_container'
])
self
.
_wait_for_element
(
video_selector
,
'Video is initialized'
)
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
()
@wait_for_js
@wait_for_js
def
wait_for_video_player_render
(
self
):
def
wait_for_video_player_render
(
self
):
"""
"""
...
@@ -107,6 +129,10 @@ class VideoPage(PageObject):
...
@@ -107,6 +129,10 @@ class VideoPage(PageObject):
self
.
_wait_for_element
(
CSS_CLASS_NAMES
[
'video_init'
],
'Video Player Initialized'
)
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
(
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
()))
def
_is_finished_loading
():
def
_is_finished_loading
():
"""
"""
Check if video loading completed.
Check if video loading completed.
...
@@ -381,9 +407,9 @@ class VideoPage(PageObject):
...
@@ -381,9 +407,9 @@ class VideoPage(PageObject):
button_selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_BUTTONS
[
button
])
button_selector
=
self
.
get_element_selector
(
video_display_name
,
VIDEO_BUTTONS
[
button
])
self
.
q
(
css
=
button_selector
)
.
first
.
click
()
self
.
q
(
css
=
button_selector
)
.
first
.
click
()
if
button
==
'play'
:
button_states
=
{
'play'
:
'playing'
,
'pause'
:
'pause'
}
# wait for video buffering
if
button
in
button_states
:
self
.
_wait_for_video_play
(
video_display_name
)
self
.
wait_for_state
(
button_states
[
button
],
video_display_name
)
self
.
wait_for_ajax
()
self
.
wait_for_ajax
()
...
@@ -691,6 +717,9 @@ class VideoPage(PageObject):
...
@@ -691,6 +717,9 @@ class VideoPage(PageObject):
current_seek_position
=
self
.
q
(
css
=
selector
)
.
text
[
0
]
current_seek_position
=
self
.
q
(
css
=
selector
)
.
text
[
0
]
return
current_seek_position
.
split
(
'/'
)[
0
]
.
strip
()
return
current_seek_position
.
split
(
'/'
)[
0
]
.
strip
()
def
seconds
(
self
,
video_display_name
=
None
):
return
int
(
self
.
position
(
video_display_name
)
.
split
(
':'
)[
1
])
def
state
(
self
,
video_display_name
=
None
):
def
state
(
self
,
video_display_name
=
None
):
"""
"""
Extract the current state (play, pause etc) of video.
Extract the current state (play, pause etc) of video.
...
@@ -773,6 +802,16 @@ class VideoPage(PageObject):
...
@@ -773,6 +802,16 @@ class VideoPage(PageObject):
seek_selector
=
seek_selector
,
seek_time
=
seek_time
)
seek_selector
=
seek_selector
,
seek_time
=
seek_time
)
self
.
browser
.
execute_script
(
js_code
)
self
.
browser
.
execute_script
(
js_code
)
# after seek, player goes into `is-buffered` state. we need to get
# out of this state before doing any further operation/action.
def
_is_buffering_completed
():
"""
Check if buffering completed
"""
return
self
.
state
(
video_display_name
)
!=
'buffering'
self
.
_wait_for
(
_is_buffering_completed
,
'Buffering completed after Seek.'
)
def
reload_page
(
self
):
def
reload_page
(
self
):
"""
"""
Reload/Refresh the current video page.
Reload/Refresh the current video page.
...
...
common/test/acceptance/tests/video/test_video_module.py
View file @
dc135e43
...
@@ -681,7 +681,7 @@ class YouTubeVideoTest(VideoBaseTest):
...
@@ -681,7 +681,7 @@ class YouTubeVideoTest(VideoBaseTest):
self
.
video
.
click_player_button
(
'play'
)
self
.
video
.
click_player_button
(
'play'
)
self
.
video
.
click_player_button
(
'pause'
)
self
.
video
.
click_player_button
(
'pause'
)
self
.
assertGreaterEqual
(
int
(
self
.
video
.
position
()
.
split
(
':'
)[
1
]
),
5
)
self
.
assertGreaterEqual
(
self
.
video
.
seconds
(
),
5
)
@skip
(
"Intermittently fails 03 June 2014"
)
@skip
(
"Intermittently fails 03 June 2014"
)
def
test_video_position_stored_correctly_with_seek
(
self
):
def
test_video_position_stored_correctly_with_seek
(
self
):
...
@@ -701,16 +701,17 @@ class YouTubeVideoTest(VideoBaseTest):
...
@@ -701,16 +701,17 @@ class YouTubeVideoTest(VideoBaseTest):
self
.
navigate_to_video
()
self
.
navigate_to_video
()
self
.
video
.
click_player_button
(
'play'
)
self
.
video
.
click_player_button
(
'play'
)
self
.
video
.
click_player_button
(
'pause'
)
self
.
video
.
seek
(
'0:10'
)
self
.
video
.
seek
(
'0:10'
)
self
.
video
.
click_player_button
(
'play'
)
self
.
video
.
click_player_button
(
'pause'
)
self
.
video
.
click_player_button
(
'pause'
)
self
.
video
.
reload_page
()
self
.
video
.
reload_page
()
self
.
assertGreaterEqual
(
int
(
self
.
video
.
position
()
.
split
(
':'
)[
1
]),
10
)
self
.
video
.
click_player_button
(
'play'
)
self
.
video
.
click_player_button
(
'pause'
)
self
.
assertGreaterEqual
(
self
.
video
.
seconds
(),
10
)
class
YouTubeHtml5VideoTest
(
VideoBaseTest
):
class
YouTubeHtml5VideoTest
(
VideoBaseTest
):
...
...
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