forked from joeyjiams/PhantomFlow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
64 lines (56 loc) · 1.34 KB
/
test.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
var path = require('path');
var fs = require('fs');
var showReport;
var filterTest;
var debugMode;
var remoteDebug;
var maxRetry;
var tests;
var results;
var setting = 'testSetting.json';
process.argv.forEach(function(arg, i){
if(arg === 'report'){
showReport = true;
}
if(/^debug/.test(arg)){
debugMode = true;
}
if(/^remoteDebug/.test(arg)){
remoteDebug = true;
}
if(/^test=/.test(arg)){
filterTest = arg.split('=')[1];
}
if(/^retry=/.test(arg)){
maxRetry = parseInt(arg.split('=')[1]);
}
if (/^setting=/.test(arg)) {
setting = arg.split('=')[1];
}
if (/^tests=/.test(arg)) {
tests = arg.split('=')[1];
}
if (/^results=/.test(arg)) {
results = arg.split('=')[1];
}
});
var phantomflowPathFile = './phantomflow.js';
var flow = require(phantomflowPathFile).init({
//earlyexit: true, // abort as soon as a test fails (also prevents report creation)
debug: debugMode ? 2 : undefined,
createReport: true,
test: filterTest,
remoteDebug: remoteDebug,
casperArgs: '--ssl-protocol=any --web-security=false --ignore-ssl-errors=yes',
retry: maxRetry,
setting: setting,
tests: tests, // specify a folder containing test files
results: results // specify a folder to place results from test runs
});
if(showReport){
flow.report();
} else {
flow.run(function(code){
process.exit(code);
});
}