Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2020-08-31 06:22:39 +0300
committerGitHub <noreply@github.com>2020-08-31 06:22:39 +0300
commit85d78179a0bdfab82db8cd0cd58c981685c00b8c (patch)
treeaf7653dfdc2b580c51d6f3f868615da4a93417d7 /tests/javascript/index.php
parent8a4afd2cd1960c94ce2ef97b0b6572feaac0ceff (diff)
Allow execution of core and plugin specific JS tests only (#16345)
Diffstat (limited to 'tests/javascript/index.php')
-rw-r--r--tests/javascript/index.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php
index 0753337864..69ae30e95a 100644
--- a/tests/javascript/index.php
+++ b/tests/javascript/index.php
@@ -8,11 +8,18 @@
$cacheBuster = md5(uniqid(mt_rand(), true));
+
// Note: when you want to debug the piwik.js during the tests, you need to set a cache buster that is always the same
// between requests so the browser knows it is the same file and know where to breakpoint.
//$cacheBuster= 'nocb'; // uncomment to debug
$root = dirname(__FILE__) . '/../..';
+$testPluginPath = '*';
+if (!empty($_GET['plugin'])
+ && ctype_alnum($_GET['plugin'])
+ && is_dir($root . '/plugins/' . $_GET['plugin'])) {
+ $testPluginPath = $_GET['plugin'];
+}
try {
$mysql = include_once $root . "/tests/PHPUnit/bootstrap.php";
@@ -92,10 +99,17 @@ testTrackPageViewAsync();
<?php
include_once $root . '/core/Filesystem.php';
- $files = \Piwik\Filesystem::globr($root . '/plugins/*/tests/javascript', 'head.php');
+ $files = \Piwik\Filesystem::globr($root . '/plugins/'.$testPluginPath.'/tests/javascript', 'head.php');
foreach ($files as $file) {
include_once $file;
}
+ if ($testPluginPath !== '*') {
+ // Travis would always include tag manager
+ $files = \Piwik\Filesystem::globr($root . '/plugins/TagManager/tests/javascript', 'head.php');
+ foreach ($files as $file) {
+ include_once $file;
+ }
+ }
?>
<style>
.assertSize {
@@ -2269,6 +2283,7 @@ function PiwikTest() {
equal(Piwik.getAsyncTracker().getTrackerUrl(), asyncTracker.getTrackerUrl(), 'async same getTrackerUrl()');
wait(2000);
+
var delayedTracker = Piwik.getTracker();
var delayedVisitorId = delayedTracker.getVisitorId();
equal(Piwik.getAsyncTracker().getVisitorId(), delayedVisitorId, 'delayedVisitorId ' + delayedVisitorId + ' should be the same as ' + Piwik.getAsyncTracker().getVisitorId());
@@ -5131,10 +5146,17 @@ function customAddEventListener(element, eventType, eventHandler, useCapture) {
<?php
include_once $root . '/core/Filesystem.php';
- $files = \Piwik\Filesystem::globr($root . '/plugins/*/tests/javascript', 'index.php');
+ $files = \Piwik\Filesystem::globr($root . '/plugins/'.$testPluginPath.'/tests/javascript', 'index.php');
foreach ($files as $file) {
include_once $file;
}
+ if ($testPluginPath !== '*') {
+ // Travis would always include tag manager
+ $files = \Piwik\Filesystem::globr($root . '/plugins/TagManager/tests/javascript', 'index.php');
+ foreach ($files as $file) {
+ include_once $file;
+ }
+ }
?>
<div id="jashDiv">