Commit 97ab0228 authored by Tristan Cavelier's avatar Tristan Cavelier

tests files changed and moved

parent f561b32e
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>JIO, Storages and ComplexQueries QUnit/Sinon Tests</title>
<link rel="stylesheet" href="../lib/qunit/qunit.css" />
</head>
<body>
<div id="qunit"></div>
<script src="../lib/qunit/qunit.js"></script>
<script src="../lib/sinon/sinon.js"></script>
<script src="../lib/sinon/sinon-qunit.js"></script>
<script src="../complex_queries.js"></script>
<script src="./queries/tests.js"></script>
<script src="../src/md5.amd.js"></script>
<script src="../jio.js"></script>
<script src="./jio/tests.js"></script>
<script src="../src/jio.storage/localstorage.js"></script>
<script src="./jio.storage/localstorage.tests.js"></script>
<script src="../src/sha256.amd.js"></script>
<script src="../src/jio.storage/revisionstorage.js"></script>
<script src="./jio.storage/revisionstorage.tests.js"></script>
<script src="../src/jio.storage/replicaterevisionstorage.js"></script>
<script src="./jio.storage/replicaterevisionstorage.tests.js"></script>
<script src="../src/jio.storage/indexstorage.js"></script>
<script src="./jio.storage/indexstorage.tests.js"></script>
<script src="../src/jio.storage/splitstorage.js"></script>
<script src="./jio.storage/splitstorage.tests.js"></script>
<script src="../src/jio.storage/gidstorage.js"></script>
<script src="./jio.storage/gidstorage.tests.js"></script>
<script src="../lib/jquery/jquery.min.js"></script>
<script src="../src/jio.storage/davstorage.js"></script>
<script src="./jio.storage/davstorage.tests.js"></script>
<script src="../src/sha1.amd.js"></script>
<script src="../src/jio.storage/s3storage.js"></script>
<script src="./jio.storage/s3storage.tests.js"></script>
<script src="../src/jio.storage/xwikistorage.js"></script>
<script src="./jio.storage/xwikistorage.tests.js"></script>
</body>
</html>
/*jslint indent: 2, maxlen: 80 */
/*global require, phantom, document, setInterval, clearInterval, console */
(function () {
"use strict";
var system = require('system'), page;
/**
* Wait until the test condition is true or a timeout occurs. Useful for
* waiting on a server response or for a ui change (fadeIn, etc.) to occur.
*
* @method waitFor
* @param {Function} testFx Condition that evaluates to a boolean
* @param {Function} onReady What to do when testFx condition is fulfilled
* @param {Number} time_out_millis The max amount of time to wait.
* If not specified, 10 sec is used.
*/
function waitFor(testFx, onReady, time_out_millis) {
var maxtime_out_millis, start, condition, interval;
maxtime_out_millis = time_out_millis || 10001;
start = new Date().getTime();
condition = false;
interval = setInterval(function () {
if ((new Date().getTime() - start < maxtime_out_millis) && !condition) {
// If not time-out yet and condition not yet fulfilled
condition = testFx();
} 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')
console.log("'waitFor()' finished in " +
(new Date().getTime() - start) + "ms.");
onReady();
clearInterval(interval); //< Stop this interval
}
}
}, 100); //< repeat check every 100ms
}
if (system.args.length !== 2) {
console.log('Usage: run-qunit.js URL');
phantom.exit(1);
}
page = require('webpage').create();
// 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(system.args[1], function (status) {
if (status !== "success") {
console.log("Unable to access network");
phantom.exit(1);
}
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 () {
console.log("========================================================");
console.log(document.documentElement.innerHTML);
console.log("========================================================");
var el = document.getElementById('qunit-testresult');
console.log(el.innerText);
try {
return el.getElementsByClassName('failed')[0].innerHTML;
} catch (ignore) { }
return 10000;
});
phantom.exit((parseInt(failedNum, 10) > 0) ? 1 : 0);
});
});
}());
......@@ -2,12 +2,15 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>JIO, Storages and ComplexQueries QUnit/Sinon Tests</title>
<link rel="stylesheet" href="../lib/qunit/qunit.css" />
<script src="../lib/require/require.js"></script>
<script src="tests.require.js"></script>
<title>JIO Qunit/Sinon Unit Tests</title>
</head>
<body>
<div id="qunit"></div>
<script src="../lib/qunit/qunit.js"></script>
<script src="../lib/sinon/sinon.js"></script>
<script src="../lib/sinon/sinon-qunit.js"></script>
<script src="../jio.js"></script>
<script src="jio/tests.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>JIO Qunit/Sinon Unit Tests</title>
<script src="../lib/require/require.js"></script>
<script src="tests.require.js"></script>
<link rel="stylesheet" href="../lib/qunit/qunit.css" />
</head>
<body>
<div id="qunit"></div>
</body>
</html>
/*jslint indent: 2, maxlen: 80 */
/*jslint indent: 2, maxlen: 80, nomen : true */
/*global require */
(function () {
......@@ -6,41 +6,14 @@
require.config({
"paths": {
"md5": "../src/md5.amd",
"sha1": "../src/sha1.amd",
"sha256": "../src/sha256.amd",
"jquery": "../lib/jquery/jquery.min",
"complex_queries": "../complex_queries",
"complex_queries_tests": "queries/tests",
"jio": "../jio",
"jio_tests": "jio/tests",
"localstorage": "../src/jio.storage/localstorage",
"localstorage_tests": "jio.storage/localstorage.tests",
"revisionstorage": "../src/jio.storage/revisionstorage",
"revisionstorage_tests": "jio.storage/revisionstorage.tests",
"replicaterevisionstorage": "../src/jio.storage/replicaterevisionstorage",
"replicaterevisionstorage_tests": "jio.storage/" +
"replicaterevisionstorage.tests",
"davstorage": "../src/jio.storage/davstorage",
"davstorage_tests": "jio.storage/davstorage.tests",
"indexstorage": "../src/jio.storage/indexstorage",
"indexstorage_tests": "jio.storage/indexstorage.tests",
"splitstorage": "../src/jio.storage/splitstorage",
"splitstorage_tests": "jio.storage/splitstorage.tests",
"gidstorage": "../src/jio.storage/gidstorage",
"gidstorage_tests": "jio.storage/gidstorage.tests",
"xwikistorage": "../src/jio.storage/xwikistorage",
"xwikistorage_tests": "jio.storage/xwikistorage.tests",
"s3storage": "../src/jio.storage/s3storage",
"s3storage_tests": "jio.storage/s3storage.tests",
"qunit": "../lib/qunit/qunit",
"sinon": "../lib/sinon/sinon",
"sinon_qunit": "../lib/sinon/sinon-qunit"
},
"shim": {
"jquery": {"exports": "jQuery"},
"sinon": ["qunit"],
"sinon_qunit": ["sinon"]
}
......@@ -48,16 +21,6 @@
require([
"sinon_qunit",
"complex_queries_tests",
"jio_tests",
"localstorage_tests",
"revisionstorage_tests",
"replicaterevisionstorage_tests",
"indexstorage_tests",
"splitstorage_tests",
"gidstorage_tests",
"davstorage_tests",
"xwikistorage_tests",
"s3storage_tests"
"jio_tests"
]);
}());
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment