-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestVerpURLs.html
57 lines (49 loc) · 1.58 KB
/
TestVerpURLs.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>TestVerpURLs</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<script>
var verpTestURLs = JSON.parse(window.prompt('Enter the Verp Test URLs', '[]')),
verpRespInfos = {},
verpTestedCount = 0,
verpPermCount = 0;
var verpTotalTestCount = verpTestURLs ? verpTestURLs.length : -1;
var verpOut = `TestVerpURLs: BEG (${verpTotalTestCount})`;
console.info(verpOut);
alert(verpOut);
if (verpTotalTestCount > 0) {
verpTestURLs.forEach((url) => {
jQuery.ajax(url, {
cache: true
}).done((data) => {
verpTestedCount++;
const resStr = JSON.stringify(data);
let respInfo = verpRespInfos[resStr],
extraMsg = '';
if (!respInfo) {
respInfo = verpRespInfos[resStr] = [];
verpPermCount++;
extraMsg = '(first response permutation)';
}
respInfo.push(url);
console.log(`TestVerpURLs: Test ${verpTestedCount} for ${url} ${extraMsg}`);
if (verpTestedCount == verpTotalTestCount) {
const success = (verpPermCount == 1);
verpOut = `TestVerpURLs: END (${verpTotalTestCount} with ${success ? 'SUCCESS' : `ERROR because of ${verpPermCount} permutations`})`;
console[success ? 'info' : 'error'](`${verpOut} -`, verpRespInfos);
alert(verpOut);
}
});
});
} else {
verpOut = `TestVerpURLs: END (${verpTotalTestCount})`;
console.info(verpOut);
alert(verpOut);
}
</script>
</body>
</html>