Get help with testing, discuss unit testing strategies etc.


Post by ankgkp »

Hi,
I'm having problem simulating the click event with a more complex view than the one in the MVC example. I have tried querying the button by text, and id. The console.log(btn) shows a valid returned object. But whenever I execute this: t.click(btn), I keep getting this error "getEl() is undefined". In the trial package, I know there's an "025-extjs-mvc" example which does a pretty good job in demonstrating this click event. I also tried adding a few more buttons into that grid panel and simulated the click action, and that worked fine. In my case, where I define my buttons outside of the panel of the view, the waitForCQ seems to be having problem finding the xy coordinates of the DOM-element. No matter which button I've been querying, the click event always happens right at the center of the page. Please help. Thank you!

Post by mats »

Can you please post the test case so we can debug it?

Post by ankgkp »

Here's my view:
var mybtn = Ext.create('Ext.button.Button', {
    id: 'thebtn',
    text: 'myButton'
    handler: function(){
                var mPanel = Ext.getCmp('myOtherPanel');
		mPanel.addCls('bluecolor');	
   }
});

Ext.define(myApp.view.MainPanel', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.myMainPanel',
    ....
});
and here is my test:
t.waitForCQ('button[text=myButton]', function(buttons) {
    var btn = buttons[0];
    t.click(btn, function() {
         console.log("button clicked");
    );
});
I'm not even testing anything yet. Just wanted to see if button is clicked or not. but I keep getting getEl() is undefined. Thank you!

Post by nickolay »

Is it consistent in both FF and Chrome? What line causes the exception?

Post by ankgkp »

yeah, it throws the same error on both FF and Chrome. It was "line 20488 siesta-all.js"

Post by nickolay »

What is your Siesta version? Its visible under the logo starting from 1.0.6 or available as "Siesta.meta.VERSION"

Post Reply