From: Dan Vanderkam Date: Tue, 27 Oct 2015 14:10:33 +0000 (-0400) Subject: Attempt to make async tests run faster X-Git-Tag: v2.0.0~34^2 X-Git-Url: https://adrianiainlam.tk/git/?p=dygraphs.git;a=commitdiff_plain;h=75ef32c911ae5ac3c454d6ae21afdde1e39a93bf Attempt to make async tests run faster --- diff --git a/auto_tests/tests/highlight_series_background.js b/auto_tests/tests/highlight_series_background.js index 60f4f8d..d2a09f0 100644 --- a/auto_tests/tests/highlight_series_background.js +++ b/auto_tests/tests/highlight_series_background.js @@ -12,6 +12,22 @@ describe("highlight-series-background", function() { cleanupAfterEach(); + var origRepeatAndCleanup; + + beforeEach(function() { + // A "fast" version of repeatAndCleanup + origRepeatAndCleanup = utils.repeatAndCleanup; + // utils.repeatAndCleanup = function(repeatFn, maxFrames, framePeriodInMillis, cleanupFn) { + // repeatFn(0); + // if (maxFrames > 1) repeatFn(maxFrames - 1); + // cleanupFn(); + // }; + }); + + afterEach(function() { + utils.repeatAndCleanup = origRepeatAndCleanup; + }); + function setupGraph(highlightSeriesBackgroundAlpha, highlightSeriesBackgroundColor) { var opts = { @@ -45,10 +61,10 @@ describe("highlight-series-background", function() { graph.setSelection(0, 'y', true); // handle background color fade-in time - setTimeout(function() { + window.setTimeout(() => { assert.deepEqual(Util.samplePixel(graph.canvas_, 100, 100), [255,255,255,127]); done(); - }, 1000); + }, 500); }); it('testNoHighlight', function(done) { @@ -59,10 +75,10 @@ describe("highlight-series-background", function() { graph.setSelection(0, 'y', true); // handle background color fade-in time - setTimeout(function() { + window.setTimeout(() => { assert.deepEqual(Util.samplePixel(graph.canvas_, 100, 100), [0,0,0,0]); done(); - }, 1000); + }, 500); }); it('testCustomHighlightColor', function(done) { @@ -73,10 +89,10 @@ describe("highlight-series-background", function() { graph.setSelection(0, 'y', true); // handle background color fade-in time - setTimeout(function() { + window.setTimeout(() => { assert.deepEqual(Util.samplePixel(graph.canvas_, 100, 100), [0,255,255,127]); done(); - }, 1000); + }, 500); }); it('testCustomHighlightAlpha', function(done) { @@ -87,10 +103,10 @@ describe("highlight-series-background", function() { graph.setSelection(0, 'y', true); // handle background color fade-in time - setTimeout(function() { + window.setTimeout(() => { assert.deepEqual(Util.samplePixel(graph.canvas_, 100, 100), [255,255,255,179]); done(); - }, 1000); + }, 500); }); it('testCustomHighlightColorAndAlpha', function(done) { @@ -101,9 +117,9 @@ describe("highlight-series-background", function() { graph.setSelection(0, 'y', true); // handle background color fade-in time - setTimeout(function() { + window.setTimeout(() => { assert.deepEqual(Util.samplePixel(graph.canvas_, 100, 100), [255,0,0,76]); done(); - }, 1000); + }, 500); }); });