Discuss anything related to web development but no technical support questions


Post by awatson92 »

Hi Bryntum,

I am new to using Siesta and I've set-up Siesta to connect it to my Ext JS application. There are a few things that I am unsure of.

Firstly, the examples that I have seen if you want to create a test for a form you have to create a new 'Ext.FormPanel' and populate the panel with the fields you want. But how do you directly access a form that's in your Ext application that has already been created to test, or anything else for that matter. For example i try to do the following to access a form inside my application:- but in order to access this form the user needs to be able to login first.
describe("Testing Form", function(t) {
t.it('load form', function(t) {
        var form = Ext.create('SK.view.tools.orderCreate.digital.Digital', {
            renderTo: Ext.getBody()
        });
    });
});
Secondly, I can use the event recorder to log into my application and access the form that i want but, i don't want to just record UI events. I need to be able to check what happens if you try to enter something that isn't valid for a particular field. It seems to me that Siesta isn't aware of how a Ext application is set-up to test specific things of a application.

No matter what test i run in Siesta whether its a test for a model or a controller. It will always load my applications login screen in the DOM panel is there a reason for this? Would appreciate it if someone could get back to me on these issues.

Post by mats »

To unit test your classes, simply "preload" your application JS file(s) into your tests. Did you check out our Harness js file in the samples folder? There you see how we can use 'preload' to load JS / CSS into the test environment. Also, if you are preloading your application - it'll launch by default since that's how Sencha Cmd works. It's easy to workaround by just setting some global flag:
preload : [
     { text : window.TEST = true; },
     'app.js'
]
and in your app.js file simply don't start your app if this flag is set.

Post Reply