From ef383891f28c995bf19a340d14bee8f707a2ff42 Mon Sep 17 00:00:00 2001 From: Ben Patterson Date: Thu, 11 Sep 2014 08:26:47 -0400 Subject: [PATCH] TE-468 JS test: Use the correct array for validating onSeek logs This particular test is failing in Solano workers; there the log is written in a different order, which was causing objects not to be found. --- .../xmodule/js/spec/video/video_player_spec.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 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 785f0d9183..8d23abfa45 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 @@ -395,9 +395,21 @@ function (VideoPlayer) { }, 'currentTime is less than 2 seconds', WAIT_TIMEOUT); runs(function () { - var args = state.videoPlayer.log.calls[0].args; + // Depending on the browser, the object of arrays may list the + // arrays in a different order. Find the array that is relevent + // to onSeek. Fail if that is not found. + var seekVideoArgIndex + for(var i = 0; i < state.videoPlayer.log.calls.length; i++){ + if (state.videoPlayer.log.calls[i].args[0] == 'seek_video') { + seekVideoArgIndex = i + break; + } + } + + expect(seekVideoArgIndex).toBeDefined; + + var args = state.videoPlayer.log.calls[seekVideoArgIndex].args; - expect(args[0]).toBe('seek_video'); expect(args[1].old_time).toBeLessThan(2); expect(args[1].new_time).toBe(2); expect(args[1].type).toBe('onSlideSeek');