Commit a943fbef by Christina Roberts

Merge pull request #10462 from edx/christina/tnl-3725

Fix flaky video test
parents 6e80cedc f94459dd
...@@ -374,6 +374,13 @@ class VideoPage(PageObject): ...@@ -374,6 +374,13 @@ class VideoPage(PageObject):
speed_selector = self.get_element_selector('li[data-speed="{speed}"] a'.format(speed=speed)) speed_selector = self.get_element_selector('li[data-speed="{speed}"] a'.format(speed=speed))
self.q(css=speed_selector).first.click() self.q(css=speed_selector).first.click()
def verify_speed_changed(self, expected_speed):
"""
Wait for the video to change its speed to the expected value. If it does not change,
the wait call will fail the test.
"""
self.wait_for(lambda: self.speed == expected_speed, "Video speed changed")
def click_player_button(self, button): def click_player_button(self, button):
""" """
Click on `button`. Click on `button`.
......
...@@ -588,7 +588,6 @@ class YouTubeVideoTest(VideoBaseTest): ...@@ -588,7 +588,6 @@ class YouTubeVideoTest(VideoBaseTest):
self.go_to_sequential_position(1) self.go_to_sequential_position(1)
execute_video_steps(tab1_video_names) execute_video_steps(tab1_video_names)
@flaky # TODO: fix this, ticket TNL-3725
def test_video_component_stores_speed_correctly_for_multiple_videos(self): def test_video_component_stores_speed_correctly_for_multiple_videos(self):
""" """
Scenario: Video component stores speed correctly when each video is in separate sequential Scenario: Video component stores speed correctly when each video is in separate sequential
...@@ -614,13 +613,15 @@ class YouTubeVideoTest(VideoBaseTest): ...@@ -614,13 +613,15 @@ class YouTubeVideoTest(VideoBaseTest):
# open video "C" # open video "C"
self.course_nav.go_to_sequential('C') self.course_nav.go_to_sequential('C')
# check if video "C" should start playing at speed "0.75" # Since the playback speed was set to .5 in "B", this video will also be impacted
self.assertEqual(self.video.speed, '0.75x') # because a playback speed has never explicitly been set for it. However, this video
# does not have a .5 playback option, so the closest possible (.75) should be selected.
self.video.verify_speed_changed('0.75x')
# open video "A" # open video "A"
self.course_nav.go_to_sequential('A') self.course_nav.go_to_sequential('A')
# check if video "A" should start playing at speed "2.0" # Video "A" should still play at speed 2.0 because it was explicitly set to that.
self.assertEqual(self.video.speed, '2.0x') self.assertEqual(self.video.speed, '2.0x')
# reload the page # reload the page
...@@ -638,14 +639,15 @@ class YouTubeVideoTest(VideoBaseTest): ...@@ -638,14 +639,15 @@ class YouTubeVideoTest(VideoBaseTest):
# open video "B" # open video "B"
self.course_nav.go_to_sequential('B') self.course_nav.go_to_sequential('B')
# check if video "B" should start playing at speed "0.50" # Video "B" should still play at speed .5 because it was explicitly set to that.
self.assertEqual(self.video.speed, '0.50x') self.assertEqual(self.video.speed, '0.50x')
# open video "C" # open video "C"
self.course_nav.go_to_sequential('C') self.course_nav.go_to_sequential('C')
# check if video "C" should start playing at speed "1.0" # The change of speed for Video "A" should impact Video "C" because it still has
self.assertEqual(self.video.speed, '1.0x') # not been explicitly set to a speed.
self.video.verify_speed_changed('1.0x')
def test_video_has_correct_transcript(self): def test_video_has_correct_transcript(self):
""" """
......
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