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
70e5e80e
Commit
70e5e80e
authored
Oct 18, 2013
by
polesye
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1339 from edx/anton/fix-video-js-unit-tests
Fix broken tests for video player
parents
d15bfb67
eaf5eb29
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
96 deletions
+83
-96
cms/djangoapps/contentstore/features/video-editor.feature
+5
-10
cms/djangoapps/contentstore/features/video.feature
+35
-27
cms/djangoapps/contentstore/features/video.py
+23
-0
common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js
+3
-40
common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js
+6
-1
common/lib/xmodule/xmodule/js/spec/video/video_progress_slider_spec.js
+2
-4
common/lib/xmodule/xmodule/js/spec/video/video_quality_control_spec.js
+9
-14
No files found.
cms/djangoapps/contentstore/features/video-editor.feature
View file @
70e5e80e
...
...
@@ -15,17 +15,12 @@ Feature: CMS.Video Component Editor
Then
I can modify the display name
And
my video display name change is persisted on save
# Disabling this 10/7/13 due to nondeterministic behavior
# in master. The failure seems to occur when YouTube does
# not respond quickly enough, so that the video player
# doesn't load.
#
# Sauce Labs cannot delete cookies
#
@skip_sauce
#
Scenario: Captions are hidden when "show captions" is false
#
Given I have created a Video component with subtitles
#
And I have set "show captions" to False
#
Then when I view the video it does not show the captions
@skip_sauce
Scenario
:
Captions are hidden when "show captions" is false
Given
I have created a Video component with subtitles
And
I have set
"show captions"
to False
Then
when I view the video it does not show the captions
# Sauce Labs cannot delete cookies
@skip_sauce
...
...
cms/djangoapps/contentstore/features/video.feature
View file @
70e5e80e
...
...
@@ -15,11 +15,11 @@ Feature: CMS.Video Component
# 3
# Sauce Labs cannot delete cookies
#
@skip_sauce
#
Scenario: Captions are hidden correctly
#
Given I have created a Video component with subtitles
#
And I have hidden captions
#
Then when I view the video it does not show the captions
@skip_sauce
Scenario
:
Captions are hidden correctly
Given
I have created a Video component with subtitles
And
I have hidden captions
Then
when I view the video it does not show the captions
# 4
# Sauce Labs cannot delete cookies
...
...
@@ -43,29 +43,37 @@ Feature: CMS.Video Component
Then
the correct Youtube video is shown
# 7
#
Scenario: Closed captions become visible when the mouse hovers over CC button
#
Given I have created a Video component with subtitles
#
And Make sure captions are closed
#
Then Captions become "invisible" after 3 seconds
#
And I hover over button "CC"
#
Then Captions become "visible"
#
And I hover over button "volume"
#
Then Captions become "invisible" after 3 seconds
Scenario
:
Closed captions become visible when the mouse hovers over CC button
Given
I have created a Video component with subtitles
And
Make sure captions are closed
Then
Captions become
"invisible"
after 3 seconds
And
I hover over button
"CC"
Then
Captions become
"visible"
And
I hover over button
"volume"
Then
Captions become
"invisible"
after 3 seconds
# 8
#
Scenario: Open captions never become invisible
#
Given I have created a Video component with subtitles
#
And Make sure captions are open
#
Then Captions are "visible"
#
And I hover over button "CC"
#
Then Captions are "visible"
#
And I hover over button "volume"
#
Then Captions are "visible"
Scenario
:
Open captions never become invisible
Given
I have created a Video component with subtitles
And
Make sure captions are open
Then
Captions are
"visible"
And
I hover over button
"CC"
Then
Captions are
"visible"
And
I hover over button
"volume"
Then
Captions are
"visible"
# 9
#Scenario: Closed captions are invisible when mouse doesn't hover on CC button
# Given I have created a Video component with subtitles
# And Make sure captions are closed
# Then Captions become "invisible" after 3 seconds
# And I hover over button "volume"
# Then Captions are "invisible"
Scenario
:
Closed captions are invisible when mouse doesn't hover on CC button
Given
I have created a Video component with subtitles
And
Make sure captions are closed
Then
Captions become
"invisible"
after 3 seconds
And
I hover over button
"volume"
Then
Captions are
"invisible"
# 10
Scenario
:
When
enter key is pressed on a caption shows an outline around it
Given
I have created a Video component with subtitles
And
Make sure captions are opened
Then
I focus on caption line with data-index 0
Then
I press
"enter"
button on caption line with data-index 0
And
I see caption line with data-index 0 has class
"focused"
cms/djangoapps/contentstore/features/video.py
View file @
70e5e80e
...
...
@@ -3,6 +3,7 @@
from
lettuce
import
world
,
step
from
xmodule.modulestore
import
Location
from
contentstore.utils
import
get_modulestore
from
selenium.webdriver.common.keys
import
Keys
BUTTONS
=
{
'CC'
:
'.hide-subtitles'
,
...
...
@@ -154,3 +155,25 @@ def check_captions_visibility_state(_step, visibility_state, timeout):
assert
world
.
css_visible
(
'.subtitles'
)
else
:
assert
not
world
.
css_visible
(
'.subtitles'
)
def
find_caption_line_by_data_index
(
index
):
SELECTOR
=
".subtitles > li[data-index='{index}']"
.
format
(
index
=
index
)
return
world
.
css_find
(
SELECTOR
)
.
first
@step
(
'I focus on caption line with data-index (
\
d+)$'
)
def
focus_on_caption_line
(
_step
,
index
):
find_caption_line_by_data_index
(
int
(
index
.
strip
()))
.
_element
.
send_keys
(
Keys
.
TAB
)
@step
(
'I press "enter" button on caption line with data-index (
\
d+)$'
)
def
focus_on_caption_line
(
_step
,
index
):
find_caption_line_by_data_index
(
int
(
index
.
strip
()))
.
_element
.
send_keys
(
Keys
.
ENTER
)
@step
(
'I see caption line with data-index (
\
d+) has class "([^"]*)"$'
)
def
caption_line_has_class
(
_step
,
index
,
className
):
SELECTOR
=
".subtitles > li[data-index='{index}']"
.
format
(
index
=
int
(
index
.
strip
()))
world
.
css_has_class
(
SELECTOR
,
className
.
strip
())
common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js
View file @
70e5e80e
...
...
@@ -48,7 +48,7 @@
}
return
false
;
},
'Expect captions to be loaded.'
,
1000
);
},
'Expect captions to be loaded.'
,
WAIT_TIMEOUT
);
runs
(
function
()
{
expect
(
$
.
ajaxWithPrefix
).
toHaveBeenCalledWith
({
...
...
@@ -469,9 +469,7 @@
});
describe
(
'set the height of caption container'
,
function
()
{
// Temporarily disabled due to intermittent failures
// with error "Expected 745 to be close to 805, 2." in Firefox
xit
(
'when CC button is enabled'
,
function
()
{
it
(
'when CC button is enabled'
,
function
()
{
var
realHeight
=
parseInt
(
$
(
'.subtitles'
).
css
(
'maxHeight'
),
10
),
...
...
@@ -576,12 +574,7 @@
$
(
'.subtitles li[data-start="14910"]'
).
trigger
(
'click'
);
});
// Temporarily disabled due to intermittent failures
// Fails with error: "InvalidStateError: An attempt was made to
// use an object that is not, or is no longer, usable
// Expected 0 to equal 14.91."
// on Firefox
xit
(
'trigger seek event with the correct time'
,
function
()
{
it
(
'trigger seek event with the correct time'
,
function
()
{
expect
(
videoPlayer
.
currentTime
).
toEqual
(
14.91
);
});
});
...
...
@@ -762,36 +755,6 @@
expect
(
videoCaption
.
autoScrolling
).
toBe
(
true
);
});
});
xdescribe
(
'when enter key is pressed on a caption'
,
function
()
{
var
subDataLiIdx__0
;
beforeEach
(
function
()
{
var
e
;
subDataLiIdx__0
=
$
(
'.subtitles li[data-index=0]'
);
spyOn
(
videoCaption
,
'seekPlayer'
).
andCallThrough
();
videoCaption
.
isMouseFocus
=
false
;
subDataLiIdx__0
.
trigger
(
jQuery
.
Event
(
'focus'
));
e
=
jQuery
.
Event
(
'keydown'
);
e
.
which
=
13
;
// ENTER key
subDataLiIdx__0
.
trigger
(
e
);
});
// Temporarily disabled due to intermittent failures.
//
// Fails with error: "InvalidStateError: InvalidStateError: An
// attempt was made to use an object that is not, or is no
// longer, usable".
xit
(
'shows an outline around it'
,
function
()
{
expect
(
subDataLiIdx__0
).
toHaveClass
(
'focused'
);
});
xit
(
'calls seekPlayer'
,
function
()
{
expect
(
videoCaption
.
seekPlayer
).
toHaveBeenCalled
();
});
});
});
});
...
...
common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js
View file @
70e5e80e
...
...
@@ -701,8 +701,13 @@
});
it
(
'set the player volume'
,
function
()
{
var
expectedValue
=
60
,
realValue
;
player
.
setVolume
(
60
);
expect
(
player
.
getVolume
()).
toEqual
(
0.6
);
realValue
=
Math
.
round
(
player
.
getVolume
()
*
100
);
expect
(
realValue
).
toEqual
(
expectedValue
);
});
});
});
...
...
common/lib/xmodule/xmodule/js/spec/video/video_progress_slider_spec.js
View file @
70e5e80e
...
...
@@ -154,7 +154,7 @@
// function might (and probably will) fail.
oldSetTimeout
=
window
.
setTimeout
;
// Redefine window.setTimeout() function as a spy.
window
.
setTimeout
=
jasmine
.
createSpy
().
andCallFake
(
function
(
callback
,
timeout
)
{
return
5
;
})
window
.
setTimeout
=
jasmine
.
createSpy
().
andCallFake
(
function
(
callback
,
timeout
)
{
return
5
;
})
;
window
.
setTimeout
.
andReturn
(
100
);
initialize
();
...
...
@@ -180,9 +180,7 @@
expect
(
videoPlayer
.
currentTime
).
toEqual
(
20
);
});
// Temporarily disabled due to intermittent failures
// Fails with error: " Expected true to be falsy."
xit
(
'set timeout to unfreeze the slider'
,
function
()
{
it
(
'set timeout to unfreeze the slider'
,
function
()
{
expect
(
window
.
setTimeout
).
toHaveBeenCalledWith
(
jasmine
.
any
(
Function
),
200
);
window
.
setTimeout
.
mostRecentCall
.
args
[
0
]();
expect
(
videoProgressSlider
.
frozen
).
toBeFalsy
();
...
...
common/lib/xmodule/xmodule/js/spec/video/video_quality_control_spec.js
View file @
70e5e80e
...
...
@@ -11,7 +11,9 @@
beforeEach
(
function
()
{
oldOTBD
=
window
.
onTouchBasedDevice
;
window
.
onTouchBasedDevice
=
jasmine
.
createSpy
(
'onTouchBasedDevice'
).
andReturn
(
false
);
window
.
onTouchBasedDevice
=
jasmine
.
createSpy
(
'onTouchBasedDevice'
)
.
andReturn
(
false
);
});
afterEach
(
function
()
{
...
...
@@ -20,7 +22,8 @@
});
describe
(
'constructor'
,
function
()
{
var
oldYT
=
window
.
YT
;
var
oldYT
=
window
.
YT
,
SELECTOR
=
'a.quality_control'
;
beforeEach
(
function
()
{
window
.
YT
=
{
...
...
@@ -37,21 +40,13 @@
});
it
(
'render the quality control'
,
function
()
{
expect
(
videoControl
.
secondaryControlsEl
.
html
())
.
toContain
(
'<a '
+
'href="#" '
+
'class="quality_control" '
+
'title="HD off" '
+
'role="button" '
+
'aria-disabled="false"'
+
'>HD off</a>'
);
var
container
=
videoControl
.
secondaryControlsEl
;
expect
(
container
).
toContain
(
SELECTOR
);
});
it
(
'bind the quality control'
,
function
()
{
expect
(
$
(
'.quality_control'
))
.
toHandleWith
(
'click'
,
videoQualityControl
.
toggleQuality
);
var
handler
=
videoQualityControl
.
toggleQuality
;
expect
(
$
(
SELECTOR
)).
toHandleWith
(
'click'
,
handler
);
});
});
});
...
...
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