From f8a5b3343534c688934d7746ae41042ff8048bce Mon Sep 17 00:00:00 2001 From: SparshithNR Date: Tue, 27 Jun 2017 10:47:14 -0700 Subject: [PATCH] #52 https://github.com/linkedin/spaniel/issues/52: Changed accuracy to be +-16ms*skip_cycle --- test/headless/specs/spaniel-observer.spec.js | 2 +- test/headless/specs/watcher/impression-complete-event.spec.js | 2 +- test/headless/specs/watcher/impression-event.spec.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/headless/specs/spaniel-observer.spec.js b/test/headless/specs/spaniel-observer.spec.js index 4d2fa46..5213c40 100644 --- a/test/headless/specs/spaniel-observer.spec.js +++ b/test/headless/specs/spaniel-observer.spec.js @@ -64,7 +64,7 @@ testModule('SpanielObserver', class extends SpanielObserverTestClass { .evaluate(function() { window.observer.unobserve(window.target); }) - .wait(20) + .wait(100) .getExecution() .evaluate(function() { return window.STATE.impressions === 1 && window.STATE.completes === 1; diff --git a/test/headless/specs/watcher/impression-complete-event.spec.js b/test/headless/specs/watcher/impression-complete-event.spec.js index 4fec66e..1d45896 100644 --- a/test/headless/specs/watcher/impression-complete-event.spec.js +++ b/test/headless/specs/watcher/impression-complete-event.spec.js @@ -67,7 +67,7 @@ testModule('Impression Complete event', class extends WatcherTestClass { .scrollTo(0) .wait(RAF_THRESHOLD * SKIP_CYCLE) .assert(function(e) { - return e.meta.duration >= 495 && e.meta.duration <= 545 && e.id === 5 && e.e === 'impression-complete'; + return e.meta.duration >= ((IMPRESSION_THRESHOLD * 5) - (RAF_THRESHOLD * SKIP_CYCLE)) && e.meta.duration <= ((IMPRESSION_THRESHOLD * 5) (RAF_THRESHOLD * SKIP_CYCLE)) && e.id === 5 && e.e === 'impression-complete'; }, 1) .done(); } diff --git a/test/headless/specs/watcher/impression-event.spec.js b/test/headless/specs/watcher/impression-event.spec.js index 00ede9d..fca9bad 100644 --- a/test/headless/specs/watcher/impression-event.spec.js +++ b/test/headless/specs/watcher/impression-event.spec.js @@ -17,7 +17,7 @@ const { time: { IMPRESSION_THRESHOLD, RAF_THRESHOLD, SMALL }, ITEM_TO_OBSERVE, S testModule('Impression event', class extends WatcherTestClass { ['@test should not fire if item is exposed but not impressed']() { return this.context.scrollTo(50) - .wait(RAF_THRESHOLD * 2) + .wait(RAF_THRESHOLD * SKIP_CYCLE) .assertOnce(ITEM_TO_OBSERVE, 'exposed') .assertNever(ITEM_TO_OBSERVE, 'impressed') .assertOnce(ITEM_TO_OBSERVE, 'exposed')