lundi 29 février 2016

Siesta - Run test based on certain Condition

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(PfalzkomApp, 'Pfalzkom Application has been loaded.');
    t.ok(PfalzkomApp.Utilities, 'Pfalzkom.Utilities.js has been loaded.');
    t.ok(PfalzkomApp.LeafletMapView, 'Pfalzkom.LeafletMapView.js has been loaded.');
    t.ok(window.jvar_prozessstatus, 'window.jvar_prozessstatus has been loaded with value :' + window.jvar_prozessstatus);
    t.ok(window.jvar_rolle, 'window.jvar_prozessstatus has been loaded with value :' + window.jvar_rolle);

    debugger; // Here I want to start a particular test depending upon window.jvar_prozessstatus  && window.jvar_rolle

     t.it('Should be possible to open all tabs', function (t) {
        t.chain(
            { click : ">>tab[text=Adito Belegpositionen]" },

            { click : ">>tab[text=Standortübersicht]" }
        );
    });

    t.done();   // Optional, marks the correct exit point from the test
})

Can some one guide me?

Aucun commentaire:

Enregistrer un commentaire