Skip to content
Snippets Groups Projects
Commit 02b6df9a authored by pkupczyk's avatar pkupczyk
Browse files

SP-552 / BIS-366 : openbis.js - create an easy to install server configuration...

SP-552 / BIS-366 : openbis.js - create an easy to install server configuration for automated tests - remove the js tests from the old location

SVN: 28849
parent 82388e13
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 4877 deletions
var createFacade = function(action, url, timeoutOrNull){
stop();
var facade = new openbis(url);
facade.close = function(){
facade.logout(function(){
facade.closed = true;
});
};
action(facade);
var timeout = timeoutOrNull ? timeoutOrNull : 30000;
var checkInterval = 100;
var intervalTotal = 0;
var startWhenClosed = function(){
if(facade.closed){
start();
}else{
intervalTotal += checkInterval;
if(intervalTotal < timeout){
setTimeout(startWhenClosed, checkInterval);
}else{
start();
}
}
};
startWhenClosed();
}
var createFacadeAndLoginForUserAndPassword = function(user, password, action, url, timeoutOrNull){
createFacade(function(facade){
facade.login(user, password, function(response){
if(!response.error){
action(facade);
}
});
}, url, timeoutOrNull);
}
var createSearchCriteriaForCodes = function(codes){
var clauses = [];
$.each(codes, function(index, code){
clauses.push({"@type":"AttributeMatchClause",
attribute : "CODE",
fieldType : "ATTRIBUTE",
desiredValue : code
});
});
var searchCriteria = {
"@type" : "SearchCriteria",
matchClauses : clauses,
operator : "MATCH_ANY_CLAUSES"
};
return searchCriteria;
}
var assertArrays = function(array1, array2, msg){
deepEqual(array1.sort(), array2.sort(), msg);
}
var assertObjectsCount = function(objects, count){
equal(objects.length, count, 'Got ' + count + ' object(s)');
}
var assertObjectsWithValues = function(objects, propertyName, propertyValues){
var values = {};
$.each(objects, function(index, object){
var value = object[propertyName];
if(value in values == false){
values[value] = true;
}
});
deepEqual(Object.keys(values).sort(), propertyValues.sort(), 'Objects have correct ' + propertyName + ' values')
}
var assertObjectsWithValuesFunction = function(objects, propertyName, propertyFunction, propertyValues){
var values = {};
$.each(objects, function(index, object){
var value = propertyFunction(object);
if(value in values == false){
values[value] = true;
}
});
deepEqual(Object.keys(values).sort(), propertyValues.sort(), 'Objects have correct ' + propertyName + ' values')
}
var assertObjectsWithCollections = function(objects, propertyName){
ok(objects.some(function(object){
return object[propertyName] && Object.keys(object[propertyName]).length > 0;
}), 'Objects have ' + propertyName + ' collections');
}
var assertObjectsWithoutCollections = function(objects, propertyName){
ok(objects.every(function(object){
return !object[propertyName] || Object.keys(object[propertyName]).length == 0;
}), 'Object do not have ' + propertyName + ' collections');
}
var assertObjectsWithCodes = function(objects, codes){
assertObjectsWithValues(objects, 'code', codes);
}
var assertObjectsWithProperties = function(objects){
assertObjectsWithCollections(objects, 'properties');
}
var assertObjectsWithoutProperties = function(objects){
assertObjectsWithoutCollections(objects, 'properties');
}
var assertObjectsWithParentCodes = function(objects){
assertObjectsWithCollections(objects, 'parentCodes');
}
var assertObjectsWithoutParentCodes = function(objects){
assertObjectsWithoutCollections(objects, 'parentCodes');
}
var assertObjectsWithChildrenCodes = function(objects){
assertObjectsWithCollections(objects, 'childrenCodes');
}
var assertObjectsWithoutChildrenCodes = function(objects){
assertObjectsWithoutCollections(objects, 'childrenCodes');
}
\ No newline at end of file
/**
* QUnit v1.11.0 - A JavaScript Unit Testing Framework
*
* http://qunitjs.com
*
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
/** Font Family and Sizes */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
}
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
#qunit-tests { font-size: smaller; }
/** Resets */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
margin: 0;
padding: 0;
}
/** Header */
#qunit-header {
padding: 0.5em 0 0.5em 1em;
color: #8699a4;
background-color: #0d3349;
font-size: 1.5em;
line-height: 1em;
font-weight: normal;
border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-top-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
}
#qunit-header a {
text-decoration: none;
color: #c2ccd1;
}
#qunit-header a:hover,
#qunit-header a:focus {
color: #fff;
}
#qunit-testrunner-toolbar label {
display: inline-block;
padding: 0 .5em 0 .1em;
}
#qunit-banner {
height: 5px;
}
#qunit-testrunner-toolbar {
padding: 0.5em 0 0.5em 2em;
color: #5E740B;
background-color: #eee;
overflow: hidden;
}
#qunit-userAgent {
padding: 0.5em 0 0.5em 2.5em;
background-color: #2b81af;
color: #fff;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
#qunit-modulefilter-container {
float: right;
}
/** Tests: Pass/Fail */
#qunit-tests {
list-style-position: inside;
}
#qunit-tests li {
padding: 0.4em 0.5em 0.4em 2.5em;
border-bottom: 1px solid #fff;
list-style-position: inside;
}
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
display: none;
}
#qunit-tests li strong {
cursor: pointer;
}
#qunit-tests li a {
padding: 0.5em;
color: #c2ccd1;
text-decoration: none;
}
#qunit-tests li a:hover,
#qunit-tests li a:focus {
color: #000;
}
#qunit-tests li .runtime {
float: right;
font-size: smaller;
}
.qunit-assert-list {
margin-top: 0.5em;
padding: 0.5em;
background-color: #fff;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
.qunit-collapsed {
display: none;
}
#qunit-tests table {
border-collapse: collapse;
margin-top: .2em;
}
#qunit-tests th {
text-align: right;
vertical-align: top;
padding: 0 .5em 0 0;
}
#qunit-tests td {
vertical-align: top;
}
#qunit-tests pre {
margin: 0;
white-space: pre-wrap;
word-wrap: break-word;
}
#qunit-tests del {
background-color: #e0f2be;
color: #374e0c;
text-decoration: none;
}
#qunit-tests ins {
background-color: #ffcaca;
color: #500;
text-decoration: none;
}
/*** Test Counts */
#qunit-tests b.counts { color: black; }
#qunit-tests b.passed { color: #5E740B; }
#qunit-tests b.failed { color: #710909; }
#qunit-tests li li {
padding: 5px;
background-color: #fff;
border-bottom: none;
list-style-position: inside;
}
/*** Passing Styles */
#qunit-tests li li.pass {
color: #3c510c;
background-color: #fff;
border-left: 10px solid #C6E746;
}
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
#qunit-tests .pass .test-name { color: #366097; }
#qunit-tests .pass .test-actual,
#qunit-tests .pass .test-expected { color: #999999; }
#qunit-banner.qunit-pass { background-color: #C6E746; }
/*** Failing Styles */
#qunit-tests li li.fail {
color: #710909;
background-color: #fff;
border-left: 10px solid #EE5757;
white-space: pre;
}
#qunit-tests > li:last-child {
border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
}
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
#qunit-tests .fail .test-name,
#qunit-tests .fail .module-name { color: #000000; }
#qunit-tests .fail .test-actual { color: #EE5757; }
#qunit-tests .fail .test-expected { color: green; }
#qunit-banner.qunit-fail { background-color: #EE5757; }
/** Result */
#qunit-testresult {
padding: 0.5em 0.5em 0.5em 2.5em;
color: #2b81af;
background-color: #D2E0E6;
border-bottom: 1px solid white;
}
#qunit-testresult .module-name {
font-weight: bold;
}
/** Fixture */
#qunit-fixture {
position: absolute;
top: -10000px;
left: -10000px;
width: 1000px;
height: 1000px;
}
webapp-folder = html
openbisui-contexts = modules-menu
label = common-test.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Openbis-screening.js test</title>
<link rel="stylesheet" href="../common-test/qunit.css">
<script src="/ch.systemsx.cisd.openbis.plugin.screening.OpenBIS/resources/js/jquery.js"></script>
<script src="/ch.systemsx.cisd.openbis.plugin.screening.OpenBIS/resources/js/openbis.js"></script>
<script src="/ch.systemsx.cisd.openbis.plugin.screening.OpenBIS/resources/js/openbis-screening.js"></script>
<script src="../common-test/qunit.js"></script>
<script src="../common-test/common-test.js"></script>
<script src="openbis-screening-test.js"></script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</body>
</html>
\ No newline at end of file
webapp-folder = html
openbisui-contexts = modules-menu
label = openbis-screening-test.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Openbis.js test</title>
<link rel="stylesheet" href="../common-test/qunit.css">
<script src="/ch.systemsx.cisd.openbis.plugin.screening.OpenBIS/resources/js/jquery.js"></script>
<script src="/ch.systemsx.cisd.openbis.plugin.screening.OpenBIS/resources/js/openbis.js"></script>
<script src="../common-test/qunit.js"></script>
<script src="../common-test/common-test.js"></script>
<script src="openbis-test.js"></script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</body>
</html>
\ No newline at end of file
webapp-folder = html
openbisui-contexts = modules-menu
label = openbis-test.js
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment