Skip to content

Commit

Permalink
CB-8070 MedicReporter from plugin-test-framework incompatible with me…
Browse files Browse the repository at this point in the history
…dic couch db structure.

It's fixed.
  • Loading branch information
MariaBukharina committed Nov 25, 2014
1 parent babbc4e commit 357b899
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
9 changes: 6 additions & 3 deletions www/assets/jasmine-medic.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -99,7 +99,8 @@ jasmineRequire.MedicReporter = function(j$) {
this.postTests({
mobilespec:buildResults(),
platform:(platformMap.hasOwnProperty(p) ? platformMap[p] : p),
version:p,
version: device.version.toLowerCase(),
sha: options.sha,
timestamp:Math.round(Math.floor((new Date()).getTime() / 1000)),
model:devmodel
});
Expand All @@ -124,7 +125,9 @@ jasmineRequire.MedicReporter = function(j$) {
console.log('posting tests');

var xhr = new XMLHttpRequest();
xhr.open("POST", serverurl+'/result', true);
var doc_id = [options.sha, json.version, json.model].map(encodeURIComponent).join('__');

This comment has been minimized.

Copy link
@janpio

janpio Nov 24, 2018

Member

4 years later: Is it possible that options.sha here is not available and this should actually be options.sha?

var doc_url = serverurl + '/mobilespec_results/' + doc_id;
xhr.open("PUT", doc_url, true);
xhr.setRequestHeader("Content-Type","application/json")
xhr.send(JSON.stringify(json));
}
Expand Down
24 changes: 14 additions & 10 deletions www/jasmine_helpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -81,13 +81,17 @@ function addJasmineReporters(jasmineInterface, jasmineEnv) {
jasmineEnv.addReporter(jasmineInterface.htmlReporter);

var medic = require('org.apache.cordova.test-framework.medic');
if (medic.enabled) {
jasmineRequire.medic(jasmineInterface.jasmine);
jasmineInterface.MedicReporter = new jasmineInterface.jasmine.MedicReporter({
env: jasmineEnv,
log: { logurl: medic.logurl }
});
jasmineInterface.MedicReporter.initialize();
jasmineEnv.addReporter(jasmineInterface.MedicReporter);
}
medic.load(function () {
if (medic.enabled) {
jasmineRequire.medic(jasmineInterface.jasmine);
jasmineInterface.MedicReporter = new jasmineInterface.jasmine.MedicReporter({
env: jasmineEnv,
log: { logurl: medic.logurl },
sha: medic.sha
});
jasmineInterface.MedicReporter.initialize();
jasmineEnv.addReporter(jasmineInterface.MedicReporter);
}
});

}
7 changes: 4 additions & 3 deletions www/medic.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -36,12 +36,13 @@ exports.log = function() {

exports.load = function (callback) {
var xhr = new XMLHttpRequest();
xhr.open("GET", "../medic.json", true);
xhr.open("GET", "medic.json", true);
xhr.onload = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
var cfg = JSON.parse(xhr.responseText);
exports.logurl = cfg.logurl;
exports.logurl = cfg.couchdb;
exports.enabled = true;
exports.sha = cfg.sha;
console.log('Loaded Medic Config: logurl=' + exports.logurl);
}
callback();
Expand Down

0 comments on commit 357b899

Please sign in to comment.