22var htmlPath = "http://localhost:8003/visualize.html"
33var outputDir = "/test-visualize-html-outputs"
44
5+ var DELAY_MS = 100 ;
6+
57var fs = require ( 'fs' ) ;
68var path = fs . absolute ( fs . workingDirectory + '/phantomcss.js' ) ;
79var phantomcss = require ( path ) ;
@@ -75,7 +77,7 @@ casper.test.begin('Testing ' + htmlPath, function (test) {
7577 casper . then ( function ( ) {
7678 casper . click ( "#aliasExampleLink" ) ;
7779 // brief wait for code to load
78- this . wait ( 250 , function ( ) {
80+ this . wait ( DELAY_MS , function ( ) {
7981 casper . click ( "#executeBtn" ) ;
8082 } ) ;
8183 } ) ;
@@ -95,7 +97,7 @@ casper.test.begin('Testing ' + htmlPath, function (test) {
9597 casper . then ( function ( ) {
9698 casper . click ( "#jmpStepFwd" ) ;
9799 // slight pause for vis to settle
98- this . wait ( 200 , function ( ) {
100+ this . wait ( DELAY_MS , function ( ) {
99101 phantomcss . screenshot ( '.visualizer' , 'visualizer' ) ;
100102 } ) ;
101103 } ) ;
@@ -109,7 +111,7 @@ casper.test.begin('Testing ' + htmlPath, function (test) {
109111 casper . then ( function ( ) {
110112 casper . click ( "#genPrimesLink" ) ;
111113 // brief wait for code to load
112- this . wait ( 250 , function ( ) {
114+ this . wait ( DELAY_MS , function ( ) {
113115 casper . click ( "#executeBtn" ) ;
114116
115117 casper . waitFor ( function check ( ) {
@@ -119,7 +121,7 @@ casper.test.begin('Testing ' + htmlPath, function (test) {
119121 } , function then ( ) {
120122 casper . click ( '#jmpLastInstr' ) ;
121123 // slight pause for vis to settle
122- this . wait ( 200 , function ( ) {
124+ this . wait ( DELAY_MS , function ( ) {
123125 phantomcss . screenshot ( '.visualizer' , 'visualizer_instr_limit_reached' ) ;
124126 } ) ;
125127 } ) ;
@@ -130,7 +132,7 @@ casper.test.begin('Testing ' + htmlPath, function (test) {
130132 casper . then ( function ( ) {
131133 casper . click ( "#pwTryFinallyLink" ) ;
132134 // brief wait for code to load
133- this . wait ( 250 , function ( ) {
135+ this . wait ( DELAY_MS , function ( ) {
134136 casper . click ( "#executeBtn" ) ;
135137
136138 casper . waitFor ( function check ( ) {
@@ -140,7 +142,7 @@ casper.test.begin('Testing ' + htmlPath, function (test) {
140142 } , function then ( ) {
141143 casper . click ( '#jmpLastInstr' ) ;
142144 // slight pause for vis to settle
143- this . wait ( 200 , function ( ) {
145+ this . wait ( DELAY_MS , function ( ) {
144146 phantomcss . screenshot ( '.visualizer' , 'visualizer_exception' ) ;
145147 } ) ;
146148 } ) ;
@@ -159,10 +161,10 @@ casper.test.begin('Testing ' + htmlPath, function (test) {
159161 document . querySelector ( '#textualMemoryLabelsSelector' ) . value = "false" ;
160162 } ) ;
161163
162- casper . wait ( 250 , function ( ) {
164+ casper . wait ( DELAY_MS , function ( ) {
163165 casper . click ( e ) ;
164166 // brief wait for code to load
165- this . wait ( 250 , function ( ) {
167+ this . wait ( DELAY_MS , function ( ) {
166168 casper . click ( "#executeBtn" ) ;
167169
168170 casper . waitFor ( function check ( ) {
@@ -172,7 +174,7 @@ casper.test.begin('Testing ' + htmlPath, function (test) {
172174 } , function then ( ) {
173175 casper . click ( '#jmpLastInstr' ) ;
174176 // slight pause for vis to settle
175- this . wait ( 200 , function ( ) {
177+ this . wait ( DELAY_MS , function ( ) {
176178 phantomcss . screenshot ( '#dataViz' , 'dataViz_' + e ) ;
177179 } ) ;
178180 } ) ;
@@ -187,10 +189,10 @@ casper.test.begin('Testing ' + htmlPath, function (test) {
187189 document . querySelector ( '#textualMemoryLabelsSelector' ) . value = "false" ;
188190 } ) ;
189191
190- casper . wait ( 250 , function ( ) {
192+ casper . wait ( DELAY_MS , function ( ) {
191193 casper . click ( e ) ;
192194 // brief wait for code to load
193- this . wait ( 250 , function ( ) {
195+ this . wait ( DELAY_MS , function ( ) {
194196 casper . click ( "#executeBtn" ) ;
195197 casper . waitFor ( function check ( ) {
196198 return this . evaluate ( function ( ) {
@@ -199,7 +201,7 @@ casper.test.begin('Testing ' + htmlPath, function (test) {
199201 } , function then ( ) {
200202 casper . click ( '#jmpLastInstr' ) ;
201203 // slight pause for vis to settle
202- this . wait ( 200 , function ( ) {
204+ this . wait ( DELAY_MS , function ( ) {
203205 phantomcss . screenshot ( '#dataViz' , 'dataViz_' + e + '_CUMULATIVE' ) ;
204206 } ) ;
205207 } ) ;
@@ -214,10 +216,10 @@ casper.test.begin('Testing ' + htmlPath, function (test) {
214216 document . querySelector ( '#textualMemoryLabelsSelector' ) . value = "true" ;
215217 } ) ;
216218
217- casper . wait ( 250 , function ( ) {
219+ casper . wait ( DELAY_MS , function ( ) {
218220 casper . click ( e ) ;
219221 // brief wait for code to load
220- this . wait ( 250 , function ( ) {
222+ this . wait ( DELAY_MS , function ( ) {
221223 casper . click ( "#executeBtn" ) ;
222224 casper . waitFor ( function check ( ) {
223225 return this . evaluate ( function ( ) {
@@ -226,7 +228,7 @@ casper.test.begin('Testing ' + htmlPath, function (test) {
226228 } , function then ( ) {
227229 casper . click ( '#jmpLastInstr' ) ;
228230 // slight pause for vis to settle
229- this . wait ( 200 , function ( ) {
231+ this . wait ( DELAY_MS , function ( ) {
230232 phantomcss . screenshot ( '#dataViz' , 'dataViz_' + e + '_TEXTLABELS' ) ;
231233 } ) ;
232234 } ) ;
0 commit comments