/
run-tests.js
65 lines (54 loc) · 1.37 KB
/
run-tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*!
* Piwik - free/libre analytics platform
*
* UI test runner script
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
// required modules
var config = require("./../../UI/config.dist");
try {
var localConfig = require("./../../UI/config");
} catch (e) {
localConfig = null;
}
if (localConfig) {
for (var prop in localConfig) {
if (localConfig.hasOwnProperty(prop)) {
config[prop] = localConfig[prop];
}
}
}
// assume the URI points to a folder and make sure Piwik won't cut off the last path segment
if (config.phpServer.REQUEST_URI.slice(-1) != '/') {
config.phpServer.REQUEST_URI += '/';
}
require('./support/fs-extras');
phantom.injectJs('./support/globals.js');
// make sure script works wherever it's executed from
require('fs').changeWorkingDirectory(__dirname);
// load mocha + chai
require('./support/mocha-loader');
phantom.injectJs(chaiPath);
require('./support/chai-extras');
// load & configure resemble (for comparison)
phantom.injectJs(resemblePath);
resemble.outputSettings({
errorColor: {
red: 255,
green: 0,
blue: 0,
alpha: 125
},
errorType: 'movement',
transparency: 0.3,
largeImageThreshold: 20000
});
// run script
if (options['help']) {
app.printHelpAndExit();
}
app.init();
app.loadTestModules();
app.runTests();