Commit 60795564 by David Baumgold

Merge pull request #7764 from edx/parse-time-as-standalone-function

_parse_time_str can be a standalone function
parents 6050d07d 764d5e6e
......@@ -703,20 +703,6 @@ class VideoPage(PageObject):
'State is {state}'.format(state=state)
)
def _parse_time_str(self, time_str):
"""
Parse a string of the form 1:23 into seconds (int).
Arguments:
time_str (str): seek value
Returns:
int: seek value in seconds
"""
time_obj = time.strptime(time_str, '%M:%S')
return time_obj.tm_min * 60 + time_obj.tm_sec
def seek(self, seek_value):
"""
Seek the video to position specified by `seek_value`.
......@@ -725,7 +711,7 @@ class VideoPage(PageObject):
seek_value (str): seek value
"""
seek_time = self._parse_time_str(seek_value)
seek_time = _parse_time_str(seek_value)
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)
......@@ -811,3 +797,18 @@ class VideoPage(PageObject):
"""
captions_rendered_selector = self.get_element_selector(CSS_CLASS_NAMES['captions_rendered'])
self.wait_for_element_presence(captions_rendered_selector, 'Captions Rendered')
def _parse_time_str(time_str):
"""
Parse a string of the form 1:23 into seconds (int).
Arguments:
time_str (str): seek value
Returns:
int: seek value in seconds
"""
time_obj = time.strptime(time_str, '%M:%S')
return time_obj.tm_min * 60 + time_obj.tm_sec
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment