I have setup siesta lite to test my ExtJs 4 application. I want to run a test depending upon the value of window.xxx and window.yyy of my application. So if xxx= 1 and yyy= 'xyz', I want to run a particular test file lets say test1.js. I read the siesta documentation but I couldn't find anything.
Here is my code:
var harness = new Siesta.Harness.Browser.ExtJS()
window.harnessObj = harness;
harness.configure({
title : 'My Tests',
preload : [
/* '../resources/extjs-4.2/resources/css/ext-all.css',
'../resources/extjs-4.2/ext-all-debug.js',
'../resources/json/textLabels.js',*/
]
});
harness.start(
{
group: 'Unit Tests',
pageUrl: '../index.html?unittest',
items:
[
{
title : 'PopUpWindow',
url : 'tests/PopUpWindow.js'
},
{
title : 'S_0-R_PjM',
url : 'tests/S_0-R_PjM.js'
}
]
}
);
harness.on('testsuitestart', function (event, harness)
{
//debugger;
console.log('I fucking love Testing')
}, this,
{ single : true }
)
I want to run 'tests/S_0-R_PjM.js' inside 'tests/S_0-R_PjM.js' depending upon the certain value of windows object which is set by my application index.html.
My index.js looks like this: // also supports: startTest(function(t) {
describe(function(t) {
t.diag("PfalzkomApp Loading Test");
t.ok(Ext, 'ExtJS has been loaded');
t.ok(Ext.Window, 'ExtJS.Window has been loaded');
t.ok(window.xxx, loaded with value :' + window.xxx);
t.ok(window.yyy, loaded with value :' + window.yyy);
var status = parseInt(window.xxx);
var role = window.yyy;
switch(status) {
case 111:
switch(role)
{
case "abc":
debugger;
// How to load another test file(tests/S_0-R_PjM.js) and start that test here !!!
break;
case "def":
break;
}
}
t.done();
})
// Updated Question - Sample code which I want to put inside another test file and call it when required
StartTest(function(t) {
t.diag("Case: Status: Neu and Role:PjM ");
//S_0-R_PjM
t.ok(Ext, 'ExtJS has been loaded');
t.done(); // Optional, marks the correct exit point from the test
})
Can some one guide me?