-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtestspa.html
118 lines (105 loc) · 4.05 KB
/
testspa.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html>
<html lang="en">
<head>
<title>Experience Single Page Application Test</title>
<meta charset="utf-8">
<script type="text/javascript">
const sematextExperienceToken = '8763d12d-1j3t-932v-b498-544290z98k43';
const sematextExperienceReceiverURL = 'https://rum-receiver.sematext.com';
</script>
<script type="text/javascript">
// Those can be adjusted
const routeChangeInterval = 10000;
const xmlRequestInterval = 5000;
</script>
<script type="text/javascript">
window.SCE_DEBUG = true;
var numXMLHttpRequests = 0;
var numRouteChanges = 0;
var active = false;
function update() {
document.getElementById('numXMLRequestsInput').value = numXMLHttpRequests;
document.getElementById('numRouteChangesInput').value = numRouteChanges;
document.getElementById('startStopButton').value = active ? "Stop" : "Start";
}
function updateHiddenContent(routeChangeUrl) {
document.getElementById('testContent').innerHTML = routeChangeUrl;
}
function startStop() {
active = !active;
update();
}
window.setInterval(function() {
if (active) {
numXMLHttpRequests++;
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
update();
};
xhttp.open("GET", '/');
xhttp.send();
}
}, xmlRequestInterval);
window.setInterval(function() {
if (active) {
numRouteChanges++;
const routeChangeURL = '/change/' + numRouteChanges;
strum('routeChange', routeChangeURL);
updateHiddenContent(routeChangeURL);
update();
}
}, routeChangeInterval);
</script>
<script type="text/javascript">
(function(e,r,n,t,s){var a=[];e[s]=function(){a.push(arguments)};e[s].queue=a;var o=[];var i=[];var c=true;
var p=void 0;if(window.PerformanceObserver&&window.PerformanceObserver.supportedEntryTypes&&
(PerformanceObserver.supportedEntryTypes.indexOf("longtask")>=0||
PerformanceObserver.supportedEntryTypes.indexOf("element")>=0)){
p=new PerformanceObserver(function(e){e.getEntries().forEach(function(e){
switch(e.entryType){case"element":i.push(e);break;case"longtask":o.push(e);break;default:break}})});
p.observe({entryTypes:["longtask","element"]})}e[s+"lt"]={
longTasks:o,timingElements:i,inPageLoad:c,observer:p};if(t){var u=r.createElement(n);u.async=1;
u.src=t;var f=r.getElementsByTagName(n)[0];f.parentNode.insertBefore(u,f)}})
(window,document,"script","/experience.js","strum");
</script>
<script type="text/javascript">
strum('config', { token: sematextExperienceToken, 'receiverUrl': sematextExperienceReceiverURL });
</script>
</head>
<body>
<h1>Experience Single Page Application Test</h1>
<table>
<tr>
<td>
<label for="numXMLRequestsInput" style="font-weight: bold;">Number of Ajax Requests:</label>
</td>
<td>
<input type="text" style="width: 50px; text-align: right; font-size: 16px; font-weight: bolder;" id="numXMLRequestsInput" disabled>
</td>
</tr>
<tr>
<td>
<label for="numRouteChangesInput" style="font-weight: bold;">Number of Route Changes:</label>
</td>
<td>
<input type="text" style="width: 50px; text-align: right; font-size: 16px; font-weight: bolder;" id="numRouteChangesInput" disabled>
</td>
</tr>
<tr>
<td></td>
<td style="text-align: right;"><input type="button" id="startStopButton" value="Start" onclick="startStop()" /></td>
</tr>
</table>
<div>
<table>
<tr>
<td>Route change URL:</td>
<td><div id="testContent"></div></td>
</tr>
</table>
</div>
<script type="text/javascript">
update();
</script>
</body>
</html>