From 8c8128b80a36e9427888d2a2f97408b37a133947 Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Wed, 29 May 2013 20:12:37 +0300 Subject: [PATCH] add test result storing --- .travis.yml | 1 + readme.md | 3 +++ tests/selenium.js | 28 +++++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cd6743a..37d6e82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ env: global: - secure: "eW41gIqOizwO4pTgWnAAbW75AP7F+CK9qfSed/fSh4sJ9HWMIY1YRIaY8gjr+6jV/f7XVHcXuym6ZxgINYSkVKbF1JKxBJNLOXtSgNbVHSic58pYFvUjwxIBI9aPig9uux1+DbnpWqXFDTcACJSevQZE0xwmjdrSkDLgB0G34v8=" - secure: "Y2Av+Gd3z9uQEB36GwdOOuGka0hx0/HeitASEo59z934O8RxnmN9eNTXS7dDT3XtKtwxIyLTOEpS7qlRdWahH28hr/dS4xJj6ao58C+1xMcDs6NAPGmDxUlcJWpcGEsnjmXjQCc3fBioSTdpIBrK/gdvgpNh77UKG74Sk7Z+YGk=" + - secure: "N7NyiiwdsVsKLomdkdeb1lUdSiN7+luks0V4Sh+foJp1RnBqM54B+0pZNiwotMuhTuwv0kjURCooKiyV3eaTleRthutGL9Gt8YiCaCq+biZaZXZnk0E3AQqg/ZzQLeZyreQpcMGsbCnwtywtjvTYB6aJA+ZFzEhq5LRF8tsDn2Y=" before_script: - npm install -g grunt-cli - curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash diff --git a/readme.md b/readme.md index a128d06..223cd54 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,9 @@ html2canvas =========== +### Current build status ### +[![Build Status](https://travis-ci.org/niklasvh/html2canvas.png)](https://travis-ci.org/niklasvh/html2canvas) + #### JavaScript HTML renderer #### This script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page. diff --git a/tests/selenium.js b/tests/selenium.js index 8e5847e..f99a59b 100644 --- a/tests/selenium.js +++ b/tests/selenium.js @@ -147,7 +147,33 @@ } catch(e) {} console.log(colors.violet, "Writing", browser + ".json"); - fs.writeFile(filename, JSON.stringify(results[browser])); + var date = new Date(); + var result = JSON.stringify({ + browser: browser, + results: results[browser], + timestamp: date.toISOString() + }); + + if (process.env.MONGOLAB_URL) { + var options = { + host: "api.mongolab.com", + port: 443, + path: process.env.MONGOLAB_URL, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Content-Length': result.length + } + }; + + var post_req = http.request(options, function(res) { + }); + + post_req.write(result); + post_req.end(); + } + + fs.writeFile(filename, result); }); }