diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2020-04-29 01:21:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 01:21:51 +0300 |
commit | f88b7fbcfac0aa4f0563bbbffa3c6a5965c41181 (patch) | |
tree | 324eca85529077eb28b47f4c24413750a1b7bcc6 /tests/javascript/index.php | |
parent | 1534367810d12bc9f50571d1dde02b153dae0d6a (diff) |
Queue content tracking requests (#15872)
Diffstat (limited to 'tests/javascript/index.php')
-rw-r--r-- | tests/javascript/index.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index 16f85a81be..c5963b4267 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -4378,6 +4378,7 @@ if ($mysql) { function resetTracker(track, token, replace) { + tracker.getRequestQueue().sendRequests(); // make sure to send any remaining queued requests tracker.clearTrackedContentImpressions(); tracker.clearEnableTrackOnlyVisibleContent(); tracker.setCustomData('token', token); @@ -4450,7 +4451,7 @@ if ($mysql) { tracker.trackAllContentImpressions(); strictEqual(tracker.getTrackedContentImpressions().length, 7, 'should mark 7 content blocks as tracked'); - wait(300); + wait(3000); var token2 = '2' + token; resetTracker(tracker, token2); @@ -4462,7 +4463,7 @@ if ($mysql) { tracker.trackContentImpressionsWithinNode(_e('click1')); strictEqual(tracker.getTrackedContentImpressions().length, 0, 'should not track anything as does not contain content block'); - wait(300); + wait(3000); var token3 = '3' + token; resetTracker(tracker, token3); @@ -4472,17 +4473,17 @@ if ($mysql) { tracker.trackContentImpression('Any://Name', 'AnyPiece?', 'http://www.example.com'); strictEqual(tracker.getTrackedContentImpressions().length, 0, 'manual impression call should not be marked as already tracked'); - wait(300); + wait(3000); var token4 = '4' + token; resetTracker(tracker, token4); tracker.trackContentInteraction(); // should not track anything as interaction and name is required tracker.trackContentInteraction('Clicki'); // should not track anything as interaction and name is required tracker.trackContentInteraction('Clicke', 'IntName'); // should use default for piece and ignore target as it is not set - wait(500); + wait(300); tracker.trackContentInteraction('Clicki', 'IntN:/ame', 'IntPiece?', 'http://int.example.com'); - wait(300); + wait(3000); setupContentTrackingFixture('trackingContent', document.body); @@ -4490,7 +4491,7 @@ if ($mysql) { resetTracker(tracker, token5); tracker.trackContentInteractionNode(_s('#ex5'), 'Clicki?iii'); - wait(300); + wait(3000); var token6 = '6' + token; resetTracker(tracker, token6); @@ -4499,6 +4500,8 @@ if ($mysql) { expected = [contentBlocks[7], contentBlocks[6], contentBlocks[5], contentBlocks[1], contentBlocks[4], contentBlocks[3], contentBlocks[2]]; propEqual(tracker.getTrackedContentImpressions().length, 7, 'should still track all impressions even if visible enabled'); + wait(3000); + var token7 = '7' + token; resetTracker(tracker, token7); tracker.enableTrackOnlyVisibleContent(false, 0); @@ -4510,8 +4513,7 @@ if ($mysql) { expected = [contentBlocks[6], contentBlocks[5]]; propEqual(tracker.getTrackedContentImpressions(), expected, 'should track the two visible ones'); - - wait(300); + wait(3000); var token8 = '8' + token; resetTracker(tracker, token8); @@ -4519,8 +4521,7 @@ if ($mysql) { expected = [contentBlocks[6], contentBlocks[5], contentBlocks[1]]; propEqual(tracker.getTrackedContentImpressions(), expected, 'should only track all visible impressions'); - - wait(300); + wait(3000); // test detection of content via interval var token9 = '9' + token; @@ -4575,6 +4576,7 @@ if ($mysql) { // trackAllContentImpressions() var results = fetchTrackedRequests(token); + equal( (/<span\>([0-9]+)\<\/span\>/.exec(results))[1], "7", "count trackAllContentImpressions requests. all content blocks should be tracked" ); var requests = results.match(/<span\>(.*?)\<\/span\>/g); @@ -4694,7 +4696,7 @@ if ($mysql) { equal( (/<span\>([0-9]+)\<\/span\>/.exec(results))[1], "6", "count automatically tracked requests, via scroll. " ); start(); - }, 7000); + }, 13000); expected = [ |