From 7da2091aaf41e9783fa5674329338fe4b4482cdb Mon Sep 17 00:00:00 2001 From: muhammad-ammar Date: Wed, 26 Apr 2017 15:40:59 +0500 Subject: [PATCH] fix flaky js video test EDUCATOR-126 --- .../xmodule/js/spec/video/video_caption_spec.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js index bdd4438241..58ad83c0aa 100644 --- a/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js @@ -68,22 +68,25 @@ expect($('.video')).toContainElement('.closed-captions'); }); - // flaky test, see LEARNER-689 - xit('fetch the transcript in HTML5 mode', function(done) { + it('fetch the transcript in HTML5 mode', function(done) { + var transcriptURL = '/transcript/translation/en', + transcriptCall; state = jasmine.initializePlayer(); jasmine.waitUntil(function() { return state.videoCaption.loaded; }).then(function() { expect($.ajaxWithPrefix).toHaveBeenCalledWith({ - url: '/transcript/translation/en', + url: transcriptURL, notifyOnError: false, data: void(0), success: jasmine.any(Function), error: jasmine.any(Function) }); - expect($.ajaxWithPrefix.calls.mostRecent().args[0].data) - .toBeUndefined(); + transcriptCall = $.ajaxWithPrefix.calls.all().find(function(call) { + return call.args[0].url === transcriptURL; + }); + expect(transcriptCall.args[0].data).toBeUndefined(); }).always(done); });