diff options
author | Matthieu Aubry <mattab@users.noreply.github.com> | 2019-06-27 06:38:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-27 06:38:14 +0300 |
commit | 7a93a2b5ff683e7bb27339502a60c00add9fe26e (patch) | |
tree | 1787ddc4509a17baa1001d9e040d497f136ac5a7 /tests | |
parent | 62e252e76f2990b3dd06a12f1a7c12b1f728fdc0 (diff) |
JS Tracker: Prevent Error 400 issue on IE11 when custom dimension values include non ascii characters (#14566)
* Prevent Error 400 issue on IE11 when custom dimension values include non ascii characters
Issue found & Patch suggested by Customer
* typo
* fix test
* fix test
* fix JS test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/javascript/index.php | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index 1de34609ac..cdb17efb8a 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -17,7 +17,7 @@ $root = dirname(__FILE__) . '/../..'; try { $mysql = include_once $root . "/tests/PHPUnit/bootstrap.php"; } catch (Exception $e) { - echo 'alert("' . $e->getMessage() . '")'; + echo 'alert("ERROR, not all tests are running! --> ' . $e->getMessage() . '")'; $mysql = false; } @@ -3611,7 +3611,7 @@ if ($mysql) { test("tracking", function() { - expect(164); + expect(165); // Prevent Opera and HtmlUnit from performing the default action (i.e., load the href URL) var stopEvent = function (evt) { @@ -3698,8 +3698,8 @@ if ($mysql) { equal(tracker.getCustomDimension('not valid'), null, "if custom dimension index is invalid should return null"); tracker.setCustomDimension(1, 5); equal(tracker.getCustomDimension(1), "5", "set custom dimension should convert any value to a string" ); - tracker.setCustomDimension(1, "my custom value"); - equal(tracker.getCustomDimension(1), "my custom value", "should get stored custom dimension value" ); + tracker.setCustomDimension(1, "my custom value with éàç&*() EOL"); + equal(tracker.getCustomDimension(1), "my custom value with éàç&*() EOL", "should get stored custom dimension value" ); tracker.setCustomDimension(2, undefined); equal(tracker.getCustomDimension(2), "", "setCustomDimension should convert undefined to an empty string" ); @@ -3756,7 +3756,7 @@ if ($mysql) { var idPageview = tracker.getConfigIdPageView(); ok(/([0-9a-zA-Z]){6}/.test(idPageview), 'trackPageview, should generate a random pageview id'); - equal(tracker.getCustomDimension(1), "my custom value", "custom dimensions should not be cleared after a tracked pageview"); + equal(tracker.getCustomDimension(1), "my custom value with éàç&*() EOL", "custom dimensions should not be cleared after a tracked pageview"); equal(tracker.getCustomDimension(2), "", "custom dimensions should not be cleared after a tracked pageview"); tracker.trackPageView("CustomTitleTest", {dimension2: 'my new value', dimension5: 'another dimension'}); @@ -4077,7 +4077,11 @@ if ($mysql) { xhr.open("GET", "matomo.php?requests=" + getToken(), false); xhr.send(null); results = xhr.responseText; - equal( (/<span\>([0-9]+)\<\/span\>/.exec(results))[1], "41", "count tracking events" ); + var countTrackingEvents = /<span\>([0-9]+)\<\/span\>/.exec(results); + ok (countTrackingEvents, "countTrackingEvents is set"); + if(countTrackingEvents) { + equal( countTrackingEvents[1], "41", "count tracking events" ); + } // firing callback ok( trackLinkCallbackFired, "trackLink() callback fired" ); @@ -4124,10 +4128,10 @@ if ($mysql) { ok( /SaveCustomVariableCookie.*&cvar=%7B%222%22%3A%5B%22cookiename2PAGE%22%2C%22cookievalue2PAGE%22%5D%7D.*&_cvar=%7B%221%22%3A%5B%22cookiename%22%2C%22cookievalue%22%5D%2C%222%22%3A%5B%22cookiename2%22%2C%22cookievalue2%22%5D%7D/.test(results), "test custom vars are set"); // Test CustomDimension (persistent ones across requests) - ok( /dimension1=my%20custom%20value&dimension2=&/.test(results), "test custom dimensions are set"); + ok( /dimension1=my%20custom%20value%20with%20%C3%A9%C3%A0%C3%A7%26\*\(\)%20EOL&dimension2=&/.test(results), "test custom dimensions are set"); // send along a page view and ony valid for this pageview (dimension 2 overwrites another one) - ok( /dimension2=my%20new%20value&dimension5=another%20dimension&dimension1=my%20custom%20value&data=%7B%22token/.test( results ), "trackPageView(customTitle, customData)" ); + ok( /dimension2=my%20new%20value&dimension5=another%20dimension&dimension1=my%.*&data=%7B%22token/.test( results ), "trackPageView(customTitle, customData)" ); // Test campaign parameters set ok( /&_rcn=YEAH&_rck=RIGHT!/.test( results), "Test campaign parameters found"); |