mirror of
https://github.com/videojs/video.js.git
synced 2024-11-28 08:58:46 +02:00
Added Travis CI config, and also supporting package.json.
Removed flwplayer folder. Added phantomjs for Travis CI test running, including temp makefile.
This commit is contained in:
parent
0a8d967a3e
commit
be0febaad9
4
.gitignore
vendored
4
.gitignore
vendored
@ -2,4 +2,6 @@
|
||||
dist/*
|
||||
dev.html
|
||||
projects
|
||||
.zenflow-log
|
||||
.zenflow-log
|
||||
|
||||
node_modules
|
14
.jshintrc
14
.jshintrc
@ -1,12 +1,16 @@
|
||||
{
|
||||
"validthis": true,
|
||||
"laxcomma" : true,
|
||||
"laxbreak" : true,
|
||||
"browser" : true,
|
||||
"eqnull" : true,
|
||||
"debug" : true,
|
||||
"devel" : true,
|
||||
"boss" : true,
|
||||
"expr" : true,
|
||||
"asi" : true
|
||||
"eqnull" : true,
|
||||
"quotmark" : "double",
|
||||
"sub" : true,
|
||||
"trailing" : true,
|
||||
"undef" : true,
|
||||
"predef" : [ // Extra globals.
|
||||
"_V_",
|
||||
"VideoJS"
|
||||
]
|
||||
}
|
3
.travis.yml
Normal file
3
.travis.yml
Normal file
@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
10
Makefile
Normal file
10
Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
# Using makefile temporarily to run tests on Travis CI
|
||||
|
||||
test:
|
||||
# jshint src/*.js --config .jshintrc
|
||||
node test/server.js &
|
||||
phantomjs test/phantom.js "http://localhost:3000/test/unit.html"
|
||||
kill -9 `cat test/pid.txt`
|
||||
rm test/pid.txt
|
||||
|
||||
.PHONY: test
|
@ -1,8 +0,0 @@
|
||||
Tracking/Polling CurrentTime Manually
|
||||
-------------------------------------
|
||||
- Necessary for most flash players and browsers that don't trigger timeupdate events.
|
||||
- In VJS 1-2, we always tracked time because timeupdate was rare.
|
||||
- Now most browsers support it well. There is a delay bug in the current Chrome.
|
||||
http://code.google.com/p/chromium/issues/detail?id=92251
|
||||
Andrew from Chrome told me it would be fix in an upcoming release.
|
||||
Going to rely on browsers timeupdates when available now.
|
18
package.json
Normal file
18
package.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "Video.js"
|
||||
, "description": "An HTML5 and Flash video player with a common API and skin for both."
|
||||
, "version": "3.2.3"
|
||||
, "keywords": ["html5", "flash", "video", "player"]
|
||||
, "homepage": "http://videojs.com"
|
||||
, "author": "Steve Heffernan"
|
||||
, "scripts": { "test": "make test" }
|
||||
, "repository": {
|
||||
"type": "git"
|
||||
, "url": "https://github.com/zencoder/video-js.git"
|
||||
}
|
||||
, "devDependencies": {
|
||||
, "jshint": "0.6.1"
|
||||
, "connect": "2.1.3"
|
||||
, "phantomjs": "1.7.0"
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
63
test/phantom.js
Normal file
63
test/phantom.js
Normal file
@ -0,0 +1,63 @@
|
||||
// Simple phantom.js integration script
|
||||
// Adapted from Modernizr & Bootstrap
|
||||
|
||||
function waitFor(testFx, onReady, timeOutMillis) {
|
||||
var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 5001 //< Default Max Timout is 5s
|
||||
, start = new Date().getTime()
|
||||
, condition = false
|
||||
, interval = setInterval(function () {
|
||||
if ((new Date().getTime() - start < maxtimeOutMillis) && !condition) {
|
||||
// If not time-out yet and condition not yet fulfilled
|
||||
condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()) //< defensive code
|
||||
} else {
|
||||
if (!condition) {
|
||||
// If condition still not fulfilled (timeout but condition is 'false')
|
||||
console.log("'waitFor()' timeout")
|
||||
phantom.exit(1)
|
||||
} else {
|
||||
// Condition fulfilled (timeout and/or condition is 'true')
|
||||
typeof(onReady) === "string" ? eval(onReady) : onReady() //< Do what it's supposed to do once the condition is fulfilled
|
||||
clearInterval(interval) //< Stop this interval
|
||||
}
|
||||
}
|
||||
}, 100) //< repeat check every 100ms
|
||||
}
|
||||
|
||||
|
||||
if (phantom.args.length === 0 || phantom.args.length > 2) {
|
||||
console.log('Usage: phantom.js URL')
|
||||
phantom.exit()
|
||||
}
|
||||
|
||||
var page = new WebPage()
|
||||
|
||||
// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
|
||||
page.onConsoleMessage = function(msg) {
|
||||
console.log(msg)
|
||||
};
|
||||
|
||||
page.open(phantom.args[0], function(status){
|
||||
if (status !== "success") {
|
||||
console.log("Unable to access network")
|
||||
phantom.exit()
|
||||
} else {
|
||||
waitFor(function(){
|
||||
return page.evaluate(function(){
|
||||
var el = document.getElementById('qunit-testresult')
|
||||
if (el && el.innerText.match('completed')) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
}, function(){
|
||||
var failedNum = page.evaluate(function(){
|
||||
var el = document.getElementById('qunit-testresult')
|
||||
try {
|
||||
return el.getElementsByClassName('failed')[0].innerHTML
|
||||
} catch (e) { }
|
||||
return 10000
|
||||
});
|
||||
phantom.exit((parseInt(failedNum, 10) > 0) ? 1 : 0)
|
||||
})
|
||||
}
|
||||
})
|
14
test/server.js
Normal file
14
test/server.js
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Simple connect server for phantom.js
|
||||
* Adapted from Modernizr & Bootstrap
|
||||
*/
|
||||
|
||||
var connect = require('connect')
|
||||
, http = require('http')
|
||||
, fs = require('fs')
|
||||
, app = connect()
|
||||
.use(connect.static(__dirname + '/../'));
|
||||
|
||||
http.createServer(app).listen(3000);
|
||||
|
||||
fs.writeFileSync(__dirname + '/pid.txt', process.pid, 'utf-8')
|
@ -7,6 +7,9 @@
|
||||
<link rel="stylesheet" href="vendor/qunit/qunit/qunit.css" />
|
||||
<script src="vendor/qunit/qunit/qunit.js"></script>
|
||||
|
||||
<!-- phantomjs logging script-->
|
||||
<script src="unit/phantom-logging.js"></script>
|
||||
|
||||
<!-- Video.js CSS -->
|
||||
<link rel="stylesheet" href="../design/video-js.css" type="text/css">
|
||||
|
||||
|
21
test/unit/phantom-logging.js
Normal file
21
test/unit/phantom-logging.js
Normal file
@ -0,0 +1,21 @@
|
||||
// Logging setup for phantom integration
|
||||
// adapted from Modernizr & Bootstrap
|
||||
|
||||
QUnit.begin = function () {
|
||||
console.log("Starting test suite")
|
||||
console.log("================================================\n")
|
||||
}
|
||||
|
||||
QUnit.moduleDone = function (opts) {
|
||||
if (opts.failed === 0) {
|
||||
console.log("\u2714 All tests passed in '" + opts.name + "' module")
|
||||
} else {
|
||||
console.log("\u2716 " + opts.failed + " tests failed in '" + opts.name + "' module")
|
||||
}
|
||||
}
|
||||
|
||||
QUnit.done = function (opts) {
|
||||
console.log("\n================================================")
|
||||
console.log("Tests completed in " + opts.runtime + " milliseconds")
|
||||
console.log(opts.passed + " tests of " + opts.total + " passed, " + opts.failed + " failed.")
|
||||
}
|
Loading…
Reference in New Issue
Block a user