Permalink
Browse files

- travis ci support begins. not officially implemented yet. but it's …

…a start
  • Loading branch information...
1 parent ce6508e commit f36856d7004936fb51b7e35db993f9e0ab0cfded @ded committed Feb 11, 2012
Showing with 61 additions and 3 deletions.
  1. +10 −0 .travis.yml
  2. +4 −2 Makefile
  3. +5 −1 package.json
  4. +42 −0 tests/phantom.js
View
10 .travis.yml
@@ -0,0 +1,10 @@
+language: node_js
+node_js:
+ - 0.6
+branches:
+ only:
+ - master
+notifications:
+ email:
+ - dustin@dustindiaz.com
+ - rod@vagg.org
View
6 Makefile
@@ -2,6 +2,8 @@ boosh:
smoosh make ./config/smoosh.json
cp src/ender.js mobile/ender.js
-# requires npm >= 1.0.0
install:
- npm install smoosh -g
+ npm install smoosh -g
+
+test:
+ serve . && phantomjs tests/phantom.js
View
6 package.json
@@ -17,6 +17,10 @@
, "url": "https://github.com/ded/qwery.git"
}
, "devDependencies": {
- "sink-test": ">= 1.0.1"
+ "sink-test": ">= 1.0.1"
+ , "serve": "*"
+ }
+ , "scripts": {
+ "test": "phantomjs tests/phantom.js"
}
}
View
42 tests/phantom.js
@@ -0,0 +1,42 @@
+var page = new WebPage()
+ , url = "http://localhost:3000/tests/"
+
+function waitFor(testFx, onReady, timeOutMillis) {
+ var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 5000
+ , start = new Date().getTime()
+ , condition = false
+ , interval = setInterval(function() {
+ var diff = new Date().getTime() - start
+ if ( (diff < maxtimeOutMillis) && !condition ) {
+ condition = testFx()
+ } else {
+ if (!condition) {
+ console.log("'waitFor()' timeout")
+ phantom.exit(1)
+ } else {
+ console.log("'waitFor()' finished in " + (new Date().getTime() - start) + "ms");
+ onReady()
+ clearInterval(interval)
+ }
+ }
+ }, 250)
+}
+
+
+page.open(url, function (status) {
+ waitFor(function() {
+ var result = page.evaluate(function () {
+ return document.querySelectorAll('.sink-pass').length
+ })
+ , result2 = page.evaluate(function () {
+ return document.querySelectorAll('.pass').length
+ })
+ console.log('-----------------------------------------')
+ console.log(result2)
+ return !!result
+ }
+, function() {
+ console.log("qwery is loaded")
+ phantom.exit()
+ })
+})

0 comments on commit f36856d

Please sign in to comment.