diff options
author | robocoder <anthon.pang@gmail.com> | 2011-03-19 01:37:20 +0300 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2011-03-19 01:37:20 +0300 |
commit | 861fde160884bf3c1591ddb7862b4fe7da5a3247 (patch) | |
tree | b7618dfa7d0e7bd9be40f23f658de92867b258be /tests/javascript/index.php | |
parent | 694e11fbed6cc4da03c8af0925dcd9f19816bbbd (diff) |
git-svn-id: http://dev.piwik.org/svn/trunk@4134 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'tests/javascript/index.php')
-rw-r--r-- | tests/javascript/index.php | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index 1f5e5a9f3d..9b7b9f2243 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -14,6 +14,11 @@ function getToken() { return "<?php $token = md5(uniqid(mt_rand(), true)); echo $token; ?>"; } <?php +$webtest = false; +if (file_exists("broken_webtest")) { + $webtest = true; +} + $sqlite = false; if (file_exists("enable_sqlite")) { if (extension_loaded('sqlite')) { @@ -656,7 +661,7 @@ if ($sqlite) { }); test("tracking", function() { - expect(44); + expect(' . ($webtest ? '40' : '44') . '); /* * Prevent Opera and HtmlUnit from performing the default action (i.e., load the href URL) @@ -708,7 +713,10 @@ if ($sqlite) { tracker.trackGoal(42, 69, { "token" : getToken(), "boy" : "Michael", "girl" : "Mandy"}); piwik_log("CompatibilityLayer", 1, "piwik.php", { "token" : getToken() }); + '; + if (!$webtest) { + echo ' tracker.hook.test._addEventListener(_e("click8"), "click", stopEvent); QUnit.triggerEvent( _e("click8"), "click" ); @@ -720,7 +728,10 @@ if ($sqlite) { tracker.hook.test._addEventListener(_e(buttons[i]), "click", stopEvent); QUnit.triggerEvent( _e(buttons[i]), "click" ); } + '; + } + echo ' var xhr = window.XMLHttpRequest ? new window.XMLHttpRequest() : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : null; @@ -794,7 +805,7 @@ if ($sqlite) { xhr.send(null); results = xhr.responseText; - equal( (/<span\>([0-9]+)\<\/span\>/.exec(results))[1], "17", "count tracking events" ); + equal( (/<span\>([0-9]+)\<\/span\>/.exec(results))[1], "' . ($webtest ? '13' : '17') . '", "count tracking events" ); // tracking requests ok( /PiwikTest/.test( results ), "trackPageView(), setDocumentTitle()" ); @@ -805,10 +816,18 @@ if ($sqlite) { ok( /example.fr/.test( results ), "async trackLink()" ); ok( /example.de/.test( results ), "push function" ); ok( /example.us/.test( results ), "addListener()" ); + '; + + if (!$webtest) { + echo ' ok( /example.net/.test( results ), "setRequestMethod(GET), click: implicit outlink (by outbound URL)" ); ok( /example.html/.test( results ), "click: explicit outlink" ); ok( /example.pdf/.test( results ), "click: implicit download (by file extension)" ); ok( /example.word/.test( results ), "click: explicit download" ); + '; + } + + echo ' ok( ! /example.exe/.test( results ), "enableLinkTracking()" ); ok( ! /example.php/.test( results ), "click: ignored example.php" ); ok( ! /example.org/.test( results ), "click: ignored example.org" ); |