diff options
author | Stefan Giehl <stefan@matomo.org> | 2021-04-12 02:34:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-12 02:34:31 +0300 |
commit | 4850faed9e3d657321445c15ad6ae35292a02d0e (patch) | |
tree | 4ffc75b2963a9f23133de4654f7a40c2c41a27e3 /tests/javascript/index.php | |
parent | 3b1e602cfc9f814dfccca27a4eac2b3a68a5b044 (diff) |
Run JavaScript tests also with node/puppeteer (#17432)
* Run Javascript tests on node / puppeteer
* fix js tests for modern browsers supporting sendBeacon
* run js tests on phantomjs & on node/puppeteer
* updates travis submodule
Diffstat (limited to 'tests/javascript/index.php')
-rw-r--r-- | tests/javascript/index.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index aae7e4d09d..36f3ed44af 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -3276,16 +3276,18 @@ function PiwikTest() { tracker.setSiteId(1); tracker.setCustomData({ "token": '---' }); tracker.setRequestMethod('POST'); + ok(tracker.isUsingAlwaysUseSendBeacon()); + tracker.setRequestMethod('GeT'); + ok(!tracker.isUsingAlwaysUseSendBeacon()); + tracker.setRequestMethod('POST'); + tracker.disableAlwaysUseSendBeacon(); // disable send beacon to force sending a xhr var callbackCalled = false; tracker.trackPageView('withCredentialsTest', null, function (event) { callbackCalled = true; ok(event.success, 'succeeded'); ok(event.xhr && event.xhr.withCredentials, 'withCredentials is true'); }); - ok(tracker.isUsingAlwaysUseSendBeacon()); - tracker.setRequestMethod('GeT'); - ok(!tracker.isUsingAlwaysUseSendBeacon()); stop(); setTimeout(function() { @@ -5116,13 +5118,14 @@ if ($mysql) { var msSinceStarted = (stopTime.getTime() - startTime.getTime()); ok( msSinceStarted < 510, 'beforeUnloadHandler(): ' + msSinceStarted + ' was greater than 510 ' ); + tracker.disableAlwaysUseSendBeacon(); tracker.setLinkTrackingTimer(2000); startTime = new Date(); tracker.trackPageView(); tracker.hook.test._beforeUnloadHandler(); stopTime = new Date(); var diffTime = (stopTime.getTime() - startTime.getTime()); - ok( diffTime >= 2000, 'setLinkTrackingTimer()' ); + ok( diffTime >= 2000, 'setLinkTrackingTimer(): ' + diffTime); }); <?php |