From 4d609f80ea99a09683e7060a5d7643365a5d1056 Mon Sep 17 00:00:00 2001 From: muhammad-ammar Date: Thu, 22 Jun 2017 16:16:06 +0500 Subject: [PATCH] fix video flaky test EDUCATOR-607 --- .../js/spec/video/video_player_spec.js | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js index d4784df0ca..1c61ba6381 100644 --- a/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js @@ -380,22 +380,18 @@ function(VideoPlayer, HLS) { }); describe('when the video is playing', function() { - beforeEach(function(done) { + it('call runTimer in seekTo on player', function(done) { state.videoPlayer.play(); - jasmine.waitUntil(function() { return state.videoPlayer.isPlaying(); - }).done(done); - }); - - - it('call runTimer in seekTo on player', function() { - spyOn(state.videoPlayer, 'stopTimer').and.callThrough(); - spyOn(state.videoPlayer, 'runTimer').and.callThrough(); - state.videoPlayer.seekTo(10); - expect(state.videoPlayer.currentTime).toBe(10); - expect(state.videoPlayer.stopTimer).toHaveBeenCalled(); - expect(state.videoPlayer.runTimer).toHaveBeenCalled(); + }).then(function() { + spyOn(state.videoPlayer, 'stopTimer').and.callThrough(); + spyOn(state.videoPlayer, 'runTimer').and.callThrough(); + state.videoPlayer.seekTo(10); + expect(state.videoPlayer.currentTime).toBe(10); + expect(state.videoPlayer.stopTimer).toHaveBeenCalled(); + expect(state.videoPlayer.runTimer).toHaveBeenCalled(); + }).always(done); }); it('seek the player', function() {