mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
compare results from db
This commit is contained in:
parent
87d7894d71
commit
2580b48d16
@ -139,6 +139,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
function httpget(options) {
|
||||
return Bacon.fromCallback(function(callback) {
|
||||
http.get(options, function(res){
|
||||
var data = '';
|
||||
|
||||
res.on('data', function (chunk){
|
||||
data += chunk;
|
||||
});
|
||||
|
||||
res.on('end',function(){
|
||||
callback(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function parseJSON(str) {
|
||||
return JSON.parse(str);
|
||||
}
|
||||
|
||||
function writeResults() {
|
||||
Object.keys(results).forEach(function(browser) {
|
||||
var filename = "tests/results/" + browser + ".json";
|
||||
@ -158,12 +178,17 @@
|
||||
var options = {
|
||||
host: "api.mongolab.com",
|
||||
port: 443,
|
||||
path: "/api/1/databases/html2canvas/collections/webdriver-results?apiKey=" + process.env.MONGOLAB_APIKEY,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
path: "/api/1/databases/html2canvas/collections/webdriver-results?apiKey=" + process.env.MONGOLAB_APIKEY + '&q={"browser":"' + browser + '"}&fo=true&s={"timestamp":-1}'
|
||||
};
|
||||
|
||||
httpget(options).map(parseJSON).onValue(function(data) {
|
||||
compareResults(data.results, results[browser], browser);
|
||||
|
||||
options.method = 'POST';
|
||||
options.path = "/api/1/databases/html2canvas/collections/webdriver-results?apiKey=" + process.env.MONGOLAB_APIKEY;
|
||||
options.headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Length': result.length
|
||||
}
|
||||
};
|
||||
|
||||
console.log("Sending results for", browser);
|
||||
@ -174,6 +199,7 @@
|
||||
console.log(result);
|
||||
request.write(result);
|
||||
request.end();
|
||||
});
|
||||
}
|
||||
|
||||
console.log(colors.violet, "Writing", browser + ".json");
|
||||
|
Loading…
Reference in New Issue
Block a user