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
6a207714
Commit
6a207714
authored
Apr 04, 2014
by
polesye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BLD-970: Fix flaky test.
parent
059c5ce8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
45 deletions
+64
-45
lms/djangoapps/courseware/features/video.feature
+38
-38
lms/djangoapps/courseware/features/video.py
+26
-7
No files found.
lms/djangoapps/courseware/features/video.feature
View file @
6a207714
This diff is collapsed.
Click to expand it.
lms/djangoapps/courseware/features/video.py
View file @
6a207714
...
@@ -6,7 +6,7 @@ import json
...
@@ -6,7 +6,7 @@ import json
import
os
import
os
import
time
import
time
import
requests
import
requests
from
nose.tools
import
assert_less
from
nose.tools
import
assert_less
,
assert_equal
from
common
import
i_am_registered_for_the_course
,
visit_scenario_item
from
common
import
i_am_registered_for_the_course
,
visit_scenario_item
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext
as
_
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -183,9 +183,6 @@ def add_video_to_course(course, parent_location=None, player_mode=None, data=Non
...
@@ -183,9 +183,6 @@ def add_video_to_course(course, parent_location=None, player_mode=None, data=Non
parent_location
=
add_vertical_to_course
(
course
)
parent_location
=
add_vertical_to_course
(
course
)
kwargs
=
get_metadata
(
parent_location
,
player_mode
,
data
,
display_name
=
display_name
)
kwargs
=
get_metadata
(
parent_location
,
player_mode
,
data
,
display_name
=
display_name
)
world
.
scenario_dict
[
'VIDEO'
]
=
world
.
ItemFactory
.
create
(
**
kwargs
)
world
.
scenario_dict
[
'VIDEO'
]
=
world
.
ItemFactory
.
create
(
**
kwargs
)
world
.
wait_for_present
(
'.is-initialized'
)
world
.
wait_for_invisible
(
'.video-wrapper .spinner'
)
world
.
wait_for_ajax_complete
()
def
add_vertical_to_course
(
course_num
):
def
add_vertical_to_course
(
course_num
):
...
@@ -223,6 +220,7 @@ def navigate_to_an_item_in_a_sequence(number):
...
@@ -223,6 +220,7 @@ def navigate_to_an_item_in_a_sequence(number):
def
change_video_speed
(
speed
):
def
change_video_speed
(
speed
):
world
.
browser
.
execute_script
(
"$('.speeds').addClass('open')"
)
world
.
browser
.
execute_script
(
"$('.speeds').addClass('open')"
)
speed_css
=
'li[data-speed="{0}"] a'
.
format
(
speed
)
speed_css
=
'li[data-speed="{0}"] a'
.
format
(
speed
)
world
.
wait_for_visible
(
'.speeds'
)
world
.
css_click
(
speed_css
)
world
.
css_click
(
speed_css
)
...
@@ -302,6 +300,19 @@ def find_caption_line_by_data_index(index):
...
@@ -302,6 +300,19 @@ def find_caption_line_by_data_index(index):
return
world
.
css_find
(
SELECTOR
)
.
first
return
world
.
css_find
(
SELECTOR
)
.
first
def
wait_for_video
():
world
.
wait_for_present
(
'.is-initialized'
)
world
.
wait_for_present
(
'div.vidtime'
)
world
.
wait_for_invisible
(
'.video-wrapper .spinner'
)
world
.
wait_for_ajax_complete
()
@step
(
"I reload the page with video$"
)
def
reload_the_page_with_video
(
_step
):
_step
.
given
(
'I reload the page'
)
wait_for_video
()
@step
(
'youtube stub server (.*) YouTube API'
)
@step
(
'youtube stub server (.*) YouTube API'
)
def
configure_youtube_api
(
_step
,
action
):
def
configure_youtube_api
(
_step
,
action
):
action
=
action
.
strip
()
action
=
action
.
strip
()
...
@@ -326,6 +337,7 @@ def view_video(_step, player_mode):
...
@@ -326,6 +337,7 @@ def view_video(_step, player_mode):
data
=
_step
.
hashes
[
0
]
if
_step
.
hashes
else
None
data
=
_step
.
hashes
[
0
]
if
_step
.
hashes
else
None
add_video_to_course
(
coursenum
,
player_mode
=
player_mode
.
lower
(),
data
=
data
)
add_video_to_course
(
coursenum
,
player_mode
=
player_mode
.
lower
(),
data
=
data
)
visit_scenario_item
(
'SECTION'
)
visit_scenario_item
(
'SECTION'
)
wait_for_video
()
@step
(
'a video in "([^"]*)" mode(?:
\
:)?$'
)
@step
(
'a video in "([^"]*)" mode(?:
\
:)?$'
)
...
@@ -333,6 +345,7 @@ def add_video(_step, player_mode):
...
@@ -333,6 +345,7 @@ def add_video(_step, player_mode):
data
=
_step
.
hashes
[
0
]
if
_step
.
hashes
else
None
data
=
_step
.
hashes
[
0
]
if
_step
.
hashes
else
None
add_video_to_course
(
coursenum
,
player_mode
=
player_mode
.
lower
(),
data
=
data
)
add_video_to_course
(
coursenum
,
player_mode
=
player_mode
.
lower
(),
data
=
data
)
visit_scenario_item
(
'SECTION'
)
visit_scenario_item
(
'SECTION'
)
wait_for_video
()
@step
(
'video(?:s)? "([^"]*)" in "([^"]*)" mode in position "([^"]*)" of sequential(?:
\
:)?$'
)
@step
(
'video(?:s)? "([^"]*)" in "([^"]*)" mode in position "([^"]*)" of sequential(?:
\
:)?$'
)
...
@@ -345,6 +358,7 @@ def add_video_in_position(_step, video_ids, player_mode, position):
...
@@ -345,6 +358,7 @@ def add_video_in_position(_step, video_ids, player_mode, position):
@step
(
'I open the section with videos$'
)
@step
(
'I open the section with videos$'
)
def
visit_video_section
(
_step
):
def
visit_video_section
(
_step
):
visit_scenario_item
(
'SECTION'
)
visit_scenario_item
(
'SECTION'
)
wait_for_video
()
@step
(
'I select the "([^"]*)" speed$'
)
@step
(
'I select the "([^"]*)" speed$'
)
...
@@ -493,15 +507,19 @@ def select_language(_step, code):
...
@@ -493,15 +507,19 @@ def select_language(_step, code):
@step
(
'I click video button "([^"]*)"$'
)
@step
(
'I click video button "([^"]*)"$'
)
def
click_button
(
_step
,
button
):
def
click_button
(
_step
,
button
):
world
.
css_click
(
VIDEO_BUTTONS
[
button
])
world
.
css_click
(
VIDEO_BUTTONS
[
button
])
world
.
wait_for_ajax_complete
()
@step
(
'I see video s
tarts playing from "([^"]*)" position
$'
)
@step
(
'I see video s
lider at "([^"]*)" seconds
$'
)
def
start_playing_video_from_n_seconds
(
_step
,
position
):
def
start_playing_video_from_n_seconds
(
_step
,
position
):
world
.
wait_for
(
world
.
wait_for
(
func
=
lambda
_
:
world
.
css_html
(
'.vidtime'
)[:
4
]
==
position
.
strip
()
,
func
=
lambda
_
:
elapsed_time
()
>
0
,
timeout
=
5
timeout
=
30
)
)
actual_position
=
elapsed_time
()
assert_equal
(
actual_position
,
int
(
position
),
"Current position is {}, but should be {}"
.
format
(
actual_position
,
position
))
@step
(
'I see duration "([^"]*)"$'
)
@step
(
'I see duration "([^"]*)"$'
)
def
i_see_duration
(
_step
,
position
):
def
i_see_duration
(
_step
,
position
):
...
@@ -518,6 +536,7 @@ def seek_video_to_n_seconds(_step, seconds):
...
@@ -518,6 +536,7 @@ def seek_video_to_n_seconds(_step, seconds):
time
=
float
(
seconds
.
strip
())
time
=
float
(
seconds
.
strip
())
jsCode
=
"$('.video').data('video-player-state').videoPlayer.onSlideSeek({{time: {0:f}}})"
.
format
(
time
)
jsCode
=
"$('.video').data('video-player-state').videoPlayer.onSlideSeek({{time: {0:f}}})"
.
format
(
time
)
world
.
browser
.
execute_script
(
jsCode
)
world
.
browser
.
execute_script
(
jsCode
)
_step
.
given
(
'I see video slider at "{}" seconds'
.
format
(
seconds
))
@step
(
'I have a "([^"]*)" transcript file in assets$'
)
@step
(
'I have a "([^"]*)" transcript file in assets$'
)
...
...
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