forked from DevExpress/devextreme-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testRunner.html
139 lines (110 loc) · 3.94 KB
/
testRunner.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DevExtreme Demos</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.1.0.min.js"></script>
<script>
if(!window.jQuery) {
document.write(unescape('%3Cscript src="js/jquery-3.1.0.min.js"%3E%3C/script%3E'));
}
</script>
<style>
body {
margin:0;
overflow: hidden;
}
div.iframe {
width: 100%;
height: 1000px;
position: absolute;
top: 0;
}
iframe {
width: 100%;
height: 100%;
border: none;
overflow: hidden;
}
#frame-wrapper-1 {
z-index: 6;
}
#frame-wrapper-2 {
z-index: 5;
}
#frame-wrapper-3 {
z-index: 4;
}
#frame-wrapper-4 {
z-index: 3;
}
#frame-wrapper-5 {
z-index: 2;
}
#frame-wrapper-6 {
z-index: 1;
}
</style>
</head>
<body>
<!--DevExtreme Demos -->
<div class="iframe" id="frame-wrapper-1"><iframe id="iframe-1" scrolling="no"></iframe></div>
<div class="iframe" id="frame-wrapper-2"><iframe id="iframe-2" scrolling="no"></iframe></div>
<div class="iframe" id="frame-wrapper-3"><iframe id="iframe-3" scrolling="no"></iframe></div>
<div class="iframe" id="frame-wrapper-4"><iframe id="iframe-4" scrolling="no"></iframe></div>
<div class="iframe" id="frame-wrapper-5"><iframe id="iframe-5" scrolling="no"></iframe></div>
<div class="iframe" id="frame-wrapper-6"><iframe id="iframe-6" scrolling="no"></iframe></div>
<script>
window.screenNumber = 0;
window.screenName = "";
var divHeight = $("div.iframe").first().height();
window.LoadTest = function(testData) {
window.isReady = false;
$("iframe").data("loaded", false);
$.each(testData, function(index, data) {
$("#frame-wrapper-" + (index + 1)).data("id", data.Id);
var iframe = document.getElementById("iframe-" + (index + 1));
iframe.src = data.Url;
iframe.contentWindow.isReady = false;
$(iframe).data("loaded", true);
$(iframe).on("load", function() {
iframe.contentWindow.execCode = data.TestCode;
});
});
};
window.Next = function(callback) {
requestAnimationFrame(function() {
var elementForRemoving = document.getElementById("frame-wrapper-" + window.screenNumber);
if(elementForRemoving) elementForRemoving.remove();
window.screenNumber++;
window.screenName = $("#frame-wrapper-" + window.screenNumber).data("id");
setTimeout(callback, 150);
});
};
function isAllFramesReady() {
var ready = true;
$.each($("iframe"), function (_, frame) {
if (!$(frame).data("loaded")) return true;
if (!frame.contentWindow.isReady) {
ready = false;
return false;
}
});
return ready;
}
function readyForScreenshoting(callback) {
function intervalChecker() {
(function () {
if (!isAllFramesReady())
setTimeout(arguments.callee, 100);
else
callback();
})();
}
intervalChecker();
}
</script>
</body>
</html>