Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit243d445

Browse files
committed
Update the PhantomJS test suite
1 parentaeec7eb commit243d445

File tree

3 files changed

+91
-55
lines changed

3 files changed

+91
-55
lines changed

‎script/test‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ while ! lsof -i :$port >/dev/null; do
1111
sleep .05
1212
done
1313

14-
phantomjs ./test/run-qunit.coffee"http://localhost:$port/"
14+
phantomjs ./test/run-qunit.js \
15+
"http://localhost:$port/?jquery=3.2" \
16+
"http://localhost:$port/?jquery=2.2" \
17+
"http://localhost:$port/?jquery=1.12"

‎test/run-qunit.coffee‎

Lines changed: 0 additions & 54 deletions
This file was deleted.

‎test/run-qunit.js‎

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
varfs=require('fs')
2+
varsuites=require('system').args.slice(1)
3+
4+
functionprint(s){
5+
fs.write('/dev/stdout',s,'w')
6+
}
7+
8+
varpage=require('webpage').create()
9+
page.onConsoleMessage=function(msg){
10+
console.log(msg)
11+
}
12+
page.onError=function(msg){
13+
console.error('ERROR: '+msg)
14+
}
15+
16+
vartimeoutId=null
17+
functiondeferTimeout(){
18+
if(timeoutId)clearTimeout(timeoutId)
19+
timeoutId=setTimeout(function(){
20+
console.error('Timeout')
21+
phantom.exit(1)
22+
},3000)
23+
}
24+
25+
varendresult=0
26+
27+
functionrunSuite(){
28+
varsuite=suites.shift()
29+
if(!suite){
30+
phantom.exit(endresult)
31+
return
32+
}
33+
34+
page.open(suite,function(){
35+
deferTimeout()
36+
37+
varinterval=setInterval(function(){
38+
vartests=page.evaluate(function(){
39+
varresults=[]
40+
varels=document.getElementById('qunit-tests').children
41+
42+
for(vari=0;i<els.length;i++){
43+
vartest=els[i]
44+
if(test.className!=='running'&&!test.recorded){
45+
test.recorded=true
46+
if(test.className==='pass')results.push('.')
47+
elseif(test.className==='fail')results.push('F')
48+
}
49+
}
50+
51+
returnresults
52+
})
53+
54+
for(vari=0;i<tests.length;i++){
55+
deferTimeout()
56+
print(tests[i])
57+
}
58+
59+
varresult=page.evaluate(function(){
60+
vartestresult=document.getElementById('qunit-testresult')
61+
varels=document.getElementById('qunit-tests').children
62+
63+
if(testresult.innerText.match(/completed/)){
64+
console.log('')
65+
66+
for(vari=0;i<els.length;i++){
67+
vartest=els[i]
68+
if(test.className==='fail'){
69+
console.error(test.innerText)
70+
}
71+
}
72+
73+
console.log(testresult.innerText)
74+
returnparseInt(testresult.getElementsByClassName('failed')[0].innerText)
75+
}
76+
})
77+
78+
if(result!=null){
79+
endresult=result
80+
clearInterval(interval)
81+
runSuite()
82+
}
83+
},100)
84+
})
85+
}
86+
87+
runSuite()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp