From 7fe5e2bf64f9dfb3cd8438d255851a4f4f370d9e Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Mon, 30 Nov 2015 16:54:55 -0800 Subject: [PATCH] Disable chunked dom-repeat tests on IE due to CI rAF flakiness. --- test/unit/dom-repeat.html | 343 +++++++++++++++++++------------------- 1 file changed, 170 insertions(+), 173 deletions(-) diff --git a/test/unit/dom-repeat.html b/test/unit/dom-repeat.html index 0b9eca9329..2436492cfc 100644 --- a/test/unit/dom-repeat.html +++ b/test/unit/dom-repeat.html @@ -3646,207 +3646,204 @@

x-repeat-chunked

}); - suite('chunked rendering', function() { + // TODO(kschaaf): This test suite has proven to be flaky only on IE, only + // on CI (Sauce) presumably because of rAF handling in the CI environment + // disabling for IE for now to avoid Polymer tests being flaky + if (!/Trident/.test(navigator.userAgent)) { - // Patch requestAnimationFrame to setTimeout to reduce IE test flakiness on CI - var rAF; - suiteSetup(function() { - rAF = window.requestAnimationFrame; - window.requestAnimationFrame = setTimeout; - }); - suiteTeardown(function() { - window.requestAnimationFrame = rAF; - }); + suite('chunked rendering', function() { - test('basic chunked rendering', function(done) { + test('basic chunked rendering', function(done) { - var checkItemOrder = function(stamped) { - for (var i=0; i lastLength); - } - if (stamped.length < 100) { - lastLength = stamped.length; - checkUntilComplete(); - } else { - // Final rendering at exact item count - assert.equal(stamped.length, 100); - done(); - } - }; - var checkUntilComplete = function() { - // On polyfilled MO, need to wait one setTimeout before rAF - if (MutationObserver._isPolyfilled) { - setTimeout(function() { + var lastLength = 0; + var checkCount = function() { + var stamped = Polymer.dom(chunked.root).querySelectorAll('*:not(template)'); + checkItemOrder(stamped); + if (stamped.length && lastLength === 0) { + // Initial rendering of initial count + assert.equal(stamped.length, 10); + } else { + // Remaining rendering incremenets + assert.isTrue(stamped.length > lastLength); + } + if (stamped.length < 100) { + lastLength = stamped.length; + checkUntilComplete(); + } else { + // Final rendering at exact item count + assert.equal(stamped.length, 100); + done(); + } + }; + var checkUntilComplete = function() { + // On polyfilled MO, need to wait one setTimeout before rAF + if (MutationObserver._isPolyfilled) { + setTimeout(function() { + requestAnimationFrame(checkCount); + }); + } else { requestAnimationFrame(checkCount); - }); - } else { - requestAnimationFrame(checkCount); - } - }; + } + }; - chunked.items = chunked.preppedItems.slice(); - checkUntilComplete(); + chunked.items = chunked.preppedItems.slice(); + checkUntilComplete(); - }); + }); - test('mutations during chunked rendering', function(done) { + test('mutations during chunked rendering', function(done) { - var checkItemOrder = function(stamped) { - var last = -1; - for (var i=0; i last); - last = curr; - } - }; + var checkItemOrder = function(stamped) { + var last = -1; + for (var i=0; i last); + last = curr; + } + }; - var mutateArray = function(repeater, renderedCount) { - // The goal here is to remove & add some, and do it over - // the threshold of where we have currently rendered items, and - // ensure that the prop values of the newly inserted items are in - // ascending order so we can do a simple check in checkItemOrder - var overlap = 2; - var remove = 4; - var add = 6; - var start = renderedCount.length - overlap; - if (start + add < repeater.items.length) { - var end = start + remove; - var args = ['items', start, remove]; - var startVal = repeater.items[start].prop; - var endVal = repeater.items[end].prop; - var delta = (endVal - startVal) / add; - for (var i=0; i lastLength); - } - if (stamped.length < chunked.items.length) { - if (mutateCount-- > 0) { - mutateArray(chunked, stamped); + var lastLength = 0; + var mutateCount = 5; + var checkCount = function() { + var stamped = Polymer.dom(chunked.root).querySelectorAll('*:not(template)'); + checkItemOrder(stamped); + if (stamped.length && lastLength === 0) { + // Initial rendering of initial count + assert.equal(stamped.length, 10); + } else { + // Remaining rendering incremenets + assert.isTrue(stamped.length > lastLength); } - lastLength = stamped.length; - checkUntilComplete(); - } else { - // Final rendering at exact item count - assert.equal(stamped.length, chunked.items.length); - done(); - } - }; - var checkUntilComplete = function() { - // On polyfilled MO, need to wait one setTimeout before rAF - if (MutationObserver._isPolyfilled) { - setTimeout(function() { + if (stamped.length < chunked.items.length) { + if (mutateCount-- > 0) { + mutateArray(chunked, stamped); + } + lastLength = stamped.length; + checkUntilComplete(); + } else { + // Final rendering at exact item count + assert.equal(stamped.length, chunked.items.length); + done(); + } + }; + var checkUntilComplete = function() { + // On polyfilled MO, need to wait one setTimeout before rAF + if (MutationObserver._isPolyfilled) { + setTimeout(function() { + requestAnimationFrame(checkCount); + }); + } else { requestAnimationFrame(checkCount); - }); - } else { - requestAnimationFrame(checkCount); - } - }; + } + }; - chunked.items = chunked.preppedItems.slice(); - checkUntilComplete(); + chunked.items = chunked.preppedItems.slice(); + checkUntilComplete(); - }); + }); - test('mutations during chunked rendering, sort & filtered', function(done) { + test('mutations during chunked rendering, sort & filtered', function(done) { - var checkItemOrder = function(stamped) { - var last = Infinity; - for (var i=0; i lastLength); + var lastLength = 0; + var mutateCount = 5; + var checkCount = function() { + var stamped = Polymer.dom(chunked.root).querySelectorAll('*:not(template)'); + checkItemOrder(stamped); + var filteredLength = chunked.items.filter(chunked.$.repeater.filter).length; + if (stamped.length && lastLength === 0) { + // Initial rendering of initial count + assert.equal(stamped.length, 10); + } else { + // Remaining rendering incremenets + if (stamped.length < filteredLength) { + assert.isTrue(stamped.length > lastLength); + } } - } - if (stamped.length < filteredLength) { - if (mutateCount-- > 0) { - mutateArray(chunked, stamped); + if (stamped.length < filteredLength) { + if (mutateCount-- > 0) { + mutateArray(chunked, stamped); + } + lastLength = stamped.length; + checkUntilComplete(); + } else { + assert.equal(stamped.length, filteredLength); + done(); } - lastLength = stamped.length; - checkUntilComplete(); - } else { - assert.equal(stamped.length, filteredLength); - done(); - } - }; - var checkUntilComplete = function() { - // On polyfilled MO, need to wait one setTimeout before rAF - if (MutationObserver._isPolyfilled) { - setTimeout(function() { + }; + var checkUntilComplete = function() { + // On polyfilled MO, need to wait one setTimeout before rAF + if (MutationObserver._isPolyfilled) { + setTimeout(function() { + requestAnimationFrame(checkCount); + }); + } else { requestAnimationFrame(checkCount); - }); - } else { - requestAnimationFrame(checkCount); - } - }; + } + }; - chunked.$.repeater.sort = function(a, b) { - return b.prop - a.prop; - }; - chunked.$.repeater.filter = function(a) { - return (a.prop % 2) === 0; - }; - chunked.items = chunked.preppedItems.slice(); - checkUntilComplete(); + chunked.$.repeater.sort = function(a, b) { + return b.prop - a.prop; + }; + chunked.$.repeater.filter = function(a) { + return (a.prop % 2) === 0; + }; + chunked.items = chunked.preppedItems.slice(); + checkUntilComplete(); + + }); }); - }); + }