Jasmine Unit Testing in Sencha Touch

To test a Sencha Touch module in Jasmine, either add your tests to an existing spec.js file, or see how to make tests for a new module: Creating Unit Tests for a New Module

 

In your jasmine specs.js file, create container with all the views you want to test:

Jasmine specs file for Sencha Touch
describe("Session", function () {
    var mainController = null;
    beforeEach(function () {
        if (!mainController) {
            mainController = testApp.getController('Session');
        }
        //creating blank main view for testing
        Ext.create('Ext.Container', {
            id: 'mainView',
            fullscreen: true,
            layout: 'card',
            items: [{
                xclass: 'RaxaEmr.view.Login'
            }, {
                xclass: 'RaxaEmr.view.Dashboard'
            }]
        });
    });
    it("adds modules to the dashboard at login", function () {
        mainController.doLogin();
        expect(Ext.getCmp('modulesPanel')).toBeDefined();
    });
});

Now you should be able to use Ext.getCmp() on whatever component you need to test.