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
46541eb8
Commit
46541eb8
authored
Jun 20, 2014
by
muhammad-ammar
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4112 from edx/ammar/youtube-video-quality-tests
Youtube Video Quality Button Tests
parents
7e2bdeb3
15839147
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
18 deletions
+103
-18
common/test/acceptance/pages/lms/video/video.py
+32
-1
common/test/acceptance/tests/helpers.py
+23
-0
common/test/acceptance/tests/video/test_video_module.py
+48
-0
lms/djangoapps/courseware/features/video.feature
+0
-17
No files found.
common/test/acceptance/pages/lms/video/video.py
View file @
46541eb8
...
...
@@ -17,7 +17,8 @@ VIDEO_BUTTONS = {
'pause'
:
'.video_control.pause'
,
'fullscreen'
:
'.add-fullscreen'
,
'download_transcript'
:
'.video-tracks > a'
,
'speed'
:
'.speeds'
'speed'
:
'.speeds'
,
'quality'
:
'.quality-control'
,
}
CSS_CLASS_NAMES
=
{
...
...
@@ -852,3 +853,33 @@ class VideoPage(PageObject):
lambda
:
self
.
position
(
video_display_name
)
==
position
,
'Position is {position}'
.
format
(
position
=
position
)
)
def
is_quality_button_visible
(
self
,
video_display_name
=
None
):
"""
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'
])
return
self
.
q
(
css
=
selector
)
.
visible
def
is_quality_button_active
(
self
,
video_display_name
=
None
):
"""
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'
])
classes
=
self
.
q
(
css
=
selector
)
.
attrs
(
'class'
)[
0
]
.
split
()
return
'active'
in
classes
common/test/acceptance/tests/helpers.py
View file @
46541eb8
"""
Test helper functions and base classes.
"""
import
unittest
import
functools
import
requests
from
path
import
path
from
bok_choy.web_app_test
import
WebAppTest
def
skip_if_browser
(
browser
):
"""
Method decorator that skips a test if browser is `browser`
Args:
browser (str): name of internet browser
Returns:
Decorated function
"""
def
decorator
(
test_function
):
@functools.wraps
(
test_function
)
def
wrapper
(
self
,
*
args
,
**
kwargs
):
if
self
.
browser
.
name
==
browser
:
raise
unittest
.
SkipTest
(
'Skipping as this test will not work with {}'
.
format
(
browser
))
test_function
(
self
,
*
args
,
**
kwargs
)
return
wrapper
return
decorator
def
is_youtube_available
():
"""
Check if the required youtube urls are available.
...
...
common/test/acceptance/tests/video/test_video_module.py
View file @
46541eb8
...
...
@@ -15,6 +15,8 @@ from ...pages.lms.course_nav import CourseNavPage
from
...pages.lms.auto_auth
import
AutoAuthPage
from
...pages.lms.course_info
import
CourseInfoPage
from
...fixtures.course
import
CourseFixture
,
XBlockFixtureDesc
from
..helpers
import
skip_if_browser
VIDEO_SOURCE_PORT
=
8777
...
...
@@ -917,3 +919,49 @@ class Html5VideoTest(VideoBaseTest):
self
.
assertTrue
(
self
.
video
.
is_video_rendered
(
'html5'
))
self
.
assertTrue
(
all
([
source
in
HTML5_SOURCES
for
source
in
self
.
video
.
sources
()]))
class
YouTubeQualityTest
(
VideoBaseTest
):
""" Test YouTube Video Quality Button """
def
setUp
(
self
):
super
(
YouTubeQualityTest
,
self
)
.
setUp
()
@skip_if_browser
(
'firefox'
)
def
test_quality_button_visibility
(
self
):
"""
Scenario: Quality button appears on play.
Given the course has a Video component in "Youtube" mode
Then I see video button "quality" is hidden
And I click video button "play"
Then I see video button "quality" is visible
"""
self
.
navigate_to_video
()
self
.
assertFalse
(
self
.
video
.
is_quality_button_visible
())
self
.
video
.
click_player_button
(
'play'
)
self
.
assertTrue
(
self
.
video
.
is_quality_button_visible
())
@skip_if_browser
(
'firefox'
)
def
test_quality_button_works_correctly
(
self
):
"""
Scenario: Quality button works correctly.
Given the course has a Video component in "Youtube" mode
And I click video button "play"
And I see video button "quality" is inactive
And I click video button "quality"
Then I see video button "quality" is active
"""
self
.
navigate_to_video
()
self
.
video
.
click_player_button
(
'play'
)
self
.
assertFalse
(
self
.
video
.
is_quality_button_active
())
self
.
video
.
click_player_button
(
'quality'
)
self
.
assertTrue
(
self
.
video
.
is_quality_button_active
())
lms/djangoapps/courseware/features/video.feature
View file @
46541eb8
...
...
@@ -30,20 +30,3 @@ Feature: LMS.Video component
When
I open video
"D"
Then
the video has rendered in
"HTML5"
mode
And
the video does not show the captions
# 4
@skip_firefox
Scenario
:
Quality button appears on play
Given
the course has a Video component in
"Youtube"
mode
Then
I see video button
"quality"
is hidden
And
I click video button
"play"
Then
I see video button
"quality"
is visible
# 5
@skip_firefox
Scenario
:
Quality button works correctly
Given
the course has a Video component in
"Youtube"
mode
And
I click video button
"play"
And
I see video button
"quality"
is inactive
And
I click video button
"quality"
Then
I see video button
"quality"
is active
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